From 8adfa4e3b45be2de44825b62beb8fe4ef1dbfab4 Mon Sep 17 00:00:00 2001 From: Chris Richardson Date: Mon, 12 Jan 2015 17:07:41 +0000 Subject: [PATCH 1/3] issue-4 Fixed incorrect link order causing build failure --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 8ad3de2..dd54890 100644 --- a/Makefile +++ b/Makefile @@ -19,7 +19,7 @@ ifeq ($(MYSQL),YES) OPT_FILES += ucsqlite.o endif -example : libuc.a example.o +example : example.o libuc.a $(LINKXX) -o $@ $^ From aa16a9df6f95ba1e85f173303a6f9a0964b641de Mon Sep 17 00:00:00 2001 From: Chris Richardson Date: Mon, 12 Jan 2015 16:58:43 +0000 Subject: [PATCH 2/3] issue-2 Fixed missing cstring include --- buffer_curl.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/buffer_curl.cpp b/buffer_curl.cpp index 925ac59..43e79a8 100644 --- a/buffer_curl.cpp +++ b/buffer_curl.cpp @@ -9,8 +9,9 @@ /* Routines to use Buffers with curl. */ -#include #include "buffer.h" +#include +#include namespace JAD { From d8c5ad2fd6c051f8ac360fb56ae7859bd57d7458 Mon Sep 17 00:00:00 2001 From: Chris Richardson Date: Mon, 12 Jan 2015 23:04:20 +0000 Subject: [PATCH 3/3] issue-6 Map type is mistaken for array type --- ucontainer.cpp | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/ucontainer.cpp b/ucontainer.cpp index fbcd7f3..818797e 100644 --- a/ucontainer.cpp +++ b/ucontainer.cpp @@ -7,6 +7,8 @@ * http://www.greatpanic.com/code.html */ +#include +#include #include #include #include @@ -310,9 +312,19 @@ namespace JAD { if (type == uc_Map) ismap = true; else { errno = 0; - idx = strtol(piece1.c_str(),NULL,10); - if (errno) ismap = true; - else ismap = false; + char* ptr = NULL; + idx = strtol(piece1.c_str(), &ptr, 10); + if (errno == 0 && idx == 0) { + // This could have been a completely non-numeric string, or could have been a string representation of zero + // Find first non-whitespace char of piece1 + std::string::iterator it_first_nonspace = std::find_if(piece1.begin(), piece1.end(), std::not1(std::ptr_fun(std::isspace))); + // e.g. number of blank characters to skip + size_t chars_to_skip = it_first_nonspace - piece1.begin(); + + // If the start of the numeric string is the start of non-whitespace, there wasn't an array index at all (which means this is a map) + ismap = ptr == piece1.c_str() + chars_to_skip; + } else + ismap = false; } if (ismap) {