mirror of
https://github.com/stefanocasazza/ULib.git
synced 2025-09-28 19:05:55 +08:00
sync
This commit is contained in:
parent
0d9053e495
commit
5c1a3c49ea
9
configure
vendored
9
configure
vendored
|
@ -27216,7 +27216,7 @@ $as_echo "#define USE_LIBSSL 1" >>confdefs.h
|
|||
if test "$found_cyassl" = "yes"; then
|
||||
echo "${T_MD}CYASSL found in $ssldir${T_ME}";
|
||||
ssl_version=$(grep VERSION $ssldir/include/cyassl/openssl/opensslv.h 2>/dev/null | cut -d' ' -f3 | tr -d '\r\n');
|
||||
ULIB_LIBS="$ULIB_LIBS -lcyassl";
|
||||
ULIB_LIBS="-lcyassl $ULIB_LIBS";
|
||||
else
|
||||
echo "${T_MD}libssl found in $ssldir${T_ME}";
|
||||
if test -f "$ssldir/include/openssl/ts.h"; then
|
||||
|
@ -27226,9 +27226,12 @@ $as_echo "#define HAVE_SSL_TS 1" >>confdefs.h
|
|||
|
||||
fi
|
||||
ssl_version=$($ssldir/bin/openssl version 2>/dev/null)
|
||||
if test -z "${ssl_version}"-a -z "$CROSS_ENVIRONMENT" -a x_$PKG_CONFIG != x_no; then
|
||||
if test -z "${ssl_version}" -a -z "$CROSS_ENVIRONMENT" -a x_$PKG_CONFIG != x_no; then
|
||||
ssl_version=$(pkg-config --modversion openssl 2>/dev/null)
|
||||
fi
|
||||
if test -z "${ssl_version}"; then
|
||||
ssl_version=$(grep OPENSSL_VERSION_TEXT $ssldir/include/openssl/opensslv.h 2>/dev/null | grep -v fips | head -1 | cut -d'"' -f2);
|
||||
fi
|
||||
if test -z "$OPENSSL_LINK"; then
|
||||
ULIB_LIBS="-lssl -lcrypto $ULIB_LIBS";
|
||||
else
|
||||
|
@ -32033,7 +32036,7 @@ $as_echo "$ulib_cc_flag" >&6; }
|
|||
## ----------------------------------------------------------------------------------------------------------------------------------
|
||||
MAYBE_FLAGS="$MAYBE_FLAGS -fno-stack-protector -fno-stack-protector-all -ffast-math -ftree-vectorize -fno-crossjumping -fno-gcse -Ofast" ## -ffunction-sections -fdata-sections
|
||||
|
||||
if test "$use_distcc" != "yes"; then
|
||||
if test "$use_distcc" != "yes" -a "$cross_compiling" != "yes"; then
|
||||
MAYBE_FLAGS="$MAYBE_FLAGS -flto -ffat-lto-objects -fuse-linker-plugin -march=native -mtune=native" # NB: distcc don't work with this...
|
||||
fi
|
||||
fi
|
||||
|
|
|
@ -2298,7 +2298,7 @@ if test "$ac_cv_c_compiler_gnu" = "yes" -a "x$GCC_IS_CLANG" = xno -a "x$OPERATIN
|
|||
## ----------------------------------------------------------------------------------------------------------------------------------
|
||||
MAYBE_FLAGS="$MAYBE_FLAGS -fno-stack-protector -fno-stack-protector-all -ffast-math -ftree-vectorize -fno-crossjumping -fno-gcse -Ofast" ## -ffunction-sections -fdata-sections
|
||||
|
||||
if test "$use_distcc" != "yes"; then
|
||||
if test "$use_distcc" != "yes" -a "$cross_compiling" != "yes"; then
|
||||
MAYBE_FLAGS="$MAYBE_FLAGS -flto -ffat-lto-objects -fuse-linker-plugin -march=native -mtune=native" # NB: distcc don't work with this...
|
||||
fi
|
||||
fi
|
||||
|
|
|
@ -8,7 +8,6 @@
|
|||
#include <ulib/tokenizer.h>
|
||||
#include <ulib/file_config.h>
|
||||
#include <ulib/utility/services.h>
|
||||
#include <ulib/container/vector.h>
|
||||
|
||||
#include "posting.h"
|
||||
|
||||
|
|
|
@ -188,8 +188,8 @@ extern U_EXPORT void runDynamicPage_ir_web(int param);
|
|||
filename = IR_SESSION.vec[i]->filename;
|
||||
basename = UStringExt::basename(filename);
|
||||
|
||||
pathname1.snprintf(U_CONSTANT_TO_PARAM( "/doc/%.*s"), U_STRING_TO_TRACE(filename));
|
||||
pathname2.snprintf(U_CONSTANT_TO_PARAM("%w/doc/%.*s"), U_STRING_TO_TRACE(filename));
|
||||
pathname1.snprintf(U_CONSTANT_TO_PARAM( "/doc/%v"), filename.rep);
|
||||
pathname2.snprintf(U_CONSTANT_TO_PARAM("%w/doc/%v"), filename.rep);
|
||||
|
||||
doc = UFile::contentOf(pathname2);
|
||||
|
||||
|
|
|
@ -245,8 +245,8 @@ if (form_with_help) {
|
|||
filename = IR_SESSION.vec[i]->filename;
|
||||
basename = UStringExt::basename(filename);
|
||||
|
||||
pathname1.snprintf(U_CONSTANT_TO_PARAM( "/doc/%.*s"), U_STRING_TO_TRACE(filename));
|
||||
pathname2.snprintf(U_CONSTANT_TO_PARAM("%w/doc/%.*s"), U_STRING_TO_TRACE(filename));
|
||||
pathname1.snprintf(U_CONSTANT_TO_PARAM( "/doc/%v"), filename.rep);
|
||||
pathname2.snprintf(U_CONSTANT_TO_PARAM("%w/doc/%v"), filename.rep);
|
||||
|
||||
doc = UFile::contentOf(pathname2);
|
||||
|
||||
|
|
|
@ -2,8 +2,6 @@
|
|||
|
||||
#include <ulib/db/rdb.h>
|
||||
#include <ulib/base/utility.h>
|
||||
#include <ulib/container/vector.h>
|
||||
#include <ulib/container/hash_map.h>
|
||||
#include <ulib/utility/string_ext.h>
|
||||
|
||||
#include "posting.h"
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
// cdbmake.cpp
|
||||
|
||||
#include <ulib/db/cdb.h>
|
||||
#include <ulib/container/vector.h>
|
||||
#include <ulib/utility/string_ext.h>
|
||||
|
||||
#undef PACKAGE
|
||||
|
@ -28,7 +27,7 @@ public:
|
|||
|
||||
UApplication::run(argc, argv, env);
|
||||
|
||||
UString records = UFile::contentOf(argv[optind]);
|
||||
UString records = UFile::contentOf(UString(argv[optind]));
|
||||
|
||||
# ifdef U_STDCPP_ENABLE
|
||||
if (records)
|
||||
|
|
|
@ -27,7 +27,7 @@ public:
|
|||
|
||||
UApplication::run(argc, argv, env);
|
||||
|
||||
UString content = UFile::contentOf(argv[optind]);
|
||||
UString content = UFile::contentOf(UString(argv[optind]));
|
||||
|
||||
if (content)
|
||||
{
|
||||
|
|
|
@ -29,7 +29,7 @@ public:
|
|||
|
||||
UApplication::run(argc, argv, env);
|
||||
|
||||
UString content = UFile::contentOf(argv[optind]);
|
||||
UString content = UFile::contentOf(UString(argv[optind]));
|
||||
|
||||
// ........
|
||||
// 10.10.25.2 - - [21/May/2012:16:29:41 +0200] "GET /unirel_logo.gif HTTP/1.1" 200 3414 "http://www.unirel.com/" "Mozilla/5.0 (X11; Linux x86_64)"
|
||||
|
|
|
@ -43,7 +43,7 @@ public:
|
|||
|
||||
UApplication::run(argc, argv, env);
|
||||
|
||||
UString content = UFile::contentOf(argv[optind]);
|
||||
UString content = UFile::contentOf(UString(argv[optind]));
|
||||
|
||||
// ........
|
||||
// 2013/09/15 03:49:58 op: MAC_AUTH_all, uid: 60:fa:cd:7d:14:06,
|
||||
|
|
|
@ -28,8 +28,8 @@ public:
|
|||
UApplication::run(argc, argv, env);
|
||||
|
||||
UString riga;
|
||||
UString content1 = UFile::contentOf(argv[optind++]),
|
||||
content2 = UFile::contentOf(argv[optind]);
|
||||
UString content1 = UFile::contentOf(UString(argv[optind++])),
|
||||
content2 = UFile::contentOf(UString(argv[optind]));
|
||||
|
||||
UVector<UString> vec_entry(10),
|
||||
vec_ap_name(content1), // '\n'),
|
||||
|
|
|
@ -97,7 +97,7 @@ public:
|
|||
{
|
||||
UString key(argv[optind]), value(argv[++optind]);
|
||||
|
||||
if (value.equal(U_CONSTANT_TO_PARAM(U_DIR_OUTPUT U_FILE_OUTPUT))) value = UStringExt::trim(UFile::contentOf(U_DIR_OUTPUT U_FILE_OUTPUT));
|
||||
if (value.equal(U_CONSTANT_TO_PARAM(U_DIR_OUTPUT U_FILE_OUTPUT))) value = UStringExt::trim(UFile::contentOf(UString(U_DIR_OUTPUT U_FILE_OUTPUT)));
|
||||
|
||||
UApplication::exit_value = x.store(key, value, RDB_REPLACE);
|
||||
}
|
||||
|
|
|
@ -52,6 +52,7 @@ extern U_EXPORT void runDynamicPage_wi_auth(int param);
|
|||
GET_ENTRY(admin_view_using),
|
||||
GET_ENTRY(admin_view_using_historical),
|
||||
GET_ENTRY(calendar),
|
||||
GET_ENTRY(check_for_usersF),
|
||||
GET_ENTRY(error_ap),
|
||||
GET_ENTRY(fake_login_validate),
|
||||
GET_ENTRY(gen_activation),
|
||||
|
|
|
@ -30,6 +30,7 @@ static UHTTP::service_info GET_table[] = { // NB: the table must be ordered alph
|
|||
GET_ENTRY(admin_view_using),
|
||||
GET_ENTRY(admin_view_using_historical),
|
||||
GET_ENTRY(calendar),
|
||||
GET_ENTRY(check_for_usersF),
|
||||
GET_ENTRY(error_ap),
|
||||
GET_ENTRY(fake_login_validate),
|
||||
GET_ENTRY(gen_activation),
|
||||
|
|
|
@ -380,8 +380,8 @@ public:
|
|||
{
|
||||
case 1: // Firma dati: XAdES-BES
|
||||
{
|
||||
UString x = UFile::contentOf(U_X509),
|
||||
data = UFile::contentOf(U_DATA_URI);
|
||||
UString x = UFile::contentOf(UString(U_X509)),
|
||||
data = UFile::contentOf(UString(U_DATA_URI));
|
||||
|
||||
result = client->creatBES(data, U_DATA_URI, x, U_KEY_HANDLE, U_DIGEST_ALGORITHM,
|
||||
U_SIGNING_TIME, U_CLAIMED_ROLE, U_PRODUCTION_PLACE_CITY,
|
||||
|
@ -392,8 +392,8 @@ public:
|
|||
|
||||
case 2: // Firma dati: XAdES-C
|
||||
{
|
||||
UString x = UFile::contentOf(U_X509),
|
||||
data = UFile::contentOf(U_DATA_URI);
|
||||
UString x = UFile::contentOf(UString(U_X509)),
|
||||
data = UFile::contentOf(UString(U_DATA_URI));
|
||||
|
||||
result = client->creatC(data, U_DATA_URI, x, U_KEY_HANDLE, U_DIGEST_ALGORITHM,
|
||||
U_SIGNING_TIME, U_CLAIMED_ROLE, U_PRODUCTION_PLACE_CITY,
|
||||
|
@ -405,7 +405,7 @@ public:
|
|||
|
||||
case 3: // Archiviazione XAdES-C: XAdES-L
|
||||
{
|
||||
UString data = UFile::contentOf(U_DATA_URI);
|
||||
UString data = UFile::contentOf(UString(U_DATA_URI));
|
||||
|
||||
result = client->creatL(data, U_ARCHIVE_TIMESTAMP, U_SCHEMA);
|
||||
}
|
||||
|
|
|
@ -786,7 +786,7 @@ public:
|
|||
x = U_KEY_HANDLE;
|
||||
# else
|
||||
e = 0;
|
||||
x = UFile::contentOf(U_KEY_HANDLE);
|
||||
x = UFile::contentOf(UString(U_KEY_HANDLE));
|
||||
|
||||
if (x.empty() ||
|
||||
(u_pkey = UServices::loadKey(x, 0, true, 0, e)) == 0)
|
||||
|
|
|
@ -14,7 +14,6 @@
|
|||
#ifndef ULIB_DSIG_TRANSFORM_H
|
||||
#define ULIB_DSIG_TRANSFORM_H 1
|
||||
|
||||
#include <ulib/container/vector.h>
|
||||
#include <ulib/xml/libxml2/document.h>
|
||||
|
||||
#include "xpath.h"
|
||||
|
|
|
@ -255,7 +255,7 @@ DocumentClassifier::DocumentClassifier(const char* pathfile) : description(4000U
|
|||
U_TRACE(5, "DocumentClassifier::DocumentClassifier(%S)", pathfile)
|
||||
|
||||
binary = false;
|
||||
content = UFile::contentOf(pathfile);
|
||||
content = UFile::contentOf(UString(pathfile));
|
||||
|
||||
if (content.empty())
|
||||
{
|
||||
|
|
|
@ -631,7 +631,7 @@ public:
|
|||
{
|
||||
U_TRACE(5, "Application::loadDocument()")
|
||||
|
||||
*content = UFile::contentOf(filename);
|
||||
*content = UFile::contentOf(UString(filename));
|
||||
|
||||
if (content->empty())
|
||||
{
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
#include <ulib/file_config.h>
|
||||
#include <ulib/net/tcpsocket.h>
|
||||
#include <ulib/utility/services.h>
|
||||
#include <ulib/container/vector.h>
|
||||
#include <ulib/net/server/server.h>
|
||||
|
||||
#undef PACKAGE
|
||||
|
|
|
@ -38,7 +38,7 @@ public:
|
|||
|
||||
UXml2Txt converter(tag_list, excluded, false);
|
||||
|
||||
if (converter.parse(UFile::contentOf(argv[optind])) == false)
|
||||
if (converter.parse(UFile::contentOf(UString(argv[optind]))) == false)
|
||||
{
|
||||
UApplication::exit_value = 1;
|
||||
|
||||
|
|
|
@ -440,12 +440,11 @@ static inline bool u__is2urlenc(unsigned char c) { return ((u_cttab(c) & 0x02000
|
|||
static inline bool u__isurlqry( unsigned char c) { return ((u_cttab(c) & 0x04000000) != 0); } /* __UQ URL: char FROM query '&' (38 0x26) | '=' (61 0x3D) | '#' (35 0x23) */
|
||||
|
||||
static inline bool u__isprintf(unsigned char c) { return ((u_cttab(c) & 0x00000002) != 0); } /* __E */
|
||||
static inline bool u__issign( unsigned char c) { return ((u_cttab(c) & 0x00000014) != 0); } /* (__H | __O) */
|
||||
static inline bool u__isipv4( unsigned char c) { return ((u_cttab(c) & 0x00001020) != 0); } /* (__N | __D) */
|
||||
static inline bool u__isreal( unsigned char c) { return ((u_cttab(c) & 0x00000024) != 0); } /* (__H | __N) */
|
||||
static inline bool u__isblank( unsigned char c) { return ((u_cttab(c) & 0x00000101) != 0); } /* (__S | __B) */
|
||||
static inline bool u__isalpha( unsigned char c) { return ((u_cttab(c) & 0x0000A000) != 0); } /* (__L | __U) */
|
||||
static inline bool u__isxdigit(unsigned char c) { return ((u_cttab(c) & 0x00081000) != 0); } /* (__X | __D) */
|
||||
static inline bool u__isnumber(unsigned char c) { return ((u_cttab(c) & 0x00001010) != 0); } /* (__O | __D) */
|
||||
static inline bool u__isename( unsigned char c) { return ((u_cttab(c) & 0x00000240) != 0); } /* (__G | __R) */
|
||||
static inline bool u__isalnum( unsigned char c) { return ((u_cttab(c) & 0x0000B000) != 0); } /* (__L | __U | __D) */
|
||||
static inline bool u__islitem( unsigned char c) { return ((u_cttab(c) & 0x00000109) != 0); } /* (__S | __V | __B) */
|
||||
|
@ -459,6 +458,7 @@ static inline bool u__isbase64(unsigned char c) { return ((u_cttab(c) & 0x0010B
|
|||
static inline bool u__isb64url(unsigned char c) { return ((u_cttab(c) & 0x0000B090) != 0); } /* ( __L | __U | __D | __O | __Q) */
|
||||
|
||||
static inline bool u__isvalidchar( unsigned char c) { return ((u_cttab(c) & 0x10000000) != 0); } /* __XM */
|
||||
static inline bool u__isnumberchar( unsigned char c) { return ((u_cttab(c) & 0x00001034) != 0); } /* __H | __O | __N | __D */
|
||||
static inline bool u__isxmlvalidchar(unsigned char c) { return ((u_cttab(c) & 0x10000300) != 0); } /* __XM | __B | __R */
|
||||
static inline bool u__isfnameinvalid(unsigned char c) { return ((u_cttab(c) & 0x08000000) != 0); } /* __UF */
|
||||
|
||||
|
@ -511,7 +511,9 @@ static inline bool u_isBinary(const unsigned char* restrict s, uint32_t n) { ret
|
|||
|
||||
static inline unsigned long u_strtoul(const char* restrict s, const char* restrict e)
|
||||
{
|
||||
char c;
|
||||
/* handle up to 10 digits */
|
||||
|
||||
uint32_t len = e-s;
|
||||
unsigned long val = 0UL;
|
||||
|
||||
U_INTERNAL_TRACE("u_strtoul(%p,%p)", s, e)
|
||||
|
@ -519,13 +521,22 @@ static inline unsigned long u_strtoul(const char* restrict s, const char* restri
|
|||
U_INTERNAL_ASSERT_POINTER(s)
|
||||
U_INTERNAL_ASSERT_POINTER(e)
|
||||
|
||||
for (c = *s; s != e; c = *++s)
|
||||
switch (len)
|
||||
{
|
||||
U_INTERNAL_ASSERT(u__isdigit(*s))
|
||||
|
||||
val = (c - '0') + (val * 10UL);
|
||||
case 10: val += (s[len-10] - '0') * 1000000000UL;
|
||||
case 9: val += (s[len- 9] - '0') * 100000000UL;
|
||||
case 8: val += (s[len- 8] - '0') * 10000000UL;
|
||||
case 7: val += (s[len- 7] - '0') * 1000000UL;
|
||||
case 6: val += (s[len- 6] - '0') * 100000UL;
|
||||
case 5: val += (s[len- 5] - '0') * 10000UL;
|
||||
case 4: val += (s[len- 4] - '0') * 1000UL;
|
||||
case 3: val += (s[len- 3] - '0') * 100UL;
|
||||
case 2: val += (s[len- 2] - '0') * 10UL;
|
||||
case 1: val += (s[len- 1] - '0');
|
||||
}
|
||||
|
||||
U_INTERNAL_PRINT("val = %lu", val)
|
||||
|
||||
return val;
|
||||
}
|
||||
|
||||
|
@ -539,11 +550,11 @@ static inline uint64_t u_strtoull(const char* restrict s, const char* restrict e
|
|||
U_INTERNAL_ASSERT_POINTER(s)
|
||||
U_INTERNAL_ASSERT_POINTER(e)
|
||||
|
||||
for (c = *s; s != e; c = *++s)
|
||||
for (c = *s; s != e; c = *++s)
|
||||
{
|
||||
U_INTERNAL_ASSERT(u__isdigit(*s))
|
||||
U_INTERNAL_ASSERT(u__isdigit(c))
|
||||
|
||||
val = (c - '0') + (val * 10ULL);
|
||||
val = (c - '0') + (val << 1) + (val << 3); // (val * 10ULL)
|
||||
}
|
||||
|
||||
return val;
|
||||
|
@ -551,6 +562,7 @@ static inline uint64_t u_strtoull(const char* restrict s, const char* restrict e
|
|||
|
||||
extern U_EXPORT long u_strtol( const char* restrict s, const char* restrict e) __pure;
|
||||
extern U_EXPORT int64_t u_strtoll(const char* restrict s, const char* restrict e) __pure;
|
||||
extern U_EXPORT double u_strtod( const char* restrict s, const char* restrict e, int point_pos) __pure;
|
||||
|
||||
static inline unsigned u__octc2int(unsigned char c) { return ((c - '0') & 07); }
|
||||
|
||||
|
|
|
@ -14,7 +14,9 @@
|
|||
#ifndef ULIB_HASH_MAP_H
|
||||
#define ULIB_HASH_MAP_H 1
|
||||
|
||||
#include <ulib/container/construct.h>
|
||||
#include <ulib/container/vector.h>
|
||||
|
||||
typedef UVector<UString> UVectorUString;
|
||||
|
||||
typedef bool (*bPFprpv) (UStringRep*,void*);
|
||||
typedef uint32_t (*uPFpcu) (const char*,uint32_t);
|
||||
|
@ -29,8 +31,8 @@ class UFileConfig;
|
|||
class UNoCatPlugIn;
|
||||
class UCertificate;
|
||||
|
||||
template <class T> class UVector;
|
||||
template <class T> class UJsonTypeHandler;
|
||||
template <class T> class URDBObjectHandler;
|
||||
|
||||
class U_NO_EXPORT UHashMapNode {
|
||||
public:
|
||||
|
@ -225,7 +227,7 @@ public:
|
|||
|
||||
lookup(_key);
|
||||
|
||||
insertAfterFind(_key, _elem);
|
||||
insertAfterFind(_key.rep, _elem);
|
||||
}
|
||||
|
||||
// after called find() (don't make the lookup)
|
||||
|
@ -262,8 +264,6 @@ public:
|
|||
|
||||
// call function for all entry
|
||||
|
||||
void getKeys(UVector<UString>& vec);
|
||||
|
||||
void callForAllEntry(bPFprpv function);
|
||||
void callForAllEntrySorted(bPFprpv function)
|
||||
{
|
||||
|
@ -366,6 +366,8 @@ protected:
|
|||
return at(pkey);
|
||||
}
|
||||
|
||||
void getKeys(UVector<UString>& vec);
|
||||
|
||||
void lookup(const UString& keyr) { return lookup(keyr.rep); }
|
||||
void lookup(const UStringRep* keyr);
|
||||
|
||||
|
@ -484,13 +486,22 @@ public:
|
|||
|
||||
// sets a field, overwriting any existing value
|
||||
|
||||
void insert(const UStringRep* _key, const T* _elem)
|
||||
{
|
||||
U_TRACE(0, "UHashMap<T*>::insert(%V,%p)", _key, _elem)
|
||||
|
||||
UHashMap<void*>::lookup(_key);
|
||||
|
||||
insertAfterFind(_key, _elem);
|
||||
}
|
||||
|
||||
void insert(const UString& _key, const T* _elem)
|
||||
{
|
||||
U_TRACE(0, "UHashMap<T*>::insert(%V,%p)", _key.rep, _elem)
|
||||
|
||||
UHashMap<void*>::lookup(_key);
|
||||
|
||||
insertAfterFind(_key, _elem);
|
||||
insertAfterFind(_key.rep, _elem);
|
||||
}
|
||||
|
||||
// find a elem in the array with <key>
|
||||
|
@ -714,7 +725,7 @@ public:
|
|||
is >> *(T*)_elem;
|
||||
|
||||
if (is.bad()) is.clear();
|
||||
else t.insert(key, _elem);
|
||||
else t.insert(key.rep, _elem);
|
||||
}
|
||||
while (c != EOF);
|
||||
|
||||
|
@ -815,11 +826,18 @@ public:
|
|||
UHashMap<UStringRep*>::replaceAfterFind(str.rep);
|
||||
}
|
||||
|
||||
void insert(const UStringRep* _key, const UStringRep* _elem)
|
||||
{
|
||||
U_TRACE(0, "UHashMap<UString>::insert(%V,%V)", _key, _elem)
|
||||
|
||||
UHashMap<UStringRep*>::insert(_key, _elem);
|
||||
}
|
||||
|
||||
void insert(const UString& _key, const UString& str)
|
||||
{
|
||||
U_TRACE(0, "UHashMap<UString>::insert(%V,%V)", _key.rep, str.rep)
|
||||
|
||||
UHashMap<UStringRep*>::insert(_key, str.rep);
|
||||
UHashMap<UStringRep*>::insert(_key.rep, str.rep);
|
||||
}
|
||||
|
||||
UString erase(const UString& key);
|
||||
|
@ -865,6 +883,36 @@ private:
|
|||
friend class UFileConfig;
|
||||
friend class UMimeHeader;
|
||||
friend class UNoCatPlugIn;
|
||||
|
||||
template <class T> friend class URDBObjectHandler;
|
||||
};
|
||||
|
||||
template <> class U_EXPORT UHashMap<UVectorUString> : public UHashMap<UVectorUString*> {
|
||||
public:
|
||||
|
||||
explicit UHashMap(uint32_t n, bool ignore_case) : UHashMap<UVectorUString*>(n, ignore_case)
|
||||
{
|
||||
U_TRACE_REGISTER_OBJECT(0, UHashMap<UVectorUString>, "%u,%b", n, ignore_case)
|
||||
}
|
||||
|
||||
explicit UHashMap(uint32_t n = 53, bPFptpcu _set_index = setIndex) : UHashMap<UVectorUString*>(n, _set_index)
|
||||
{
|
||||
U_TRACE_REGISTER_OBJECT(0, UHashMap<UVectorUString>, "%u,%p", n, _set_index)
|
||||
}
|
||||
|
||||
~UHashMap()
|
||||
{
|
||||
U_TRACE_UNREGISTER_OBJECT(0, UHashMap<UVectorUString>)
|
||||
}
|
||||
|
||||
bool empty();
|
||||
|
||||
void erase(const UString& _key, uint32_t pos); // remove element at pos
|
||||
|
||||
void push(const UString& _key, const UString& str);
|
||||
|
||||
private:
|
||||
U_DISALLOW_COPY_AND_ASSIGN(UHashMap<UVectorUString>)
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -121,7 +121,7 @@ public:
|
|||
// ELEMENT ACCESS
|
||||
|
||||
const void* front() { return *vec; }
|
||||
const void* back() { return *(vec + _length - 1); }
|
||||
const void* back() { return *(vec + _length -1); }
|
||||
|
||||
const void*& at(uint32_t pos) __pure
|
||||
{
|
||||
|
@ -202,9 +202,9 @@ public:
|
|||
U_INTERNAL_ASSERT_RANGE(1,_length,_capacity)
|
||||
|
||||
# ifdef U_APEX_ENABLE
|
||||
if (--_length) (void) U_SYSCALL(apex_memmove, "%p,%p,%u", vec + pos, vec + pos + 1, (_length - pos) * sizeof(void*));
|
||||
if (--_length) (void) U_SYSCALL(apex_memmove, "%p,%p,%u", vec + pos, vec + pos +1, (_length - pos) * sizeof(void*));
|
||||
# else
|
||||
if (--_length) (void) U_SYSCALL( memmove, "%p,%p,%u", vec + pos, vec + pos + 1, (_length - pos) * sizeof(void*));
|
||||
if (--_length) (void) U_SYSCALL( memmove, "%p,%p,%u", vec + pos, vec + pos +1, (_length - pos) * sizeof(void*));
|
||||
# endif
|
||||
}
|
||||
|
||||
|
|
|
@ -49,7 +49,8 @@
|
|||
class URDB;
|
||||
class UHTTP;
|
||||
|
||||
typedef int (*iPFprpr)(UStringRep*, UStringRep*);
|
||||
typedef int (*iPFprpr) (UStringRep*, UStringRep*);
|
||||
typedef void (*vPFprpr) (UStringRep*, UStringRep*);
|
||||
|
||||
#define U_cdb_ignore_case(obj) (obj)->UCDB::flag[0]
|
||||
#define U_cdb_shared(obj) (obj)->UCDB::flag[1]
|
||||
|
|
|
@ -510,6 +510,11 @@ public:
|
|||
|
||||
void callForAllEntry(iPFprpr function, vPF function_no_lock = 0, qcompare compare_obj = 0);
|
||||
|
||||
void callForAllEntryWithSetEntry(vPFprpr function, vPF function_no_lock = 0, qcompare compare_obj = 0)
|
||||
{ bsetEntry = true; callForAllEntry((iPFprpr)function, function_no_lock, compare_obj); bsetEntry = false; }
|
||||
|
||||
void callForAllEntryWithVector(iPFprpr function, vPF function_no_lock = (vPF)-1, qcompare compare_obj = 0) { callForAllEntry(function, function_no_lock, compare_obj); }
|
||||
|
||||
#ifdef DEBUG
|
||||
const char* dump(bool _reset) const;
|
||||
#endif
|
||||
|
@ -518,6 +523,7 @@ public:
|
|||
UDataStorage* pDataStorage;
|
||||
bool brecfound;
|
||||
protected:
|
||||
static bool bsetEntry;
|
||||
static char* data_buffer;
|
||||
static uint32_t data_len;
|
||||
static iPFpvpv ds_function_to_call;
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -132,15 +132,7 @@ public:
|
|||
// PATH
|
||||
|
||||
void setRoot();
|
||||
void setPath(const UString& path, const UString* environment = 0);
|
||||
void setPath(const char* _pathname, const UString* environment = 0)
|
||||
{
|
||||
U_TRACE(0, "UFile::setPath(%S,%p)", _pathname, environment)
|
||||
|
||||
UString path(_pathname);
|
||||
|
||||
setPath(path, environment);
|
||||
}
|
||||
void setPath(const UString& path, const UString* environment = 0);
|
||||
|
||||
bool isRoot() const
|
||||
{
|
||||
|
@ -768,8 +760,7 @@ public:
|
|||
UString getContent( bool brdonly = true, bool bstat = false, bool bmap = false);
|
||||
UString _getContent(bool bsize = true, bool brdonly = false, bool bmap = false);
|
||||
|
||||
static UString contentOf(const UString& _pathname, int flags = O_RDONLY, bool bstat = false);
|
||||
static UString contentOf(const char* _pathname, int flags = O_RDONLY, bool bstat = false, const UString* environment = 0);
|
||||
static UString contentOf(const UString& _pathname, int flags = O_RDONLY, bool bstat = false, const UString* environment = 0);
|
||||
|
||||
static char* mmap(uint32_t* plength, int _fd = -1, int prot = PROT_READ | PROT_WRITE, int flags = MAP_SHARED | MAP_ANONYMOUS, uint32_t offset = 0);
|
||||
|
||||
|
|
|
@ -14,7 +14,6 @@
|
|||
#ifndef ULIB_VALUE_H
|
||||
#define ULIB_VALUE_H 1
|
||||
|
||||
#include <ulib/container/vector.h>
|
||||
#include <ulib/container/hash_map.h>
|
||||
|
||||
#define U_JFIND(json,str,result) UValue::jfind(json,str,U_CONSTANT_SIZE(str),result)
|
||||
|
|
|
@ -15,7 +15,6 @@
|
|||
#define U_MIME_ENTITY_H 1
|
||||
|
||||
#include <ulib/mime/header.h>
|
||||
#include <ulib/container/vector.h>
|
||||
|
||||
/**
|
||||
* UMimeEntity -- class representing a MIME entity
|
||||
|
|
|
@ -20,8 +20,6 @@
|
|||
#include <ulib/net/ping.h>
|
||||
#include <ulib/net/tcpsocket.h>
|
||||
#include <ulib/net/client/http.h>
|
||||
#include <ulib/container/vector.h>
|
||||
#include <ulib/container/hash_map.h>
|
||||
#include <ulib/net/server/server_plugin.h>
|
||||
|
||||
enum LogoutType {
|
||||
|
|
|
@ -1303,6 +1303,20 @@ public:
|
|||
return *this;
|
||||
}
|
||||
|
||||
// swap
|
||||
|
||||
void swap(UString& str)
|
||||
{
|
||||
U_TRACE(0, "UString::swap(%p)", &str)
|
||||
|
||||
UStringRep* tmp = rep;
|
||||
|
||||
rep = str.rep;
|
||||
str.rep = tmp;
|
||||
}
|
||||
|
||||
void swap(UString& lhs, UString& rhs) { lhs.swap(rhs); }
|
||||
|
||||
#ifdef U_COMPILER_RVALUE_REFS
|
||||
UString& operator=(UString && str)
|
||||
{
|
||||
|
@ -1320,8 +1334,7 @@ public:
|
|||
|
||||
rep = str.rep;
|
||||
str.rep = UStringRep::string_rep_null;
|
||||
|
||||
UStringRep::string_rep_null->hold();
|
||||
UStringRep::string_rep_null->hold();
|
||||
|
||||
U_INTERNAL_DUMP("rep = %p", rep)
|
||||
|
||||
|
@ -1374,20 +1387,6 @@ public:
|
|||
UString& replace(uint32_t pos, uint32_t n, const char* s) { return replace(pos, n, s, u__strlen(s, __PRETTY_FUNCTION__)); }
|
||||
UString& replace(uint32_t pos, uint32_t n, const UString& str) { return replace(pos, n, U_STRING_TO_PARAM(str)); }
|
||||
|
||||
// swap
|
||||
|
||||
void swap(UString& str)
|
||||
{
|
||||
U_TRACE(0, "UString::swap(%p)", &str)
|
||||
|
||||
UStringRep* tmp = rep;
|
||||
|
||||
rep = str.rep;
|
||||
str.rep = tmp;
|
||||
}
|
||||
|
||||
void swap(UString& lhs, UString& rhs) { lhs.swap(rhs); }
|
||||
|
||||
// Assignment - NB: assign() DOES NOT WARRANT PROPERTIES OF STRING, replace() YES...
|
||||
|
||||
UString& assign(const char* s, uint32_t n);
|
||||
|
|
|
@ -179,13 +179,29 @@ public:
|
|||
return str.substr(start, s - start);
|
||||
}
|
||||
|
||||
UString getTokenQueryParser();
|
||||
int getTokenId(UString* ptoken);
|
||||
bool tokenSeen(const UString* x);
|
||||
void skipNumber()
|
||||
{
|
||||
U_TRACE_NO_PARAM(0, "UTokenizer::skipNumber()")
|
||||
|
||||
bool skipNumber(bool& isReal);
|
||||
for (; s < end; ++s)
|
||||
{
|
||||
char c = *s;
|
||||
|
||||
if (u__isnumberchar(c) == false &&
|
||||
u__toupper(c) != 'E') // scientific notation (Ex: 1.45e-10)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int getTypeNumber();
|
||||
int getTokenId(UString* ptoken);
|
||||
bool tokenSeen(const UString* x);
|
||||
bool skipToken(const char* token, uint32_t sz);
|
||||
|
||||
UString getTokenQueryParser();
|
||||
|
||||
static const char* group;
|
||||
static bool group_skip, avoid_punctuation;
|
||||
static uint32_t group_len, group_len_div_2;
|
||||
|
|
|
@ -16,10 +16,8 @@
|
|||
|
||||
#include <ulib/timeval.h>
|
||||
#include <ulib/internal/chttp.h>
|
||||
#include <ulib/dynamic/dynamic.h>
|
||||
#include <ulib/utility/services.h>
|
||||
#include <ulib/net/server/server.h>
|
||||
#include <ulib/container/hash_map.h>
|
||||
#include <ulib/utility/string_ext.h>
|
||||
#include <ulib/utility/data_session.h>
|
||||
|
||||
|
|
|
@ -195,7 +195,7 @@ AC_DEFUN([AC_CHECK_PACKAGE],[
|
|||
if test "$found_cyassl" = "yes"; then
|
||||
echo "${T_MD}CYASSL found in $ssldir${T_ME}";
|
||||
ssl_version=$(grep VERSION $ssldir/include/cyassl/openssl/opensslv.h 2>/dev/null | cut -d' ' -f3 | tr -d '\r\n');
|
||||
ULIB_LIBS="$ULIB_LIBS -lcyassl";
|
||||
ULIB_LIBS="-lcyassl $ULIB_LIBS";
|
||||
else
|
||||
echo "${T_MD}libssl found in $ssldir${T_ME}";
|
||||
if test -f "$ssldir/include/openssl/ts.h"; then
|
||||
|
@ -203,9 +203,12 @@ AC_DEFUN([AC_CHECK_PACKAGE],[
|
|||
AC_DEFINE(HAVE_SSL_TS, 1, [Define if we have time stamp support in openssl])
|
||||
fi
|
||||
ssl_version=$($ssldir/bin/openssl version 2>/dev/null)
|
||||
if test -z "${ssl_version}"-a -z "$CROSS_ENVIRONMENT" -a x_$PKG_CONFIG != x_no; then
|
||||
if test -z "${ssl_version}" -a -z "$CROSS_ENVIRONMENT" -a x_$PKG_CONFIG != x_no; then
|
||||
ssl_version=$(pkg-config --modversion openssl 2>/dev/null)
|
||||
fi
|
||||
if test -z "${ssl_version}"; then
|
||||
ssl_version=$(grep OPENSSL_VERSION_TEXT $ssldir/include/openssl/opensslv.h 2>/dev/null | grep -v fips | head -1 | cut -d'"' -f2);
|
||||
fi
|
||||
if test -z "$OPENSSL_LINK"; then
|
||||
ULIB_LIBS="-lssl -lcrypto $ULIB_LIBS";
|
||||
else
|
||||
|
|
|
@ -73,15 +73,15 @@ uint32_t u_m_w = 521288629,
|
|||
|
||||
__pure long u_strtol(const char* restrict s, const char* restrict e)
|
||||
{
|
||||
bool neg;
|
||||
long val;
|
||||
bool neg = false;
|
||||
|
||||
U_INTERNAL_TRACE("u_strtol(%p,%p)", s, e)
|
||||
|
||||
U_INTERNAL_ASSERT_POINTER(s)
|
||||
U_INTERNAL_ASSERT_POINTER(e)
|
||||
|
||||
while (u__isspace(*s)) ++s;
|
||||
// while (u__isspace(*s)) ++s;
|
||||
|
||||
if (*s == '-')
|
||||
{
|
||||
|
@ -91,8 +91,6 @@ __pure long u_strtol(const char* restrict s, const char* restrict e)
|
|||
}
|
||||
else
|
||||
{
|
||||
neg = false;
|
||||
|
||||
if (*s == '+' ||
|
||||
*s == '0')
|
||||
{
|
||||
|
@ -107,15 +105,15 @@ __pure long u_strtol(const char* restrict s, const char* restrict e)
|
|||
|
||||
__pure int64_t u_strtoll(const char* restrict s, const char* restrict e)
|
||||
{
|
||||
bool neg;
|
||||
int64_t val;
|
||||
bool neg = false;
|
||||
|
||||
U_INTERNAL_TRACE("u_strtoll(%p,%p)", s, e)
|
||||
|
||||
U_INTERNAL_ASSERT_POINTER(s)
|
||||
U_INTERNAL_ASSERT_POINTER(e)
|
||||
|
||||
while (u__isspace(*s)) ++s;
|
||||
// while (u__isspace(*s)) ++s;
|
||||
|
||||
if (*s == '-')
|
||||
{
|
||||
|
@ -125,8 +123,6 @@ __pure int64_t u_strtoll(const char* restrict s, const char* restrict e)
|
|||
}
|
||||
else
|
||||
{
|
||||
neg = false;
|
||||
|
||||
if (*s == '+' ||
|
||||
*s == '0')
|
||||
{
|
||||
|
@ -139,6 +135,59 @@ __pure int64_t u_strtoll(const char* restrict s, const char* restrict e)
|
|||
return (neg ? -val : val);
|
||||
}
|
||||
|
||||
__pure double u_strtod(const char* restrict s, const char* restrict e, int point_pos)
|
||||
{
|
||||
static const double pow10[] = {
|
||||
1e+0,
|
||||
1e+1, 1e+2, 1e+3, 1e+4, 1e+5, 1e+6, 1e+7, 1e+8, 1e+9, 1e+10, 1e+11, 1e+12, 1e+13, 1e+14, 1e+15, 1e+16, 1e+17
|
||||
};
|
||||
|
||||
int sign = 1;
|
||||
const char* restrict p;
|
||||
uint64_t integerPart, fractionPart;
|
||||
|
||||
U_INTERNAL_TRACE("u_strtod(%p,%p,%d)", s, e, -point_pos)
|
||||
|
||||
U_INTERNAL_ASSERT_POINTER(s)
|
||||
U_INTERNAL_ASSERT_POINTER(e)
|
||||
U_INTERNAL_ASSERT_MINOR(point_pos, 0)
|
||||
|
||||
// while (u__isspace(*s)) ++s;
|
||||
|
||||
if (*s == '-')
|
||||
{
|
||||
++s;
|
||||
|
||||
sign = -1;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (*s == '+' ||
|
||||
*s == '0')
|
||||
{
|
||||
++s;
|
||||
}
|
||||
}
|
||||
|
||||
p = s;
|
||||
|
||||
if (point_pos == INT_MIN+1) integerPart = 0;
|
||||
else
|
||||
{
|
||||
s += -point_pos;
|
||||
|
||||
integerPart = u_strtoul(p, s);
|
||||
}
|
||||
|
||||
U_INTERNAL_ASSERT_EQUALS(*s, '.')
|
||||
|
||||
fractionPart = u_strtoul(++s, e);
|
||||
|
||||
U_INTERNAL_PRINT("integerPart = %llu fractionPart = %llu pow10[%u] = %g", integerPart, fractionPart, e-s, pow10[e-s])
|
||||
|
||||
return sign * ((double)integerPart + ((double)fractionPart / pow10[e-s]));
|
||||
}
|
||||
|
||||
/* To avoid libc locale overhead */
|
||||
|
||||
__pure int u__strncasecmp(const char* restrict s1, const char* restrict s2, size_t n)
|
||||
|
|
|
@ -356,14 +356,14 @@ UString UCache::getContent(const char* key, uint32_t keylen)
|
|||
|
||||
#ifdef DEBUG
|
||||
struct stat st;
|
||||
char buffer[U_PATH_MAX];
|
||||
UString buffer(U_PATH_MAX);
|
||||
|
||||
(void) u__snprintf(buffer, sizeof(buffer), U_CONSTANT_TO_PARAM("%v/%.*s"), dir_template.rep, keylen, key);
|
||||
buffer.snprintf(U_CONSTANT_TO_PARAM("%v/%.*s"), dir_template.rep, keylen, key);
|
||||
|
||||
if (U_SYSCALL(stat, "%S,%p", buffer, &st) == 0 &&
|
||||
if (U_SYSCALL(stat, "%S,%p", buffer.data(), &st) == 0 &&
|
||||
st.st_mtime >= dir_template_mtime)
|
||||
{
|
||||
return UFile::contentOf(buffer);
|
||||
return UFile::contentOf(buffer);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
|
@ -11,7 +11,6 @@
|
|||
//
|
||||
// ============================================================================
|
||||
|
||||
#include <ulib/container/vector.h>
|
||||
#include <ulib/container/hash_map.h>
|
||||
|
||||
bool UHashMap<void*>::istream_loading;
|
||||
|
@ -196,7 +195,7 @@ void UHashMap<void*>::replaceKey(const UString& _key)
|
|||
|
||||
lookup(_key);
|
||||
|
||||
U_INTERNAL_ASSERT_EQUALS(node,0)
|
||||
U_INTERNAL_ASSERT_EQUALS(node, 0)
|
||||
|
||||
pnode->hash = hash;
|
||||
pnode->next = table[index];
|
||||
|
@ -668,7 +667,9 @@ bool UHashMap<void*>::find(const char* _key, uint32_t keylen)
|
|||
|
||||
lookup(pkey);
|
||||
|
||||
U_RETURN(node != 0);
|
||||
if (node != 0) U_RETURN(true);
|
||||
|
||||
U_RETURN(false);
|
||||
}
|
||||
|
||||
uint32_t UHashMap<UString>::loadFromData(const char* ptr, uint32_t sz)
|
||||
|
@ -799,6 +800,59 @@ uint32_t UHashMap<UString>::loadFromData(const char* ptr, uint32_t sz)
|
|||
U_RETURN(sz);
|
||||
}
|
||||
|
||||
bool UHashMap<UVectorUString>::empty()
|
||||
{
|
||||
U_TRACE_NO_PARAM(0, "UHashMap<UVectorUString>::empty()")
|
||||
|
||||
if (_length)
|
||||
{
|
||||
if (first())
|
||||
{
|
||||
do {
|
||||
UVector<UString>* _elem = elem();
|
||||
|
||||
if (_elem->empty() == false) U_RETURN(false);
|
||||
}
|
||||
while (next());
|
||||
}
|
||||
}
|
||||
|
||||
U_RETURN(true);
|
||||
}
|
||||
|
||||
void UHashMap<UVectorUString>::push(const UString& _key, const UString& str)
|
||||
{
|
||||
U_TRACE(0, "UHashMap<UVectorUString>::push(%V,%V)", _key.rep, str.rep)
|
||||
|
||||
UVector<UString>* _elem;
|
||||
|
||||
UHashMap<void*>::lookup(_key);
|
||||
|
||||
if (node) _elem = (UVector<UString>*) node->elem;
|
||||
else
|
||||
{
|
||||
U_NEW(UVector<UString>, _elem, UVector<UString>);
|
||||
|
||||
UHashMap<UVectorUString*>::insertAfterFind(_key, _elem);
|
||||
}
|
||||
|
||||
_elem->push(str);
|
||||
}
|
||||
|
||||
void UHashMap<UVectorUString>::erase(const UString& _key, uint32_t pos)
|
||||
{
|
||||
U_TRACE(0, "UHashMap<UVectorUString>::erase(%V,%u)", _key.rep, pos)
|
||||
|
||||
UHashMap<void*>::lookup(_key);
|
||||
|
||||
if (node)
|
||||
{
|
||||
UVector<UString>* _elem = (UVector<UString>*) node->elem;
|
||||
|
||||
_elem->erase(pos);
|
||||
}
|
||||
}
|
||||
|
||||
// STREAMS
|
||||
|
||||
#ifdef U_STDCPP_ENABLE
|
||||
|
|
|
@ -11,7 +11,6 @@
|
|||
//
|
||||
// ============================================================================
|
||||
|
||||
#include <ulib/container/vector.h>
|
||||
#include <ulib/utility/string_ext.h>
|
||||
|
||||
#if defined(ENABLE_MEMPOOL) && defined(U_LINUX)
|
||||
|
@ -858,7 +857,7 @@ static inline void vecswap2(UStringRep** a, UStringRep** b, int n)
|
|||
|
||||
#define swap2(a,b) { t = *(a); *(a) = *(b); *(b) = t; }
|
||||
|
||||
static UStringRep** med3func(UStringRep** a, UStringRep** b, UStringRep** c, int depth)
|
||||
static inline UStringRep** med3func(UStringRep** a, UStringRep** b, UStringRep** c, int depth)
|
||||
{
|
||||
U_TRACE(0, "med3func(%p,%p,%p,%d)", a, b, c, depth)
|
||||
|
||||
|
|
|
@ -13,7 +13,6 @@
|
|||
|
||||
#include <ulib/db/cdb.h>
|
||||
#include <ulib/utility/services.h>
|
||||
#include <ulib/container/vector.h>
|
||||
|
||||
void UCDB::init_internal(int ignore_case)
|
||||
{
|
||||
|
|
|
@ -1832,6 +1832,7 @@ bool URDBObjectHandler<UDataStorage*>::getDataStorage()
|
|||
U_RETURN(false);
|
||||
}
|
||||
|
||||
bool URDBObjectHandler<UDataStorage*>::bsetEntry;
|
||||
char* URDBObjectHandler<UDataStorage*>::data_buffer;
|
||||
uint32_t URDBObjectHandler<UDataStorage*>::data_len;
|
||||
iPFpvpv URDBObjectHandler<UDataStorage*>::ds_function_to_call;
|
||||
|
@ -1929,7 +1930,6 @@ void URDBObjectHandler<UDataStorage*>::setEntry(UStringRep* _key, UStringRep* _d
|
|||
// NB: in this way now we have the direct reference to mmap memory for the data record and the key...
|
||||
|
||||
recval._assign(_data);
|
||||
|
||||
pDataStorage->keyid._assign(_key);
|
||||
|
||||
pDataStorage->fromData(U_STRING_TO_PARAM(recval));
|
||||
|
@ -1947,6 +1947,15 @@ int URDBObjectHandler<UDataStorage*>::callEntryCheck(UStringRep* _key, UStringRe
|
|||
|
||||
if (pthis->UCDB::filter_function_to_call(_key, _data))
|
||||
{
|
||||
if (bsetEntry)
|
||||
{
|
||||
pthis->setEntry(_key, _data);
|
||||
|
||||
(void) ds_function_to_call(_key, _data);
|
||||
|
||||
U_RETURN(1);
|
||||
}
|
||||
|
||||
int result = ds_function_to_call(_key, _data);
|
||||
|
||||
if (result == 4) // NB: call function later after set record value from db with setEntry()...
|
||||
|
@ -1957,9 +1966,9 @@ int URDBObjectHandler<UDataStorage*>::callEntryCheck(UStringRep* _key, UStringRe
|
|||
|
||||
if (result == 3) // NB: call function later without lock on db...
|
||||
{
|
||||
result = 1;
|
||||
|
||||
pthis->UCDB::addEntryToVector();
|
||||
|
||||
U_RETURN(1);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2014,8 +2023,8 @@ void URDBObjectHandler<UDataStorage*>::callForAllEntry(iPFprpr function, vPF fun
|
|||
|
||||
if (n > 1)
|
||||
{
|
||||
if (compare_obj != (qcompare)-1) vkey.UVector<void*>::sort(compare_obj);
|
||||
else vkey.sort(UCDB::ignoreCase());
|
||||
if (compare_obj == (qcompare)-1) vkey.sort(UCDB::ignoreCase());
|
||||
else vkey.UVector<void*>::sort(compare_obj);
|
||||
}
|
||||
|
||||
lock();
|
||||
|
@ -2052,20 +2061,23 @@ void URDBObjectHandler<UDataStorage*>::callForAllEntry(iPFprpr function, vPF fun
|
|||
unlock();
|
||||
}
|
||||
|
||||
for (i = 0, n = vec.size(); i < (int)n; i += 2)
|
||||
if ((n = vec.size()))
|
||||
{
|
||||
UStringRep* _key = vec.UVector<UStringRep*>::at(i);
|
||||
UStringRep*_data = vec.UVector<UStringRep*>::at(i+1);
|
||||
|
||||
pthis->setEntry(_key, _data);
|
||||
|
||||
int result = ds_function_to_call((void*)-1, (void*)function_no_lock);
|
||||
|
||||
if (result == 2) // remove
|
||||
for (i = 0; i < (int)n; i += 2)
|
||||
{
|
||||
UCDB::setKey(_key);
|
||||
UStringRep* _key = vec.UVector<UStringRep*>::at(i);
|
||||
UStringRep* _data = vec.UVector<UStringRep*>::at(i+1);
|
||||
|
||||
(void) URDB::remove();
|
||||
pthis->setEntry(_key, _data);
|
||||
|
||||
int result = ds_function_to_call((void*)-1, (void*)function_no_lock);
|
||||
|
||||
if (result == 2) // remove
|
||||
{
|
||||
UCDB::setKey(_key);
|
||||
|
||||
(void) URDB::remove();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2096,7 +2108,6 @@ void URDBObjectHandler<UDataStorage*>::close()
|
|||
{
|
||||
/*
|
||||
UString x = URDB::print();
|
||||
|
||||
(void) UFile::writeToTmp(U_STRING_TO_PARAM(x), O_RDWR | O_TRUNC, U_CONSTANT_TO_PARAM("%.*s.end"), U_FILE_TO_TRACE(*this));
|
||||
*/
|
||||
|
||||
|
@ -2104,9 +2115,7 @@ void URDBObjectHandler<UDataStorage*>::close()
|
|||
|
||||
/*
|
||||
char buffer[1024];
|
||||
|
||||
(void) u__snprintf(U_CONSTANT_TO_PARAM("/tmp/%.*s.init"), U_FILE_TO_TRACE(*this))
|
||||
|
||||
(void) UFile::_unlink(buffer);
|
||||
*/
|
||||
}
|
||||
|
|
|
@ -13,7 +13,6 @@
|
|||
|
||||
#include <ulib/file.h>
|
||||
#include <ulib/tokenizer.h>
|
||||
#include <ulib/container/vector.h>
|
||||
#include <ulib/utility/services.h>
|
||||
#include <ulib/utility/dir_walk.h>
|
||||
#include <ulib/utility/string_ext.h>
|
||||
|
@ -889,30 +888,17 @@ UString UFile::getContent(bool brdonly, bool bstat, bool bmap)
|
|||
U_RETURN_STRING(fileContent);
|
||||
}
|
||||
|
||||
UString UFile::contentOf(const UString& _pathname, int flags, bool bstat)
|
||||
UString UFile::contentOf(const UString& _pathname, int flags, bool bstat, const UString* environment)
|
||||
{
|
||||
U_TRACE(0, "UFile::contentOf(%V,%d,%b)", _pathname.rep, flags, bstat)
|
||||
U_TRACE(0, "UFile::contentOf(%V,%d,%b,%p)", _pathname.rep, flags, bstat, environment)
|
||||
|
||||
U_INTERNAL_ASSERT(_pathname)
|
||||
|
||||
UFile file;
|
||||
UString content;
|
||||
|
||||
file.reset();
|
||||
|
||||
if (file.open(_pathname, flags)) content = file.getContent((((flags & O_RDWR) | (flags & O_WRONLY)) == 0), bstat);
|
||||
|
||||
U_RETURN_STRING(content);
|
||||
}
|
||||
|
||||
UString UFile::contentOf(const char* _pathname, int flags, bool bstat, const UString* environment)
|
||||
{
|
||||
U_TRACE(0, "UFile::contentOf(%S,%d,%b,%p)", _pathname, flags, bstat, environment)
|
||||
|
||||
UFile file;
|
||||
UString path(_pathname), content;
|
||||
|
||||
file.reset();
|
||||
|
||||
file.setPath(path, environment);
|
||||
file.setPath(_pathname, environment);
|
||||
|
||||
if (file.open(flags)) content = file.getContent((((flags & O_RDWR) | (flags & O_WRONLY)) == 0), bstat);
|
||||
|
||||
|
|
|
@ -1088,7 +1088,6 @@ U_NO_EXPORT bool UValue::readValue(UTokenizer& tok, UValue* _value)
|
|||
|
||||
bool result;
|
||||
|
||||
const char* start = tok.getPointer();
|
||||
char c = tok.next();
|
||||
|
||||
switch (c)
|
||||
|
@ -1124,6 +1123,8 @@ U_NO_EXPORT bool UValue::readValue(UTokenizer& tok, UValue* _value)
|
|||
}
|
||||
break;
|
||||
|
||||
case '+':
|
||||
case '-':
|
||||
case '0':
|
||||
case '1':
|
||||
case '2':
|
||||
|
@ -1134,18 +1135,23 @@ U_NO_EXPORT bool UValue::readValue(UTokenizer& tok, UValue* _value)
|
|||
case '7':
|
||||
case '8':
|
||||
case '9':
|
||||
case '-':
|
||||
{
|
||||
bool breal;
|
||||
const char* start = tok.getPointer()-1;
|
||||
|
||||
if ((result = tok.skipNumber(breal)))
|
||||
int type_num = tok.getTypeNumber();
|
||||
|
||||
if ((result = (type_num != 0)))
|
||||
{
|
||||
if (breal)
|
||||
if (type_num < 0)
|
||||
{
|
||||
_value->type_ = REAL_VALUE;
|
||||
_value->value.real_ = strtod(start, 0);
|
||||
_value->value.real_ = (type_num == INT_MIN // scientific notation (Ex: 1.45e10)
|
||||
? strtod(start, 0)
|
||||
: u_strtod(start, tok.getPointer(), type_num));
|
||||
|
||||
U_INTERNAL_DUMP("_value.real_ = %g", _value->value.real_)
|
||||
|
||||
U_INTERNAL_ASSERT_EQUALS(_value->value.real_, strtod(start, 0))
|
||||
}
|
||||
else if (c == '-')
|
||||
{
|
||||
|
@ -1429,6 +1435,8 @@ U_NO_EXPORT int UValue::jread_skip(UTokenizer& tok)
|
|||
case '\0': U_RETURN( NULL_VALUE);
|
||||
case 't': (void) tok.skipToken(U_CONSTANT_TO_PARAM("rue")); U_RETURN(BOOLEAN_VALUE);
|
||||
case 'f': (void) tok.skipToken(U_CONSTANT_TO_PARAM("alse")); U_RETURN(BOOLEAN_VALUE);
|
||||
case '+':
|
||||
case '-':
|
||||
case '0':
|
||||
case '1':
|
||||
case '2':
|
||||
|
@ -1439,11 +1447,8 @@ U_NO_EXPORT int UValue::jread_skip(UTokenizer& tok)
|
|||
case '7':
|
||||
case '8':
|
||||
case '9':
|
||||
case '-':
|
||||
{
|
||||
bool breal;
|
||||
|
||||
(void) tok.skipNumber(breal);
|
||||
tok.skipNumber();
|
||||
|
||||
U_RETURN(NUMBER_VALUE);
|
||||
}
|
||||
|
@ -1684,7 +1689,6 @@ int UValue::jread(const UString& json, const UString& query, UString& result, ui
|
|||
|
||||
U_ASSERT(result.empty())
|
||||
|
||||
bool breal;
|
||||
const char* start;
|
||||
uint32_t count, index;
|
||||
UString jElement, qElement; // qElement = query 'key'
|
||||
|
@ -1727,8 +1731,8 @@ int UValue::jread(const UString& json, const UString& query, UString& result, ui
|
|||
}
|
||||
break;
|
||||
|
||||
case NULL_VALUE: // null
|
||||
case NUMBER_VALUE: // number (may be -ve) int or float
|
||||
case NULL_VALUE: // null
|
||||
case NUMBER_VALUE: // number (may be -ve) int or float
|
||||
case BOOLEAN_VALUE: // true or false
|
||||
{
|
||||
const char* ptr = start = tok1.getPointer();
|
||||
|
@ -1772,9 +1776,7 @@ int UValue::jread(const UString& json, const UString& query, UString& result, ui
|
|||
{
|
||||
start = tok2.getPointer();
|
||||
|
||||
(void) tok2.skipNumber(breal);
|
||||
|
||||
U_INTERNAL_ASSERT_EQUALS(breal, false)
|
||||
tok2.skipNumber();
|
||||
|
||||
index = u_strtoul(start, tok2.getPointer());
|
||||
|
||||
|
@ -1831,11 +1833,17 @@ int UValue::jread(const UString& json, const UString& query, UString& result, ui
|
|||
|
||||
if (qElement == jElement)
|
||||
{
|
||||
int ret;
|
||||
|
||||
// found object key
|
||||
|
||||
++tok1;
|
||||
|
||||
return jread(tok1.substr(), tok2.substr(), result, queryParams);
|
||||
ret = jread(tok1.substr(), tok2.substr(), result, queryParams);
|
||||
|
||||
U_INTERNAL_DUMP("result = %V", result.rep)
|
||||
|
||||
U_RETURN(ret);
|
||||
}
|
||||
|
||||
// no key match... skip this value
|
||||
|
@ -1922,9 +1930,7 @@ int UValue::jread(const UString& json, const UString& query, UString& result, ui
|
|||
{
|
||||
// get array index
|
||||
|
||||
(void) tok2.skipNumber(breal);
|
||||
|
||||
U_INTERNAL_ASSERT_EQUALS(breal, false)
|
||||
tok2.skipNumber();
|
||||
|
||||
index = u_strtoul(start, tok2.getPointer());
|
||||
|
||||
|
@ -1939,9 +1945,15 @@ int UValue::jread(const UString& json, const UString& query, UString& result, ui
|
|||
{
|
||||
if (count == index)
|
||||
{
|
||||
int ret;
|
||||
|
||||
++tok1;
|
||||
|
||||
return jread(tok1.substr(), tok2.substr(), result, queryParams); // return value at index
|
||||
ret = jread(tok1.substr(), tok2.substr(), result, queryParams); // return value at index
|
||||
|
||||
U_INTERNAL_DUMP("result = %V", result.rep)
|
||||
|
||||
U_RETURN(ret);
|
||||
}
|
||||
|
||||
// not this index... skip this value
|
||||
|
|
|
@ -182,7 +182,7 @@ UNoCatPlugIn::UNoCatPlugIn()
|
|||
U_NEW(UString, fw_env, UString);
|
||||
U_NEW(UString, extdev, UString);
|
||||
U_NEW(UString, intdev, UString);
|
||||
U_NEW(UString, mempool, UString(UFile::contentOf("/etc/nodog.mempool")));
|
||||
U_NEW(UString, mempool, UString(UFile::contentOf(U_STRING_FROM_CONSTANT("/etc/nodog.mempool"))));
|
||||
U_NEW(UString, hostname, UString);
|
||||
U_NEW(UString, localnet, UString);
|
||||
U_NEW(UString, location, UString(U_CAPACITY));
|
||||
|
@ -2397,14 +2397,15 @@ int UNoCatPlugIn::handlerRequest()
|
|||
peer = 0;
|
||||
|
||||
// NB: check for request from AUTH, which may be:
|
||||
// -----------------------------------------------------
|
||||
// 1) /checkFirewall - check firewall and report info
|
||||
// 2) /check - check system and report info
|
||||
// 3) /uptime - report uptime info
|
||||
// 4) /users - report list ip of peers permitted
|
||||
// 5) /status - report status user
|
||||
// 6) /logout - logout specific user
|
||||
// -----------------------------------------------------
|
||||
// -------------------------------------------------------------
|
||||
// 1) /checkFirewall - check firewall and report info
|
||||
// 2) /check - check system and report info
|
||||
// 3) /uptime - report uptime info
|
||||
// 4) /users - report list ip of peers permitted
|
||||
// 5) /status - report status user
|
||||
// 6) /logout - logout specific user
|
||||
// 7) /checkForUsersF - check users ffffff and report change
|
||||
// -------------------------------------------------------------
|
||||
|
||||
U_INTERNAL_DUMP("vauth_ip = %p vauth_ip = %S", vauth_ip, UObject2String(*vauth_ip))
|
||||
|
||||
|
@ -2564,6 +2565,38 @@ next: (void) getARPCache();
|
|||
notifyAuthOfUsersInfo(index_AUTH);
|
||||
}
|
||||
}
|
||||
# ifdef USE_LIBTDB
|
||||
else if (U_HTTP_URI_STREQ("/checkForUsersF") &&
|
||||
U_http_info.query_len)
|
||||
{
|
||||
status_content->setBuffer(U_CAPACITY);
|
||||
|
||||
if (pdata)
|
||||
{
|
||||
UVector<UString> vusersF;
|
||||
|
||||
for (uint32_t i = 0, n = vusersF.split(U_HTTP_QUERY_TO_PARAM, ','); i < n; ++i)
|
||||
{
|
||||
peer = (*peers)[vusersF[i]]; // ip address
|
||||
|
||||
if (peer)
|
||||
{
|
||||
(void) setPeerLabel();
|
||||
|
||||
if (peer->label.equal(U_CONSTANT_TO_PARAM("ffffff")) == false)
|
||||
{
|
||||
(void) status_content->append(peer->user);
|
||||
(void) status_content->append(0, ',');
|
||||
(void) status_content->append(peer->label);
|
||||
(void) status_content->append(0, ',');
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
setHTTPResponse(*status_content, U_txt);
|
||||
}
|
||||
# endif
|
||||
else
|
||||
{
|
||||
UHTTP::setBadRequest();
|
||||
|
|
|
@ -14,7 +14,6 @@
|
|||
#include <ulib/file.h>
|
||||
#include <ulib/utility/base64.h>
|
||||
#include <ulib/ssl/certificate.h>
|
||||
#include <ulib/container/vector.h>
|
||||
#include <ulib/utility/services.h>
|
||||
#include <ulib/utility/string_ext.h>
|
||||
#include <ulib/container/hash_map.h>
|
||||
|
|
|
@ -165,8 +165,13 @@ SSL_CTX* USSLSocket::getContext(SSL_METHOD* method, bool bserver, long options)
|
|||
* but to only allow newer protocols like SSLv3 or TLSv1
|
||||
*/
|
||||
|
||||
# if OPENSSL_VERSION_NUMBER < 0x10100000L
|
||||
if (bserver) method = (SSL_METHOD*)SSLv23_server_method();
|
||||
else method = (SSL_METHOD*)SSLv23_client_method();
|
||||
# else
|
||||
if (bserver) method = (SSL_METHOD*)TLS_server_method();
|
||||
else method = (SSL_METHOD*)TLS_client_method();
|
||||
# endif
|
||||
}
|
||||
|
||||
SSL_CTX* ctx = (SSL_CTX*) U_SYSCALL(SSL_CTX_new, "%p", method);
|
||||
|
@ -518,7 +523,7 @@ bool USSLSocket::setContext(const char* dh_file, const char* cert_file, const ch
|
|||
if (result == 0) U_RETURN(false);
|
||||
|
||||
# if !defined(OPENSSL_NO_OCSP) && defined(SSL_CTRL_SET_TLSEXT_STATUS_REQ_CB)
|
||||
staple.cert = UCertificate::readX509(UFile::contentOf(cert_file), "PEM");
|
||||
staple.cert = UCertificate::readX509(UFile::contentOf(UString(cert_file)), "PEM");
|
||||
|
||||
U_INTERNAL_DUMP("staple.cert = %p", staple.cert)
|
||||
# endif
|
||||
|
@ -564,7 +569,7 @@ bool USSLSocket::setContext(const char* dh_file, const char* cert_file, const ch
|
|||
if (result == 0) U_RETURN(false);
|
||||
|
||||
# if !defined(OPENSSL_NO_OCSP) && defined(SSL_CTRL_SET_TLSEXT_STATUS_REQ_CB)
|
||||
staple.pkey = UServices::loadKey(UFile::contentOf(private_key_file), "PEM", true, passwd, 0);
|
||||
staple.pkey = UServices::loadKey(UFile::contentOf(UString(private_key_file)), "PEM", true, passwd, 0);
|
||||
|
||||
U_INTERNAL_DUMP("staple.pkey = %p", staple.pkey)
|
||||
# endif
|
||||
|
|
|
@ -15,7 +15,6 @@
|
|||
#include <ulib/utility/base64.h>
|
||||
#include <ulib/ssl/certificate.h>
|
||||
#include <ulib/utility/services.h>
|
||||
#include <ulib/container/vector.h>
|
||||
#include <ulib/utility/string_ext.h>
|
||||
|
||||
#include <openssl/pem.h>
|
||||
|
|
|
@ -14,7 +14,6 @@
|
|||
#include <ulib/file.h>
|
||||
#include <ulib/utility/escape.h>
|
||||
#include <ulib/internal/chttp.h>
|
||||
#include <ulib/container/vector.h>
|
||||
#include <ulib/container/hash_map.h>
|
||||
|
||||
struct ustring { ustringrep* rep; };
|
||||
|
|
|
@ -282,30 +282,62 @@ bool UTokenizer::skipToken(const char* token, uint32_t sz)
|
|||
U_RETURN(false);
|
||||
}
|
||||
|
||||
bool UTokenizer::skipNumber(bool& isReal)
|
||||
int UTokenizer::getTypeNumber()
|
||||
{
|
||||
U_TRACE(0, "UTokenizer::skipNumber(%p)", &isReal)
|
||||
U_TRACE_NO_PARAM(0, "UTokenizer::getTypeNumber()")
|
||||
|
||||
isReal = false;
|
||||
U_INTERNAL_ASSERT_EQUALS(u__issign(*s), false)
|
||||
U_INTERNAL_ASSERT(u__issign(*(s-1)) || u__isdigit(*(s-1)))
|
||||
|
||||
for (char c; s < end; ++s)
|
||||
int type_num = u__isdigit(*(s-1));
|
||||
|
||||
for (const char* start = s; s < end; ++s)
|
||||
{
|
||||
c = *s;
|
||||
char c = *s;
|
||||
|
||||
if (u__isnumber(c)) continue;
|
||||
U_INTERNAL_DUMP("c = %C type_num = %d", c, type_num)
|
||||
|
||||
if (u__isreal(c) ||
|
||||
u__toupper(c) == 'E')
|
||||
if (u__isdigit(c))
|
||||
{
|
||||
isReal = true;
|
||||
if (type_num == 0) type_num = 1;
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
U_RETURN(true);
|
||||
if (u__issign(c))
|
||||
{
|
||||
if (type_num == INT_MIN) continue;
|
||||
|
||||
U_RETURN(0);
|
||||
}
|
||||
|
||||
if (c == '.' &&
|
||||
type_num <= 1)
|
||||
{
|
||||
int pos = (s-start);
|
||||
|
||||
if (pos == 0) type_num = INT_MIN+1;
|
||||
else
|
||||
{
|
||||
if (u__isdigit(*(start-1))) ++pos;
|
||||
|
||||
type_num = -pos;
|
||||
}
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
if (u__toupper(c) == 'E') // scientific notation (Ex: 1.45e-10)
|
||||
{
|
||||
type_num = INT_MIN;
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
U_RETURN(false);
|
||||
U_RETURN(type_num);
|
||||
}
|
||||
|
||||
UString UTokenizer::getTokenQueryParser()
|
||||
|
|
|
@ -13,7 +13,6 @@
|
|||
|
||||
#include <ulib/file.h>
|
||||
#include <ulib/notifier.h>
|
||||
#include <ulib/container/vector.h>
|
||||
#include <ulib/utility/interrupt.h>
|
||||
#include <ulib/net/server/server.h>
|
||||
|
||||
|
|
|
@ -5632,7 +5632,7 @@ U_NO_EXPORT UString UHTTP::getHTMLDirectoryList()
|
|||
if (size &&
|
||||
basename.equal(U_CONSTANT_TO_PARAM("README.txt")))
|
||||
{
|
||||
readme_txt = UFile::contentOf("README.txt");
|
||||
readme_txt = UFile::contentOf(U_STRING_FROM_CONSTANT("README.txt"));
|
||||
}
|
||||
|
||||
(void) buffer.append(entry);
|
||||
|
|
|
@ -213,7 +213,7 @@ UString UZIP::archive(const char** add_to_filenames)
|
|||
{
|
||||
U_INTERNAL_ASSERT_EQUALS(zip_match("tmp.zip", names), 1)
|
||||
|
||||
result = UFile::contentOf("tmp.zip");
|
||||
result = UFile::contentOf(U_STRING_FROM_CONSTANT("tmp.zip"));
|
||||
}
|
||||
|
||||
(void) UFile::chdir(0, true);
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
// test_cdb.cpp
|
||||
|
||||
#include <ulib/db/cdb.h>
|
||||
#include <ulib/container/vector.h>
|
||||
|
||||
static int print(UStringRep* key, UStringRep* data)
|
||||
{
|
||||
|
|
|
@ -161,9 +161,9 @@ U_EXPORT main (int argc, char* argv[])
|
|||
|
||||
#ifdef U_TEST_C_STR
|
||||
// test c_str()
|
||||
UString tmp0(PAGESIZE, 'a');
|
||||
UFile::writeTo(U_STRING_FROM_CONSTANT("PROVA"), tmp0);
|
||||
UString tmp1 = UFile::contentOf(U_STRING_FROM_CONSTANT("PROVA"));
|
||||
UString tmp0(PAGESIZE, 'a'), x(U_STRING_FROM_CONSTANT("PROVA"));
|
||||
UFile::writeTo(x, tmp0);
|
||||
UString tmp1 = UFile::contentOf(x);
|
||||
tmp1.c_str();
|
||||
#endif
|
||||
|
||||
|
|
|
@ -97,7 +97,7 @@ static void check2(UFileConfig& y)
|
|||
|
||||
static bool print(UStringRep* key, void* value)
|
||||
{
|
||||
U_TRACE(5, "print(%.*S,%p)", U_STRING_TO_TRACE(*key), value)
|
||||
U_TRACE(5, "print(%V,%p)", key, value)
|
||||
|
||||
cout << '\n';
|
||||
cout.write(key->data(), key->size());
|
||||
|
@ -109,7 +109,7 @@ static bool print(UStringRep* key, void* value)
|
|||
|
||||
static bool cancella(UStringRep* key, void* value)
|
||||
{
|
||||
U_TRACE(5, "cancella(%.*S,%p)", U_STRING_TO_TRACE(*key), value)
|
||||
U_TRACE(5, "cancella(%V,%p)", key, value)
|
||||
|
||||
static int cnt;
|
||||
|
||||
|
|
|
@ -278,6 +278,7 @@ U_EXPORT main (int argc, char* argv[])
|
|||
|
||||
int city;
|
||||
double pricePoint;
|
||||
UString workingString, query(U_STRING_FROM_CONSTANT("{ \"colorShifts\" : { \"H67\" : -1 }, \"name\" : \"Mr. Taka Ramen\", \"category\" : 39, \"grouping\" : 0, \"bumpUp\" : false, \"businessID\" : \"B5401\", \"foundationColor\" : 3, \"coordinates\" : [ -73.9888983, 40.7212405 ] }"));
|
||||
|
||||
(void) U_JFIND(U_STRING_FROM_CONSTANT("{ \"pricePoint\" : 2.48333333333333, \"socialWeight\" : 8.75832720587083, \"gender\" : 0, \"lessThan16\" : false }"), "pricePoint", pricePoint);
|
||||
|
||||
|
@ -287,6 +288,16 @@ U_EXPORT main (int argc, char* argv[])
|
|||
|
||||
U_INTERNAL_ASSERT_EQUALS(city, 0)
|
||||
|
||||
(void) UValue::jread(query, U_STRING_FROM_CONSTANT("{'coordinates' [0"), workingString);
|
||||
|
||||
U_INTERNAL_ASSERT_EQUALS(workingString, "-73.9888983")
|
||||
|
||||
workingString.clear();
|
||||
|
||||
(void) U_JFIND(query, "coordinates", workingString);
|
||||
|
||||
U_INTERNAL_ASSERT_EQUALS(workingString, "[ -73.9888983, 40.7212405 ]")
|
||||
|
||||
testMap();
|
||||
testVector();
|
||||
testObject();
|
||||
|
@ -364,7 +375,7 @@ U_EXPORT main (int argc, char* argv[])
|
|||
|
||||
result.clear();
|
||||
|
||||
array = UFile::contentOf("inp/TESTJSON.json");
|
||||
array = UFile::contentOf(U_STRING_FROM_CONSTANT("inp/TESTJSON.json"));
|
||||
|
||||
(void) UValue::jread(array, UString::getStringNull(), result);
|
||||
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
// test_mongodb.cpp
|
||||
|
||||
#include <ulib/container/vector.h>
|
||||
#include <ulib/net/client/mongodb.h>
|
||||
|
||||
int
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
|
||||
#include <ulib/file_config.h>
|
||||
#include <ulib/net/tcpsocket.h>
|
||||
#include <ulib/container/vector.h>
|
||||
#include <ulib/net/server/server.h>
|
||||
|
||||
U_MACROSERVER(UServerExample, UClientImage<UTCPSocket>, UTCPSocket);
|
||||
|
|
|
@ -21,8 +21,7 @@ U_EXPORT main (int argc, char* argv[])
|
|||
|
||||
if (x.connectServer(hostname, 22))
|
||||
{
|
||||
UString filename(argv[5]);
|
||||
UString dati = UFile::contentOf(filename);
|
||||
UString dati = UFile::contentOf(UString(argv[5]));
|
||||
|
||||
const char* str = dati.data();
|
||||
uint32_t size = dati.size();
|
||||
|
|
|
@ -2121,7 +2121,7 @@ U_EXPORT main (int argc, char* argv[])
|
|||
|
||||
U_ASSERT( y == U_STRING_FROM_CONSTANT("10.30.1.0/24 10.1.0.1/16") )
|
||||
|
||||
z = UStringExt::prepareForEnvironmentVar(UFile::contentOf("inp/environment.conf"));
|
||||
z = UStringExt::prepareForEnvironmentVar(UFile::contentOf(U_STRING_FROM_CONSTANT("inp/environment.conf")));
|
||||
|
||||
y = U_STRING_FROM_CONSTANT("DIR_WEB=$HOME/www\n"
|
||||
"DIR_POLICY=$HOME/policy\n"
|
||||
|
@ -2173,7 +2173,7 @@ U_EXPORT main (int argc, char* argv[])
|
|||
U_ASSERT( z == y )
|
||||
|
||||
/*
|
||||
y = z = UFile::contentOf("inp/livevalidation_standalone.compressed.js");
|
||||
y = z = UFile::contentOf(U_STRING_FROM_CONSTANT("inp/livevalidation_standalone.compressed.js"));
|
||||
|
||||
z = UStringExt::minifyCssJs(z);
|
||||
|
||||
|
|
|
@ -95,7 +95,7 @@ U_EXPORT main (int argc, char* argv[])
|
|||
{
|
||||
y.clear();
|
||||
|
||||
dati = UFile::contentOf(argv[1]);
|
||||
dati = UFile::contentOf(UString(argv[1]));
|
||||
|
||||
t.setData(dati);
|
||||
t.setGroup(U_CONSTANT_TO_PARAM("<%%>"));
|
||||
|
|
|
@ -258,7 +258,7 @@ U_EXPORT main (int argc, char* argv[])
|
|||
tmp = v0[2];
|
||||
U_ASSERT( tmp == U_STRING_FROM_CONSTANT("@PIPPO") )
|
||||
|
||||
UString content = UFile::contentOf("inp/wifi-utilizzo");
|
||||
UString content = UFile::contentOf(U_STRING_FROM_CONSTANT("inp/wifi-utilizzo"));
|
||||
UVector<UString> vec1(content, '\n'), vec2(4);
|
||||
|
||||
n = vec1.size();
|
||||
|
@ -292,7 +292,7 @@ U_EXPORT main (int argc, char* argv[])
|
|||
|
||||
vec2.clear();
|
||||
|
||||
tmp = UFile::contentOf(argv[1]);
|
||||
tmp = UFile::contentOf(UString(argv[1]));
|
||||
UVector<UString> y(tmp);
|
||||
y.sort(false);
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user