Merge pull request #8 from jesko42/fix_vs_warnings

Fix vs warnings
This commit is contained in:
Rafa García 2020-04-17 23:03:00 +02:00 committed by GitHub
commit 1c62646c71
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -33,8 +33,8 @@
/** Structure to handle a heap of JSON properties. */ /** Structure to handle a heap of JSON properties. */
typedef struct jsonStaticPool_s { typedef struct jsonStaticPool_s {
json_t* const mem; /**< Pointer to array of json properties. */ json_t* mem; /**< Pointer to array of json properties. */
unsigned int const qty; /**< Length of the array of json properties. */ unsigned int qty; /**< Length of the array of json properties. */
unsigned int nextFree; /**< The index of the next free json property. */ unsigned int nextFree; /**< The index of the next free json property. */
jsonPool_t pool; jsonPool_t pool;
} jsonStaticPool_t; } jsonStaticPool_t;
@ -81,14 +81,11 @@ json_t const* json_createWithPool( char *str, jsonPool_t *pool ) {
/* Parse a string to get a json. */ /* Parse a string to get a json. */
json_t const* json_create( char* str, json_t mem[], unsigned int qty ) { json_t const* json_create( char* str, json_t mem[], unsigned int qty ) {
jsonStaticPool_t spool = { jsonStaticPool_t spool;
.mem = mem, spool.mem = mem;
.qty = qty, spool.qty = qty;
.pool = { spool.pool.init = poolInit;
.init = poolInit, spool.pool.alloc = poolAlloc;
.alloc = poolAlloc
}
};
return json_createWithPool( str, &spool.pool ); return json_createWithPool( str, &spool.pool );
} }
@ -293,7 +290,7 @@ static char* numValue( char* ptr, json_t* property ) {
static char const min[] = "-9223372036854775808"; static char const min[] = "-9223372036854775808";
static char const max[] = "9223372036854775807"; static char const max[] = "9223372036854775807";
unsigned int const maxdigits = ( negative? sizeof min: sizeof max ) - 1; unsigned int const maxdigits = ( negative? sizeof min: sizeof max ) - 1;
unsigned int const len = ptr - value; unsigned int const len = ( unsigned int const ) ( ptr - value );
if ( len > maxdigits ) return 0; if ( len > maxdigits ) return 0;
if ( len == maxdigits ) { if ( len == maxdigits ) {
char const tmp = *ptr; char const tmp = *ptr;