mirror of
https://git.savannah.nongnu.org/git/lwip.git
synced 2025-08-04 21:44:38 +08: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
|
#ifndef lwip_itoa
|
||||||
void
|
void
|
||||||
lwip_itoa(int value, char* result)
|
lwip_itoa(char* result, size_t bufsize, int number)
|
||||||
{
|
{
|
||||||
const int base = 10;
|
const int base = 10;
|
||||||
char* ptr = result, *ptr1 = result, tmp_char;
|
char* ptr = result, *ptr1 = result, tmp_char;
|
||||||
int tmp_value;
|
int tmp_value;
|
||||||
|
LWIP_UNUSED_ARG(bufsize);
|
||||||
|
|
||||||
do {
|
do {
|
||||||
tmp_value = value;
|
tmp_value = number;
|
||||||
value /= base;
|
number /= base;
|
||||||
*ptr++ = "zyxwvutsrqponmlkjihgfedcba9876543210123456789abcdefghijklmnopqrstuvwxyz"[35 + (tmp_value - value * base)];
|
*ptr++ = "zyxwvutsrqponmlkjihgfedcba9876543210123456789abcdefghijklmnopqrstuvwxyz"[35 + (tmp_value - number * base)];
|
||||||
} while(value);
|
} while(number);
|
||||||
|
|
||||||
/* Apply negative sign */
|
/* Apply negative sign */
|
||||||
if (tmp_value < 0) {
|
if (tmp_value < 0) {
|
||||||
|
@ -139,7 +139,7 @@ u32_t lwip_ntohl(u32_t x);
|
|||||||
* in your application, too.
|
* in your application, too.
|
||||||
*/
|
*/
|
||||||
#ifndef lwip_itoa
|
#ifndef lwip_itoa
|
||||||
void lwip_itoa(int value, char* result);
|
void lwip_itoa(char* result, size_t bufsize, int number);
|
||||||
#endif
|
#endif
|
||||||
#ifndef lwip_strnicmp
|
#ifndef lwip_strnicmp
|
||||||
int lwip_strnicmp(const char* str1, const char* str2, size_t len);
|
int lwip_strnicmp(const char* str1, const char* str2, size_t len);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user