Fix implementation of lwip_itoa to take more parameters

This commit is contained in:
Dirk Ziegelmeier 2016-09-28 22:05:18 +02:00
parent 837b7b3f98
commit 4144d54642
2 changed files with 7 additions and 6 deletions

View File

@ -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) {

View File

@ -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);