Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ ifeq ($(MYSQL),YES)
OPT_FILES += ucsqlite.o
endif

example : libuc.a example.o
example : example.o libuc.a
$(LINKXX) -o $@ $^


Expand Down
3 changes: 2 additions & 1 deletion buffer_curl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,9 @@

/* Routines to use Buffers with curl. */

#include <curl/curl.h>
#include "buffer.h"
#include <curl/curl.h>
#include <cstring>

namespace JAD {

Expand Down
18 changes: 15 additions & 3 deletions ucontainer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
* http://www.greatpanic.com/code.html
*/

#include <algorithm>
#include <functional>
#include <iostream>
#include <cstring>
#include <cctype>
Expand Down Expand Up @@ -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<int, int>(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) {
Expand Down