From fd77bcddc140c02d330a2fc3c8b1a5fb7c5ae23e Mon Sep 17 00:00:00 2001 From: Krzysztof Gabis Date: Fri, 6 Aug 2021 15:46:45 +0200 Subject: [PATCH] 1.2.1: Not using SIZE_MAX macro (issue #167) --- CMakeLists.txt | 2 +- Makefile | 4 ++-- package.json | 2 +- parson.c | 6 +++--- parson.h | 6 +++--- tests.c | 2 +- 6 files changed, 11 insertions(+), 11 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 9368549..f0382a8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -3,7 +3,7 @@ project(parson C) include (GNUInstallDirs) -set(PARSON_VERSION 1.2.0) +set(PARSON_VERSION 1.2.1) add_library(parson parson.c) target_include_directories(parson PUBLIC $) diff --git a/Makefile b/Makefile index 14b3281..0803434 100644 --- a/Makefile +++ b/Makefile @@ -1,8 +1,8 @@ CC = gcc -CFLAGS = -O0 -g -Wall -Wextra -Wfloat-equal -std=c89 -pedantic-errors -DTESTS_MAIN +CFLAGS = -O0 -g -Wall -Wextra -std=c89 -pedantic-errors -DTESTS_MAIN CPPC = g++ -CPPFLAGS = -O0 -g -Wall -Wextra -Wfloat-equal -DTESTS_MAIN +CPPFLAGS = -O0 -g -Wall -Wextra -DTESTS_MAIN all: test testcpp test_hash_collisions diff --git a/package.json b/package.json index 0cf0fbc..589bc1c 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "parson", - "version": "1.2.0", + "version": "1.2.1", "repo": "kgabis/parson", "description": "Small json parser and reader", "keywords": [ "json", "parser" ], diff --git a/parson.c b/parson.c index 31a89f0..617ce5e 100644 --- a/parson.c +++ b/parson.c @@ -1,7 +1,7 @@ /* SPDX-License-Identifier: MIT - Parson 1.2.0 ( http://kgabis.github.com/parson/ ) + Parson 1.2.1 ( http://kgabis.github.com/parson/ ) Copyright (c) 2012 - 2021 Krzysztof Gabis Permission is hereby granted, free of charge, to any person obtaining a copy @@ -32,7 +32,7 @@ #define PARSON_IMPL_VERSION_MAJOR 1 #define PARSON_IMPL_VERSION_MINOR 2 -#define PARSON_IMPL_VERSION_PATCH 0 +#define PARSON_IMPL_VERSION_PATCH 1 #if (PARSON_VERSION_MAJOR != PARSON_IMPL_VERSION_MAJOR)\ || (PARSON_VERSION_MINOR != PARSON_IMPL_VERSION_MINOR)\ @@ -80,7 +80,7 @@ #define IS_NUMBER_INVALID(x) (((x) * 0.0) != 0.0) #endif -#define OBJECT_INVALID_IX SIZE_MAX +#define OBJECT_INVALID_IX ((size_t)-1) static JSON_Malloc_Function parson_malloc = malloc; static JSON_Free_Function parson_free = free; diff --git a/parson.h b/parson.h index 340157c..beeca4c 100644 --- a/parson.h +++ b/parson.h @@ -1,7 +1,7 @@ /* SPDX-License-Identifier: MIT - Parson 1.2.0 ( http://kgabis.github.com/parson/ ) + Parson 1.2.1 ( http://kgabis.github.com/parson/ ) Copyright (c) 2012 - 2021 Krzysztof Gabis Permission is hereby granted, free of charge, to any person obtaining a copy @@ -33,9 +33,9 @@ extern "C" #define PARSON_VERSION_MAJOR 1 #define PARSON_VERSION_MINOR 2 -#define PARSON_VERSION_PATCH 0 +#define PARSON_VERSION_PATCH 1 -#define PARSON_VERSION_STRING "1.2.0" +#define PARSON_VERSION_STRING "1.2.1" #include /* size_t */ diff --git a/tests.c b/tests.c index 10db9fb..cf05065 100644 --- a/tests.c +++ b/tests.c @@ -212,7 +212,7 @@ void test_suite_2(JSON_Value *root_value) { TEST(len == 7); TEST(memcmp(json_object_get_string(root_object, "string with null"), "abc\0def", len) == 0); - TEST(json_object_get_number(root_object, "positive one") == 1.0); + TEST(DBL_EQ(json_object_get_number(root_object, "positive one"), 1.0)); TEST(DBL_EQ(json_object_get_number(root_object, "negative one"), -1.0)); TEST(DBL_EQ(json_object_get_number(root_object, "hard to parse number"), -0.000314)); TEST(json_object_get_boolean(root_object, "boolean true") == 1);