Mercurial > hg > octave-lojdl > gnulib-hg
comparison lib/vasnprintf.c @ 12306:5e0e6e795550
vasnprintf: avoid compiler warnings
* lib/vasnprintf.c (VASNPRINTF): Avoid shadowing our own local
variables.
* lib/printf-args.c (PRINTF_FETCHARGS): Avoid type mismatch.
Signed-off-by: Eric Blake <ebb9@byu.net>
author | Eric Blake <ebb9@byu.net> |
---|---|
date | Fri, 30 Oct 2009 10:24:45 -0600 |
parents | 8b0d11ca9d01 |
children | 9f98da6e2275 |
comparison
equal
deleted
inserted
replaced
12305:2f51d61a26ea | 12306:5e0e6e795550 |
---|---|
2373 # endif | 2373 # endif |
2374 arg_end = arg; | 2374 arg_end = arg; |
2375 characters = 0; | 2375 characters = 0; |
2376 while (precision > 0) | 2376 while (precision > 0) |
2377 { | 2377 { |
2378 char buf[64]; /* Assume MB_CUR_MAX <= 64. */ | 2378 char cbuf[64]; /* Assume MB_CUR_MAX <= 64. */ |
2379 int count; | 2379 int count; |
2380 | 2380 |
2381 if (*arg_end == 0) | 2381 if (*arg_end == 0) |
2382 /* Found the terminating null wide character. */ | 2382 /* Found the terminating null wide character. */ |
2383 break; | 2383 break; |
2384 # if HAVE_WCRTOMB | 2384 # if HAVE_WCRTOMB |
2385 count = wcrtomb (buf, *arg_end, &state); | 2385 count = wcrtomb (cbuf, *arg_end, &state); |
2386 # else | 2386 # else |
2387 count = wctomb (buf, *arg_end); | 2387 count = wctomb (cbuf, *arg_end); |
2388 # endif | 2388 # endif |
2389 if (count < 0) | 2389 if (count < 0) |
2390 { | 2390 { |
2391 /* Cannot convert. */ | 2391 /* Cannot convert. */ |
2392 if (!(result == resultbuf || result == NULL)) | 2392 if (!(result == resultbuf || result == NULL)) |
2418 # endif | 2418 # endif |
2419 arg_end = arg; | 2419 arg_end = arg; |
2420 characters = 0; | 2420 characters = 0; |
2421 for (;;) | 2421 for (;;) |
2422 { | 2422 { |
2423 char buf[64]; /* Assume MB_CUR_MAX <= 64. */ | 2423 char cbuf[64]; /* Assume MB_CUR_MAX <= 64. */ |
2424 int count; | 2424 int count; |
2425 | 2425 |
2426 if (*arg_end == 0) | 2426 if (*arg_end == 0) |
2427 /* Found the terminating null wide character. */ | 2427 /* Found the terminating null wide character. */ |
2428 break; | 2428 break; |
2429 # if HAVE_WCRTOMB | 2429 # if HAVE_WCRTOMB |
2430 count = wcrtomb (buf, *arg_end, &state); | 2430 count = wcrtomb (cbuf, *arg_end, &state); |
2431 # else | 2431 # else |
2432 count = wctomb (buf, *arg_end); | 2432 count = wctomb (cbuf, *arg_end); |
2433 # endif | 2433 # endif |
2434 if (count < 0) | 2434 if (count < 0) |
2435 { | 2435 { |
2436 /* Cannot convert. */ | 2436 /* Cannot convert. */ |
2437 if (!(result == resultbuf || result == NULL)) | 2437 if (!(result == resultbuf || result == NULL)) |
2468 mbstate_t state; | 2468 mbstate_t state; |
2469 memset (&state, '\0', sizeof (mbstate_t)); | 2469 memset (&state, '\0', sizeof (mbstate_t)); |
2470 # endif | 2470 # endif |
2471 for (remaining = characters; remaining > 0; ) | 2471 for (remaining = characters; remaining > 0; ) |
2472 { | 2472 { |
2473 char buf[64]; /* Assume MB_CUR_MAX <= 64. */ | 2473 char cbuf[64]; /* Assume MB_CUR_MAX <= 64. */ |
2474 int count; | 2474 int count; |
2475 | 2475 |
2476 if (*arg == 0) | 2476 if (*arg == 0) |
2477 abort (); | 2477 abort (); |
2478 # if HAVE_WCRTOMB | 2478 # if HAVE_WCRTOMB |
2479 count = wcrtomb (buf, *arg, &state); | 2479 count = wcrtomb (cbuf, *arg, &state); |
2480 # else | 2480 # else |
2481 count = wctomb (buf, *arg); | 2481 count = wctomb (cbuf, *arg); |
2482 # endif | 2482 # endif |
2483 if (count <= 0) | 2483 if (count <= 0) |
2484 /* Inconsistency. */ | 2484 /* Inconsistency. */ |
2485 abort (); | 2485 abort (); |
2486 memcpy (tmpptr, buf, count); | 2486 memcpy (tmpptr, cbuf, count); |
2487 tmpptr += count; | 2487 tmpptr += count; |
2488 arg++; | 2488 arg++; |
2489 remaining -= count; | 2489 remaining -= count; |
2490 } | 2490 } |
2491 if (!(arg == arg_end)) | 2491 if (!(arg == arg_end)) |
2550 memset (&state, '\0', sizeof (mbstate_t)); | 2550 memset (&state, '\0', sizeof (mbstate_t)); |
2551 # endif | 2551 # endif |
2552 ENSURE_ALLOCATION (xsum (length, characters)); | 2552 ENSURE_ALLOCATION (xsum (length, characters)); |
2553 for (remaining = characters; remaining > 0; ) | 2553 for (remaining = characters; remaining > 0; ) |
2554 { | 2554 { |
2555 char buf[64]; /* Assume MB_CUR_MAX <= 64. */ | 2555 char cbuf[64]; /* Assume MB_CUR_MAX <= 64. */ |
2556 int count; | 2556 int count; |
2557 | 2557 |
2558 if (*arg == 0) | 2558 if (*arg == 0) |
2559 abort (); | 2559 abort (); |
2560 # if HAVE_WCRTOMB | 2560 # if HAVE_WCRTOMB |
2561 count = wcrtomb (buf, *arg, &state); | 2561 count = wcrtomb (cbuf, *arg, &state); |
2562 # else | 2562 # else |
2563 count = wctomb (buf, *arg); | 2563 count = wctomb (cbuf, *arg); |
2564 # endif | 2564 # endif |
2565 if (count <= 0) | 2565 if (count <= 0) |
2566 /* Inconsistency. */ | 2566 /* Inconsistency. */ |
2567 abort (); | 2567 abort (); |
2568 memcpy (result + length, buf, count); | 2568 memcpy (result + length, cbuf, count); |
2569 length += count; | 2569 length += count; |
2570 arg++; | 2570 arg++; |
2571 remaining -= count; | 2571 remaining -= count; |
2572 } | 2572 } |
2573 if (!(arg == arg_end)) | 2573 if (!(arg == arg_end)) |
2579 mbstate_t state; | 2579 mbstate_t state; |
2580 memset (&state, '\0', sizeof (mbstate_t)); | 2580 memset (&state, '\0', sizeof (mbstate_t)); |
2581 # endif | 2581 # endif |
2582 while (arg < arg_end) | 2582 while (arg < arg_end) |
2583 { | 2583 { |
2584 char buf[64]; /* Assume MB_CUR_MAX <= 64. */ | 2584 char cbuf[64]; /* Assume MB_CUR_MAX <= 64. */ |
2585 int count; | 2585 int count; |
2586 | 2586 |
2587 if (*arg == 0) | 2587 if (*arg == 0) |
2588 abort (); | 2588 abort (); |
2589 # if HAVE_WCRTOMB | 2589 # if HAVE_WCRTOMB |
2590 count = wcrtomb (buf, *arg, &state); | 2590 count = wcrtomb (cbuf, *arg, &state); |
2591 # else | 2591 # else |
2592 count = wctomb (buf, *arg); | 2592 count = wctomb (cbuf, *arg); |
2593 # endif | 2593 # endif |
2594 if (count <= 0) | 2594 if (count <= 0) |
2595 /* Inconsistency. */ | 2595 /* Inconsistency. */ |
2596 abort (); | 2596 abort (); |
2597 ENSURE_ALLOCATION (xsum (length, count)); | 2597 ENSURE_ALLOCATION (xsum (length, count)); |
2598 memcpy (result + length, buf, count); | 2598 memcpy (result + length, cbuf, count); |
2599 length += count; | 2599 length += count; |
2600 arg++; | 2600 arg++; |
2601 } | 2601 } |
2602 } | 2602 } |
2603 # else | 2603 # else |