return result;
result = Curl_client_write(data, CLIENTWRITE_HEADER,
- accept_ranges, sizeof(accept_ranges) - 1);
+ accept_ranges, CURL_CSTRLEN(accept_ranges));
if(result != CURLE_OK)
return result;
}
if(!str) {
/* Write null string if there is space. */
- if(prec == -1 || prec >= (int)sizeof(nilstr) - 1) {
+ if(prec == -1 || prec >= (int)CURL_CSTRLEN(nilstr)) {
str = nilstr;
- len = sizeof(nilstr) - 1;
+ len = CURL_CSTRLEN(nilstr);
/* Disable quotes around (nil) */
flags &= ~(unsigned int)FLAGS_ALT;
}
int width = p->width;
int flags = p->flags;
- width -= (int)(sizeof(nilstr) - 1);
+ width -= (int)CURL_CSTRLEN(nilstr);
if(flags & FLAGS_LEFT)
while(width-- > 0)
OUTCHAR(' ');
size_t num)
{
CURLcode result = CURLE_OK;
- const unsigned int alnumspace = sizeof(alnum) - 1;
+ const unsigned int alnumspace = CURL_CSTRLEN(alnum);
unsigned int r;
DEBUGASSERT(num > 1);
static const char ecjpake_suite[] = "TLS_ECJPAKE_WITH_AES_128_CCM_8";
if(!id) {
- if((len == sizeof(ecjpake_suite) - 1) &&
+ if((len == CURL_CSTRLEN(ecjpake_suite)) &&
curl_strnequal(ecjpake_suite, *str, len))
id = MBEDTLS_TLS_ECJPAKE_WITH_AES_128_CCM_8;
}
case RCMD_STREAM: {
static const char streamthis[] = "a string to stream 01234567890\n";
for(;;) {
- written = swrite(sock, streamthis, sizeof(streamthis) - 1);
+ written = swrite(sock, streamthis, CURL_CSTRLEN(streamthis));
if(got_exit_signal)
return -1;
- if(written != (ssize_t)(sizeof(streamthis) - 1)) {
+ if(written != (ssize_t)CURL_CSTRLEN(streamthis)) {
logmsg("Stopped streaming");
break;
}
int old_errno = errno;
if(!serverlogfile) {
static const char msg[] = "exit_signal_handler: serverlogfile not set\n";
- (void)write(STDERR_FILENO, msg, sizeof(msg) - 1);
+ (void)write(STDERR_FILENO, msg, CURL_CSTRLEN(msg));
}
else {
int fd = -1;
if(fd != -1) {
#endif
static const char msg[] = "exit_signal_handler: called\n";
- (void)write(fd, msg, sizeof(msg) - 1);
+ (void)write(fd, msg, CURL_CSTRLEN(msg));
curlx_close(fd);
}
else {
static const char msg[] = "exit_signal_handler: failed opening ";
- (void)write(STDERR_FILENO, msg, sizeof(msg) - 1);
+ (void)write(STDERR_FILENO, msg, CURL_CSTRLEN(msg));
(void)write(STDERR_FILENO, serverlogfile, strlen(serverlogfile));
(void)write(STDERR_FILENO, "\n", 1);
}