fix linux build

This commit is contained in:
Alex Fabijanic
2017-09-27 13:03:29 -05:00
parent 1054c46f6c
commit fab661a4a3
5 changed files with 20 additions and 4 deletions

View File

@@ -13,7 +13,7 @@ objects = ArchiveStrategy Ascii ASCIIEncoding AsyncChannel \
Debugger DeflatingStream DigestEngine DigestStream DirectoryIterator DirectoryWatcher \ Debugger DeflatingStream DigestEngine DigestStream DirectoryIterator DirectoryWatcher \
Environment Event EventChannel Error EventArgs ErrorHandler Exception FIFOBufferStream FPEnvironment File \ Environment Event EventChannel Error EventArgs ErrorHandler Exception FIFOBufferStream FPEnvironment File \
FileChannel Formatter FormattingChannel Glob HexBinaryDecoder LineEndingConverter \ FileChannel Formatter FormattingChannel Glob HexBinaryDecoder LineEndingConverter \
HexBinaryEncoder InflatingStream Latin1Encoding Latin2Encoding Latin9Encoding LogFile \ HexBinaryEncoder InflatingStream JSONString Latin1Encoding Latin2Encoding Latin9Encoding LogFile \
Logger LoggingFactory LoggingRegistry LogStream NamedEvent NamedMutex NullChannel \ Logger LoggingFactory LoggingRegistry LogStream NamedEvent NamedMutex NullChannel \
MemoryPool MD4Engine MD5Engine Manifest Message Mutex \ MemoryPool MD4Engine MD5Engine Manifest Message Mutex \
NestedDiagnosticContext Notification NotificationCenter \ NestedDiagnosticContext Notification NotificationCenter \

View File

@@ -3,6 +3,10 @@
#include <stdio.h> #include <stdio.h>
#if defined(__cplusplus) && !defined(POCO_OS_FAMILY_WINDOWS)
extern "C" {
#endif
enum json_type { enum json_type {
JSON_ERROR = 1, JSON_DONE, JSON_ERROR = 1, JSON_DONE,
JSON_OBJECT, JSON_OBJECT_END, JSON_ARRAY, JSON_ARRAY_END, JSON_OBJECT, JSON_OBJECT_END, JSON_ARRAY, JSON_ARRAY_END,
@@ -39,4 +43,8 @@ size_t json_get_position(json_stream *json);
size_t json_get_depth(json_stream *json); size_t json_get_depth(json_stream *json);
const char *json_get_error(json_stream *json); const char *json_get_error(json_stream *json);
#if defined(__cplusplus) && !defined(POCO_OS_FAMILY_WINDOWS)
}
#endif
#endif #endif

View File

@@ -6,6 +6,10 @@
#endif // __STDC_VERSION__ #endif // __STDC_VERSION__
#include <stdio.h> #include <stdio.h>
#if defined(__cplusplus) && !defined(POCO_OS_FAMILY_WINDOWS)
extern "C" {
#endif
struct json_source { struct json_source {
int (*get) (struct json_source *); int (*get) (struct json_source *);
int (*peek) (struct json_source *); int (*peek) (struct json_source *);
@@ -49,4 +53,8 @@ struct json_stream {
char errmsg[128]; char errmsg[128];
}; };
#if defined(__cplusplus) && !defined(POCO_OS_FAMILY_WINDOWS)
}
#endif
#endif #endif

View File

@@ -109,7 +109,7 @@ static void init(json_stream *json)
json->error = 0; json->error = 0;
json->errmsg[0] = '\0'; json->errmsg[0] = '\0';
json->ntokens = 0; json->ntokens = 0;
json->next = (json_type) 0; json->next = (enum json_type) 0;
json->streaming = true; json->streaming = true;
json->stack = NULL; json->stack = NULL;
@@ -654,7 +654,7 @@ enum json_type json_next(json_stream *json)
return JSON_ERROR; return JSON_ERROR;
if (json->next != 0) { if (json->next != 0) {
enum json_type next = json->next; enum json_type next = json->next;
json->next = (json_type) 0; json->next = (enum json_type) 0;
return next; return next;
} }
if (json->ntokens > 0 && json->stack_top == (size_t)-1) { if (json->ntokens > 0 && json->stack_top == (size_t)-1) {

View File

@@ -1083,7 +1083,7 @@ void JSONTest::testSetArrayElement()
assert(dynArray[1] == 13); assert(dynArray[1] == 13);
assert(dynArray[2] == "foo"); assert(dynArray[2] == "foo");
#endif POCO_ENABLE_CPP11 #endif // POCO_ENABLE_CPP11
dynArray.clear(); dynArray.clear();
assert(dynArray.size() == 0); assert(dynArray.size() == 0);