mirror of
https://github.com/lwip-tcpip/lwip.git
synced 2025-01-30 12:32:37 +00:00
Fix implementation of lwip_itoa to take more parameters
This commit is contained in:
parent
837b7b3f98
commit
4144d54642
@ -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) {
|
||||
|
@ -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);
|
||||
|
Loading…
x
Reference in New Issue
Block a user