tiny-json.c(84): warning C4204: Nicht dem Standard entsprechende Erweiterung: Initialisierung für zusammengesetzten Typ ist keine Konstante

tiny-json.c(296): warning C4244: "Initialisierung": Konvertierung von "__int64" in "const unsigned int", möglicher Datenverlust
This commit is contained in:
Jesko (Cetus) 2020-03-28 19:35:44 +01:00
parent 1fe46ee557
commit 68f36c736f

View File

@ -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;