Update POCO library.

This commit is contained in:
Sandu Liviu Catalin committed 2023-03-23 20:19:11 +02:00
1 parent 8d15f4b6e9
commit 233fc103f9
2521 files changed
+257092 -72789

No files matched your search

-2
View File
@@ -61,7 +61,6 @@ void ParseHandler::startObject()
}
else if (parent.type() == typeid(Object::Ptr))
{
poco_assert_dbg(!_key.empty());
Object::Ptr obj = parent.extract<Object::Ptr>();
obj->set(_key, newObj);
_key.clear();
@@ -97,7 +96,6 @@ void ParseHandler::startArray()
}
else if (parent.type() == typeid(Object::Ptr))
{
poco_assert_dbg(!_key.empty());
Object::Ptr obj = parent.extract<Object::Ptr>();
obj->set(_key, newArr);
_key.clear();
+5 -5
View File
@@ -71,7 +71,7 @@ bool PrintHandler::printFlat() const
unsigned PrintHandler::indent()
{
if (!printFlat()) return _indent;
return 0;
}
@@ -119,9 +119,9 @@ void PrintHandler::endArray()
void PrintHandler::key(const std::string& k)
{
if (!_objStart) comma();
_objStart = true;
_out << _tab;
Stringifier::formatString(k, _out, _options);
if (!printFlat()) _out << ' ';
@@ -191,7 +191,7 @@ void PrintHandler::value(double d)
void PrintHandler::value(bool b)
{
arrayValue();
_out << b;
_out << (b ? "true" : "false");
_objStart = false;
}
@@ -205,7 +205,7 @@ void PrintHandler::comma()
void PrintHandler::arrayValue()
{
if (!_objStart) comma();
if (array())
if (array())
{
_out << _tab;
}
+8 -4
View File
@@ -65,7 +65,7 @@ Object& Query::findObject(const std::string& path, Object& obj) const
obj = *result.extract<Object::Ptr>();
else if (result.type() == typeid(Object))
obj = result.extract<Object>();
return obj;
}
@@ -93,7 +93,7 @@ Array& Query::findArray(const std::string& path, Array& arr) const
arr = *result.extract<Array::Ptr>();
else if (result.type() == typeid(Array))
arr = result.extract<Array>();
return arr;
}
@@ -101,6 +101,8 @@ Array& Query::findArray(const std::string& path, Array& arr) const
Var Query::find(const std::string& path) const
{
Var result = _source;
if (path.empty()) return result;
bool found = false;
StringTokenizer tokenizer(path, ".");
for (const auto& token: tokenizer)
{
@@ -134,14 +136,15 @@ Var Query::find(const std::string& path) const
{
Object::Ptr o = result.extract<Object::Ptr>();
result = o->get(name);
found = true;
}
else if (result.type() == typeid(Object))
{
Object o = result.extract<Object>();
result = o.get(name);
found = true;
}
else
result.empty();
else result.empty();
}
@@ -165,6 +168,7 @@ Var Query::find(const std::string& path) const
}
}
}
if (!found) result.empty();
return result;
}
+2
View File
@@ -62,6 +62,8 @@ void Stringifier::stringify(const Var& any, std::ostream& out, unsigned int inde
else if (any.isNumeric() || any.isBoolean())
{
std::string value = any.convert<std::string>();
if ((Poco::icompare(value, "nan") == 0) ||
(Poco::icompare(value, "inf") == 0)) value = "null";
if (any.type() == typeid(char)) formatString(value, out, options);
else out << value;
}
+6 -6
View File
@@ -303,8 +303,8 @@ class IncludePart: public Part
{
public:
IncludePart(const Path& parentPath, const Path& path):
Part(),
IncludePart(const Path& parentPath, const Path& path):
Part(),
_path(path)
{
// When the path is relative, try to make it absolute based
@@ -347,16 +347,16 @@ private:
};
Template::Template(const Path& templatePath):
_parts(0),
_currentPart(0),
Template::Template(const Path& templatePath):
_parts(0),
_currentPart(0),
_templatePath(templatePath)
{
}
Template::Template():
_parts(0),
_parts(0),
_currentPart(0)
{
}
+2 -2
View File
@@ -51,12 +51,12 @@ Template::Ptr TemplateCache::getTemplate(const Path& path)
Path templatePath = resolvePath(path);
std::string templatePathname = templatePath.toString();
if (_pLogger)
{
poco_trace_f1(*_pLogger, "Path resolved to %s", templatePathname);
}
File templateFile(templatePathname);
Template::Ptr tpl;
+1 -1
View File
@@ -555,7 +555,7 @@ read_number(json_stream *json, int c)
json_error(json, "unexpected byte '%c' in number", c);
return JSON_ERROR;
}
} else if (strchr("123456789", c) != NULL) {
} else if (c >= '1' && c <= '9') {
c = json->source.peek(&json->source);
if (is_digit(c)) {
if (read_digits(json) != 0)
+9 -9
View File
@@ -9,12 +9,12 @@
extern "C" {
#else
#if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L)
#include <stdbool.h>
#else
#ifndef bool
#define bool int
#define true 1
#define false 0
#include <stdbool.h>
#else
#ifndef bool
#define bool int
#define true 1
#define false 0
#endif /* bool */
#endif /* __STDC_VERSION__ */
#endif /* __cplusplus */
@@ -33,7 +33,7 @@ struct json_allocator {
void (*free)(void *);
};
typedef int (*json_user_io) (void *user);
typedef int (*json_user_io)(void *user);
typedef struct json_stream json_stream;
typedef struct json_allocator json_allocator;
@@ -69,8 +69,8 @@ PDJSON_SYMEXPORT bool json_isspace(int c);
/* internal */
struct json_source {
int (*get) (struct json_source *);
int (*peek) (struct json_source *);
int (*get)(struct json_source *);
int (*peek)(struct json_source *);
size_t position;
union {
struct {