mirror of
https://github.com/zeek/zeek.git
synced 2025-10-02 06:38:20 +00:00
src/3rdparty: Fix rampant off-by-one error in last change
This commit is contained in:
parent
790e920d66
commit
ce75863344
1 changed files with 7 additions and 7 deletions
14
src/3rdparty/modp_numtoa.c
vendored
14
src/3rdparty/modp_numtoa.c
vendored
|
@ -116,7 +116,7 @@ size_t modp_itoa10(int32_t value, char* str)
|
||||||
|
|
||||||
// Reverse string
|
// Reverse string
|
||||||
strreverse(str,wstr-1);
|
strreverse(str,wstr-1);
|
||||||
return wstr - str - 1;
|
return wstr - str;
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t modp_uitoa10(uint32_t value, char* str)
|
size_t modp_uitoa10(uint32_t value, char* str)
|
||||||
|
@ -127,7 +127,7 @@ size_t modp_uitoa10(uint32_t value, char* str)
|
||||||
*wstr='\0';
|
*wstr='\0';
|
||||||
// Reverse string
|
// Reverse string
|
||||||
strreverse(str, wstr-1);
|
strreverse(str, wstr-1);
|
||||||
return wstr - str - 1;
|
return wstr - str;
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t modp_litoa10(int64_t value, char* str)
|
size_t modp_litoa10(int64_t value, char* str)
|
||||||
|
@ -142,7 +142,7 @@ size_t modp_litoa10(int64_t value, char* str)
|
||||||
|
|
||||||
// Reverse string
|
// Reverse string
|
||||||
strreverse(str,wstr-1);
|
strreverse(str,wstr-1);
|
||||||
return wstr - str - 1;
|
return wstr - str;
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t modp_ulitoa10(uint64_t value, char* str)
|
size_t modp_ulitoa10(uint64_t value, char* str)
|
||||||
|
@ -153,7 +153,7 @@ size_t modp_ulitoa10(uint64_t value, char* str)
|
||||||
*wstr='\0';
|
*wstr='\0';
|
||||||
// Reverse string
|
// Reverse string
|
||||||
strreverse(str, wstr-1);
|
strreverse(str, wstr-1);
|
||||||
return wstr - str - 1;
|
return wstr - str;
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t modp_dtoa(double value, char* str, int prec)
|
size_t modp_dtoa(double value, char* str, int prec)
|
||||||
|
@ -251,7 +251,7 @@ size_t modp_dtoa(double value, char* str, int prec)
|
||||||
}
|
}
|
||||||
*wstr='\0';
|
*wstr='\0';
|
||||||
strreverse(str, wstr-1);
|
strreverse(str, wstr-1);
|
||||||
return wstr - str - 1;
|
return wstr - str;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -372,7 +372,7 @@ size_t modp_dtoa2(double value, char* str, int prec)
|
||||||
}
|
}
|
||||||
*wstr='\0';
|
*wstr='\0';
|
||||||
strreverse(str, wstr-1);
|
strreverse(str, wstr-1);
|
||||||
return wstr - str - 1;
|
return wstr - str;
|
||||||
}
|
}
|
||||||
|
|
||||||
// This is near identical to modp_dtoa2 above, excep that it never uses
|
// This is near identical to modp_dtoa2 above, excep that it never uses
|
||||||
|
@ -502,5 +502,5 @@ size_t modp_dtoa3(double value, char* str, int n, int prec)
|
||||||
}
|
}
|
||||||
*wstr='\0';
|
*wstr='\0';
|
||||||
strreverse(str, wstr-1);
|
strreverse(str, wstr-1);
|
||||||
return wstr - str - 1;
|
return wstr - str;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue