/* Do the actual %-code parsing */
if(dprintf_Pass1(format, vto, endpos, ap_save))
- return -1;
+ return 0;
end = &endpos[0]; /* the initial end-position from the list dprintf_Pass1()
created for us */
info.max = maxlength;
retcode = dprintf_formatf(&info, addbyter, format, ap_save);
- if((retcode != -1) && info.max) {
+ if(info.max) {
/* we terminate this with a zero byte */
if(info.max == info.length) {
/* we're at maximum, scrap the last letter */
info.buffer[-1] = 0;
+ DEBUGASSERT(retcode);
retcode--; /* don't count the nul byte */
}
else
info.fail = 0;
retcode = dprintf_formatf(&info, alloc_addbyter, format, ap_save);
- if((-1 == retcode) || info.fail) {
+ if(!retcode && info.fail) {
Curl_dyn_free(info.b);
return 1;
}
char *curl_mvaprintf(const char *format, va_list ap_save)
{
- int retcode;
struct asprintf info;
struct dynbuf dyn;
info.b = &dyn;
Curl_dyn_init(info.b, DYN_APRINTF);
info.fail = 0;
- retcode = dprintf_formatf(&info, alloc_addbyter, format, ap_save);
- if((-1 == retcode) || info.fail) {
+ (void)dprintf_formatf(&info, alloc_addbyter, format, ap_save);
+ if(info.fail) {
Curl_dyn_free(info.b);
return NULL;
}
DEBUGASSERT(!strchr(fmt, '\n'));
if(data && data->set.verbose) {
va_list ap;
- size_t len;
+ int len;
char buffer[MAXINFO + 2];
va_start(ap, fmt);
len = mvsnprintf(buffer, MAXINFO, fmt, ap);
DEBUGASSERT(!strchr(fmt, '\n'));
if(data->set.verbose || data->set.errorbuffer) {
va_list ap;
- size_t len;
+ int len;
char error[CURL_ERROR_SIZE + 2];
va_start(ap, fmt);
len = mvsnprintf(error, CURL_ERROR_SIZE, fmt, ap);
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, /* 10 11 */
0, 1, 2, 3, 4, 5, 6, 7, 8); /* 9 */
- if(rc != -1) {
- printf("curl_mprintf() returned %d and not -1!\n", rc);
+ if(rc) {
+ printf("curl_mprintf() returned %d and not 0\n", rc);
errors++;
}