update warnings about differ in signedness

- tiny-json.c: In function 'parseString':
- tiny-json.c:124:13: warning: pointer targets in return differ in signedness [-Wpointer-sign]
- tiny-json.c:128:17: warning: pointer targets in passing argument 1 of 'getCharFromUnicode' differ in signedness [-Wpointer-sign]
- tiny-json.c:105:13: note: expected 'const char *' but argument is of type 'unsigned char *'
This commit is contained in:
PetersSharp 2018-05-14 02:32:02 +03:00 committed by GitHub
parent 421fbd3501
commit dc69989b99
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 4 deletions

8
README-FIX.md Normal file
View File

@ -0,0 +1,8 @@
# tiny-json update
## update warnings:
- tiny-json.c: In function 'parseString':
- tiny-json.c:124:13: warning: pointer targets in return differ in signedness [-Wpointer-sign]
- tiny-json.c:128:17: warning: pointer targets in passing argument 1 of 'getCharFromUnicode' differ in signedness [-Wpointer-sign]
- tiny-json.c:105:13: note: expected 'const char *' but argument is of type 'unsigned char *'

View File

@ -102,7 +102,7 @@ static bool isHexaDigit( unsigned char nibble ) {
* @Param str Pointer to first digit. * @Param str Pointer to first digit.
* @retval '?' If the four characters are hexadecimal digits. * @retval '?' If the four characters are hexadecimal digits.
* @retcal '\0' In other cases. */ * @retcal '\0' In other cases. */
static char getCharFromUnicode( char const* str ) { static unsigned char getCharFromUnicode( unsigned char const* str ) {
unsigned int i; unsigned int i;
for( i = 0; i < 4; ++i ) for( i = 0; i < 4; ++i )
if ( !isHexaDigit( str[i] ) ) if ( !isHexaDigit( str[i] ) )
@ -116,12 +116,12 @@ static char getCharFromUnicode( char const* str ) {
* @retval Pointer to first non white space after the string. If success. * @retval Pointer to first non white space after the string. If success.
* @retval Null pointer if any error occur. */ * @retval Null pointer if any error occur. */
static char* parseString( char* str ) { static char* parseString( char* str ) {
char* head = str; unsigned char* head = (unsigned char*)str;
char* tail = str; unsigned char* tail = (unsigned char*)str;
for( ; *head >= ' '; ++head, ++tail ) { for( ; *head >= ' '; ++head, ++tail ) {
if ( *head == '\"' ) { if ( *head == '\"' ) {
*tail = '\0'; *tail = '\0';
return ++head; return (char*)++head;
} }
if ( *head == '\\' ) { if ( *head == '\\' ) {
if ( *++head == 'u' ) { if ( *++head == 'u' ) {