Merge pull request #8 from jesko42/fix_vs_warnings

Fix vs warnings
pull/9/head
Rafa García 4 years ago committed by GitHub
commit 1c62646c71
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 19
      tiny-json.c

@ -33,8 +33,8 @@
/** Structure to handle a heap of JSON properties. */
typedef struct jsonStaticPool_s {
json_t* const mem; /**< Pointer to array of json properties. */
unsigned int const qty; /**< Length of the array of json properties. */
json_t* mem; /**< Pointer to 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. */
jsonPool_t pool;
} jsonStaticPool_t;
@ -81,14 +81,11 @@ json_t const* json_createWithPool( char *str, jsonPool_t *pool ) {
/* Parse a string to get a json. */
json_t const* json_create( char* str, json_t mem[], unsigned int qty ) {
jsonStaticPool_t spool = {
.mem = mem,
.qty = qty,
.pool = {
.init = poolInit,
.alloc = poolAlloc
}
};
jsonStaticPool_t spool;
spool.mem = mem;
spool.qty = qty;
spool.pool.init = poolInit;
spool.pool.alloc = poolAlloc;
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 max[] = "9223372036854775807";
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 ) {
char const tmp = *ptr;

Loading…
Cancel
Save