From 4144d546420212d0fbfd8d6179f71724d97104fc Mon Sep 17 00:00:00 2001 From: Dirk Ziegelmeier Date: Wed, 28 Sep 2016 22:05:18 +0200 Subject: [PATCH] Fix implementation of lwip_itoa to take more parameters --- src/core/def.c | 11 ++++++----- src/include/lwip/def.h | 2 +- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/core/def.c b/src/core/def.c index 7d91a3b1..05785486 100644 --- a/src/core/def.c +++ b/src/core/def.c @@ -183,17 +183,18 @@ lwip_strnicmp(const char* str1, const char* str2, size_t len) #ifndef lwip_itoa void -lwip_itoa(int value, char* result) +lwip_itoa(char* result, size_t bufsize, int number) { const int base = 10; char* ptr = result, *ptr1 = result, tmp_char; int tmp_value; + LWIP_UNUSED_ARG(bufsize); do { - tmp_value = value; - value /= base; - *ptr++ = "zyxwvutsrqponmlkjihgfedcba9876543210123456789abcdefghijklmnopqrstuvwxyz"[35 + (tmp_value - value * base)]; - } while(value); + tmp_value = number; + number /= base; + *ptr++ = "zyxwvutsrqponmlkjihgfedcba9876543210123456789abcdefghijklmnopqrstuvwxyz"[35 + (tmp_value - number * base)]; + } while(number); /* Apply negative sign */ if (tmp_value < 0) { diff --git a/src/include/lwip/def.h b/src/include/lwip/def.h index 7b431b6f..95d2d70c 100644 --- a/src/include/lwip/def.h +++ b/src/include/lwip/def.h @@ -139,7 +139,7 @@ u32_t lwip_ntohl(u32_t x); * in your application, too. */ #ifndef lwip_itoa -void lwip_itoa(int value, char* result); +void lwip_itoa(char* result, size_t bufsize, int number); #endif #ifndef lwip_strnicmp int lwip_strnicmp(const char* str1, const char* str2, size_t len);