1
0
mirror of https://github.com/stefanocasazza/ULib.git synced 2025-09-28 19:05:55 +08:00
This commit is contained in:
stefanocasazza 2016-10-06 16:09:35 +02:00
parent 0d9053e495
commit 5c1a3c49ea
62 changed files with 2906 additions and 2598 deletions

7
configure vendored
View File

@ -27216,7 +27216,7 @@ $as_echo "#define USE_LIBSSL 1" >>confdefs.h
if test "$found_cyassl" = "yes"; then if test "$found_cyassl" = "yes"; then
echo "${T_MD}CYASSL found in $ssldir${T_ME}"; 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'); 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 else
echo "${T_MD}libssl found in $ssldir${T_ME}"; echo "${T_MD}libssl found in $ssldir${T_ME}";
if test -f "$ssldir/include/openssl/ts.h"; then if test -f "$ssldir/include/openssl/ts.h"; then
@ -27229,6 +27229,9 @@ $as_echo "#define HAVE_SSL_TS 1" >>confdefs.h
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) ssl_version=$(pkg-config --modversion openssl 2>/dev/null)
fi 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 if test -z "$OPENSSL_LINK"; then
ULIB_LIBS="-lssl -lcrypto $ULIB_LIBS"; ULIB_LIBS="-lssl -lcrypto $ULIB_LIBS";
else 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 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... MAYBE_FLAGS="$MAYBE_FLAGS -flto -ffat-lto-objects -fuse-linker-plugin -march=native -mtune=native" # NB: distcc don't work with this...
fi fi
fi fi

View File

@ -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 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... MAYBE_FLAGS="$MAYBE_FLAGS -flto -ffat-lto-objects -fuse-linker-plugin -march=native -mtune=native" # NB: distcc don't work with this...
fi fi
fi fi

View File

@ -8,7 +8,6 @@
#include <ulib/tokenizer.h> #include <ulib/tokenizer.h>
#include <ulib/file_config.h> #include <ulib/file_config.h>
#include <ulib/utility/services.h> #include <ulib/utility/services.h>
#include <ulib/container/vector.h>
#include "posting.h" #include "posting.h"

View File

@ -188,8 +188,8 @@ extern U_EXPORT void runDynamicPage_ir_web(int param);
filename = IR_SESSION.vec[i]->filename; filename = IR_SESSION.vec[i]->filename;
basename = UStringExt::basename(filename); basename = UStringExt::basename(filename);
pathname1.snprintf(U_CONSTANT_TO_PARAM( "/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/%.*s"), U_STRING_TO_TRACE(filename)); pathname2.snprintf(U_CONSTANT_TO_PARAM("%w/doc/%v"), filename.rep);
doc = UFile::contentOf(pathname2); doc = UFile::contentOf(pathname2);

View File

@ -245,8 +245,8 @@ if (form_with_help) {
filename = IR_SESSION.vec[i]->filename; filename = IR_SESSION.vec[i]->filename;
basename = UStringExt::basename(filename); basename = UStringExt::basename(filename);
pathname1.snprintf(U_CONSTANT_TO_PARAM( "/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/%.*s"), U_STRING_TO_TRACE(filename)); pathname2.snprintf(U_CONSTANT_TO_PARAM("%w/doc/%v"), filename.rep);
doc = UFile::contentOf(pathname2); doc = UFile::contentOf(pathname2);

View File

@ -2,8 +2,6 @@
#include <ulib/db/rdb.h> #include <ulib/db/rdb.h>
#include <ulib/base/utility.h> #include <ulib/base/utility.h>
#include <ulib/container/vector.h>
#include <ulib/container/hash_map.h>
#include <ulib/utility/string_ext.h> #include <ulib/utility/string_ext.h>
#include "posting.h" #include "posting.h"

View File

@ -1,7 +1,6 @@
// cdbmake.cpp // cdbmake.cpp
#include <ulib/db/cdb.h> #include <ulib/db/cdb.h>
#include <ulib/container/vector.h>
#include <ulib/utility/string_ext.h> #include <ulib/utility/string_ext.h>
#undef PACKAGE #undef PACKAGE
@ -28,7 +27,7 @@ public:
UApplication::run(argc, argv, env); UApplication::run(argc, argv, env);
UString records = UFile::contentOf(argv[optind]); UString records = UFile::contentOf(UString(argv[optind]));
# ifdef U_STDCPP_ENABLE # ifdef U_STDCPP_ENABLE
if (records) if (records)

View File

@ -27,7 +27,7 @@ public:
UApplication::run(argc, argv, env); UApplication::run(argc, argv, env);
UString content = UFile::contentOf(argv[optind]); UString content = UFile::contentOf(UString(argv[optind]));
if (content) if (content)
{ {

View File

@ -29,7 +29,7 @@ public:
UApplication::run(argc, argv, env); 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)" // 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)"

View File

@ -43,7 +43,7 @@ public:
UApplication::run(argc, argv, env); 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, // 2013/09/15 03:49:58 op: MAC_AUTH_all, uid: 60:fa:cd:7d:14:06,

View File

@ -28,8 +28,8 @@ public:
UApplication::run(argc, argv, env); UApplication::run(argc, argv, env);
UString riga; UString riga;
UString content1 = UFile::contentOf(argv[optind++]), UString content1 = UFile::contentOf(UString(argv[optind++])),
content2 = UFile::contentOf(argv[optind]); content2 = UFile::contentOf(UString(argv[optind]));
UVector<UString> vec_entry(10), UVector<UString> vec_entry(10),
vec_ap_name(content1), // '\n'), vec_ap_name(content1), // '\n'),

View File

@ -97,7 +97,7 @@ public:
{ {
UString key(argv[optind]), value(argv[++optind]); 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); UApplication::exit_value = x.store(key, value, RDB_REPLACE);
} }

View File

@ -52,6 +52,7 @@ extern U_EXPORT void runDynamicPage_wi_auth(int param);
GET_ENTRY(admin_view_using), GET_ENTRY(admin_view_using),
GET_ENTRY(admin_view_using_historical), GET_ENTRY(admin_view_using_historical),
GET_ENTRY(calendar), GET_ENTRY(calendar),
GET_ENTRY(check_for_usersF),
GET_ENTRY(error_ap), GET_ENTRY(error_ap),
GET_ENTRY(fake_login_validate), GET_ENTRY(fake_login_validate),
GET_ENTRY(gen_activation), GET_ENTRY(gen_activation),

View File

@ -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),
GET_ENTRY(admin_view_using_historical), GET_ENTRY(admin_view_using_historical),
GET_ENTRY(calendar), GET_ENTRY(calendar),
GET_ENTRY(check_for_usersF),
GET_ENTRY(error_ap), GET_ENTRY(error_ap),
GET_ENTRY(fake_login_validate), GET_ENTRY(fake_login_validate),
GET_ENTRY(gen_activation), GET_ENTRY(gen_activation),

View File

@ -380,8 +380,8 @@ public:
{ {
case 1: // Firma dati: XAdES-BES case 1: // Firma dati: XAdES-BES
{ {
UString x = UFile::contentOf(U_X509), UString x = UFile::contentOf(UString(U_X509)),
data = UFile::contentOf(U_DATA_URI); data = UFile::contentOf(UString(U_DATA_URI));
result = client->creatBES(data, U_DATA_URI, x, U_KEY_HANDLE, U_DIGEST_ALGORITHM, result = client->creatBES(data, U_DATA_URI, x, U_KEY_HANDLE, U_DIGEST_ALGORITHM,
U_SIGNING_TIME, U_CLAIMED_ROLE, U_PRODUCTION_PLACE_CITY, U_SIGNING_TIME, U_CLAIMED_ROLE, U_PRODUCTION_PLACE_CITY,
@ -392,8 +392,8 @@ public:
case 2: // Firma dati: XAdES-C case 2: // Firma dati: XAdES-C
{ {
UString x = UFile::contentOf(U_X509), UString x = UFile::contentOf(UString(U_X509)),
data = UFile::contentOf(U_DATA_URI); data = UFile::contentOf(UString(U_DATA_URI));
result = client->creatC(data, U_DATA_URI, x, U_KEY_HANDLE, U_DIGEST_ALGORITHM, result = client->creatC(data, U_DATA_URI, x, U_KEY_HANDLE, U_DIGEST_ALGORITHM,
U_SIGNING_TIME, U_CLAIMED_ROLE, U_PRODUCTION_PLACE_CITY, U_SIGNING_TIME, U_CLAIMED_ROLE, U_PRODUCTION_PLACE_CITY,
@ -405,7 +405,7 @@ public:
case 3: // Archiviazione XAdES-C: XAdES-L 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); result = client->creatL(data, U_ARCHIVE_TIMESTAMP, U_SCHEMA);
} }

View File

@ -786,7 +786,7 @@ public:
x = U_KEY_HANDLE; x = U_KEY_HANDLE;
# else # else
e = 0; e = 0;
x = UFile::contentOf(U_KEY_HANDLE); x = UFile::contentOf(UString(U_KEY_HANDLE));
if (x.empty() || if (x.empty() ||
(u_pkey = UServices::loadKey(x, 0, true, 0, e)) == 0) (u_pkey = UServices::loadKey(x, 0, true, 0, e)) == 0)

View File

@ -14,7 +14,6 @@
#ifndef ULIB_DSIG_TRANSFORM_H #ifndef ULIB_DSIG_TRANSFORM_H
#define ULIB_DSIG_TRANSFORM_H 1 #define ULIB_DSIG_TRANSFORM_H 1
#include <ulib/container/vector.h>
#include <ulib/xml/libxml2/document.h> #include <ulib/xml/libxml2/document.h>
#include "xpath.h" #include "xpath.h"

View File

@ -255,7 +255,7 @@ DocumentClassifier::DocumentClassifier(const char* pathfile) : description(4000U
U_TRACE(5, "DocumentClassifier::DocumentClassifier(%S)", pathfile) U_TRACE(5, "DocumentClassifier::DocumentClassifier(%S)", pathfile)
binary = false; binary = false;
content = UFile::contentOf(pathfile); content = UFile::contentOf(UString(pathfile));
if (content.empty()) if (content.empty())
{ {

View File

@ -631,7 +631,7 @@ public:
{ {
U_TRACE(5, "Application::loadDocument()") U_TRACE(5, "Application::loadDocument()")
*content = UFile::contentOf(filename); *content = UFile::contentOf(UString(filename));
if (content->empty()) if (content->empty())
{ {

View File

@ -3,7 +3,6 @@
#include <ulib/file_config.h> #include <ulib/file_config.h>
#include <ulib/net/tcpsocket.h> #include <ulib/net/tcpsocket.h>
#include <ulib/utility/services.h> #include <ulib/utility/services.h>
#include <ulib/container/vector.h>
#include <ulib/net/server/server.h> #include <ulib/net/server/server.h>
#undef PACKAGE #undef PACKAGE

View File

@ -38,7 +38,7 @@ public:
UXml2Txt converter(tag_list, excluded, false); 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; UApplication::exit_value = 1;

View File

@ -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__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__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__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__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__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__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__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__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) */ 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__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__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__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 */ 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) 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; unsigned long val = 0UL;
U_INTERNAL_TRACE("u_strtoul(%p,%p)", s, e) 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(s)
U_INTERNAL_ASSERT_POINTER(e) U_INTERNAL_ASSERT_POINTER(e)
for (c = *s; s != e; c = *++s) switch (len)
{ {
U_INTERNAL_ASSERT(u__isdigit(*s)) case 10: val += (s[len-10] - '0') * 1000000000UL;
case 9: val += (s[len- 9] - '0') * 100000000UL;
val = (c - '0') + (val * 10UL); 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; return val;
} }
@ -541,9 +552,9 @@ static inline uint64_t u_strtoull(const char* restrict s, const char* restrict 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; 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 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 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); } static inline unsigned u__octc2int(unsigned char c) { return ((c - '0') & 07); }

View File

@ -14,7 +14,9 @@
#ifndef ULIB_HASH_MAP_H #ifndef ULIB_HASH_MAP_H
#define ULIB_HASH_MAP_H 1 #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 bool (*bPFprpv) (UStringRep*,void*);
typedef uint32_t (*uPFpcu) (const char*,uint32_t); typedef uint32_t (*uPFpcu) (const char*,uint32_t);
@ -29,8 +31,8 @@ class UFileConfig;
class UNoCatPlugIn; class UNoCatPlugIn;
class UCertificate; class UCertificate;
template <class T> class UVector;
template <class T> class UJsonTypeHandler; template <class T> class UJsonTypeHandler;
template <class T> class URDBObjectHandler;
class U_NO_EXPORT UHashMapNode { class U_NO_EXPORT UHashMapNode {
public: public:
@ -225,7 +227,7 @@ public:
lookup(_key); lookup(_key);
insertAfterFind(_key, _elem); insertAfterFind(_key.rep, _elem);
} }
// after called find() (don't make the lookup) // after called find() (don't make the lookup)
@ -262,8 +264,6 @@ public:
// call function for all entry // call function for all entry
void getKeys(UVector<UString>& vec);
void callForAllEntry(bPFprpv function); void callForAllEntry(bPFprpv function);
void callForAllEntrySorted(bPFprpv function) void callForAllEntrySorted(bPFprpv function)
{ {
@ -366,6 +366,8 @@ protected:
return at(pkey); return at(pkey);
} }
void getKeys(UVector<UString>& vec);
void lookup(const UString& keyr) { return lookup(keyr.rep); } void lookup(const UString& keyr) { return lookup(keyr.rep); }
void lookup(const UStringRep* keyr); void lookup(const UStringRep* keyr);
@ -484,13 +486,22 @@ public:
// sets a field, overwriting any existing value // 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) void insert(const UString& _key, const T* _elem)
{ {
U_TRACE(0, "UHashMap<T*>::insert(%V,%p)", _key.rep, _elem) U_TRACE(0, "UHashMap<T*>::insert(%V,%p)", _key.rep, _elem)
UHashMap<void*>::lookup(_key); UHashMap<void*>::lookup(_key);
insertAfterFind(_key, _elem); insertAfterFind(_key.rep, _elem);
} }
// find a elem in the array with <key> // find a elem in the array with <key>
@ -714,7 +725,7 @@ public:
is >> *(T*)_elem; is >> *(T*)_elem;
if (is.bad()) is.clear(); if (is.bad()) is.clear();
else t.insert(key, _elem); else t.insert(key.rep, _elem);
} }
while (c != EOF); while (c != EOF);
@ -815,11 +826,18 @@ public:
UHashMap<UStringRep*>::replaceAfterFind(str.rep); 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) void insert(const UString& _key, const UString& str)
{ {
U_TRACE(0, "UHashMap<UString>::insert(%V,%V)", _key.rep, str.rep) 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); UString erase(const UString& key);
@ -865,6 +883,36 @@ private:
friend class UFileConfig; friend class UFileConfig;
friend class UMimeHeader; friend class UMimeHeader;
friend class UNoCatPlugIn; 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 #endif

View File

@ -50,6 +50,7 @@ class URDB;
class UHTTP; 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_ignore_case(obj) (obj)->UCDB::flag[0]
#define U_cdb_shared(obj) (obj)->UCDB::flag[1] #define U_cdb_shared(obj) (obj)->UCDB::flag[1]

View File

@ -510,6 +510,11 @@ public:
void callForAllEntry(iPFprpr function, vPF function_no_lock = 0, qcompare compare_obj = 0); 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 #ifdef DEBUG
const char* dump(bool _reset) const; const char* dump(bool _reset) const;
#endif #endif
@ -518,6 +523,7 @@ public:
UDataStorage* pDataStorage; UDataStorage* pDataStorage;
bool brecfound; bool brecfound;
protected: protected:
static bool bsetEntry;
static char* data_buffer; static char* data_buffer;
static uint32_t data_len; static uint32_t data_len;
static iPFpvpv ds_function_to_call; static iPFpvpv ds_function_to_call;

File diff suppressed because it is too large Load Diff

View File

@ -133,14 +133,6 @@ public:
void setRoot(); void setRoot();
void setPath(const UString& path, const UString* environment = 0); 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);
}
bool isRoot() const bool isRoot() const
{ {
@ -768,8 +760,7 @@ public:
UString getContent( bool brdonly = true, bool bstat = false, bool bmap = false); UString getContent( bool brdonly = true, bool bstat = false, bool bmap = false);
UString _getContent(bool bsize = true, bool brdonly = 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 UString& _pathname, int flags = O_RDONLY, bool bstat = false, const UString* environment = 0);
static UString contentOf(const char* _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); 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);

View File

@ -14,7 +14,6 @@
#ifndef ULIB_VALUE_H #ifndef ULIB_VALUE_H
#define ULIB_VALUE_H 1 #define ULIB_VALUE_H 1
#include <ulib/container/vector.h>
#include <ulib/container/hash_map.h> #include <ulib/container/hash_map.h>
#define U_JFIND(json,str,result) UValue::jfind(json,str,U_CONSTANT_SIZE(str),result) #define U_JFIND(json,str,result) UValue::jfind(json,str,U_CONSTANT_SIZE(str),result)

View File

@ -15,7 +15,6 @@
#define U_MIME_ENTITY_H 1 #define U_MIME_ENTITY_H 1
#include <ulib/mime/header.h> #include <ulib/mime/header.h>
#include <ulib/container/vector.h>
/** /**
* UMimeEntity -- class representing a MIME entity * UMimeEntity -- class representing a MIME entity

View File

@ -20,8 +20,6 @@
#include <ulib/net/ping.h> #include <ulib/net/ping.h>
#include <ulib/net/tcpsocket.h> #include <ulib/net/tcpsocket.h>
#include <ulib/net/client/http.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> #include <ulib/net/server/server_plugin.h>
enum LogoutType { enum LogoutType {

View File

@ -1303,6 +1303,20 @@ public:
return *this; 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 #ifdef U_COMPILER_RVALUE_REFS
UString& operator=(UString && str) UString& operator=(UString && str)
{ {
@ -1320,7 +1334,6 @@ public:
rep = str.rep; rep = str.rep;
str.rep = UStringRep::string_rep_null; str.rep = UStringRep::string_rep_null;
UStringRep::string_rep_null->hold(); UStringRep::string_rep_null->hold();
U_INTERNAL_DUMP("rep = %p", rep) 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 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)); } 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... // Assignment - NB: assign() DOES NOT WARRANT PROPERTIES OF STRING, replace() YES...
UString& assign(const char* s, uint32_t n); UString& assign(const char* s, uint32_t n);

View File

@ -179,13 +179,29 @@ public:
return str.substr(start, s - start); return str.substr(start, s - start);
} }
UString getTokenQueryParser(); void skipNumber()
{
U_TRACE_NO_PARAM(0, "UTokenizer::skipNumber()")
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); int getTokenId(UString* ptoken);
bool tokenSeen(const UString* x); bool tokenSeen(const UString* x);
bool skipNumber(bool& isReal);
bool skipToken(const char* token, uint32_t sz); bool skipToken(const char* token, uint32_t sz);
UString getTokenQueryParser();
static const char* group; static const char* group;
static bool group_skip, avoid_punctuation; static bool group_skip, avoid_punctuation;
static uint32_t group_len, group_len_div_2; static uint32_t group_len, group_len_div_2;

View File

@ -16,10 +16,8 @@
#include <ulib/timeval.h> #include <ulib/timeval.h>
#include <ulib/internal/chttp.h> #include <ulib/internal/chttp.h>
#include <ulib/dynamic/dynamic.h>
#include <ulib/utility/services.h> #include <ulib/utility/services.h>
#include <ulib/net/server/server.h> #include <ulib/net/server/server.h>
#include <ulib/container/hash_map.h>
#include <ulib/utility/string_ext.h> #include <ulib/utility/string_ext.h>
#include <ulib/utility/data_session.h> #include <ulib/utility/data_session.h>

View File

@ -195,7 +195,7 @@ AC_DEFUN([AC_CHECK_PACKAGE],[
if test "$found_cyassl" = "yes"; then if test "$found_cyassl" = "yes"; then
echo "${T_MD}CYASSL found in $ssldir${T_ME}"; 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'); 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 else
echo "${T_MD}libssl found in $ssldir${T_ME}"; echo "${T_MD}libssl found in $ssldir${T_ME}";
if test -f "$ssldir/include/openssl/ts.h"; then if test -f "$ssldir/include/openssl/ts.h"; then
@ -206,6 +206,9 @@ AC_DEFUN([AC_CHECK_PACKAGE],[
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) ssl_version=$(pkg-config --modversion openssl 2>/dev/null)
fi 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 if test -z "$OPENSSL_LINK"; then
ULIB_LIBS="-lssl -lcrypto $ULIB_LIBS"; ULIB_LIBS="-lssl -lcrypto $ULIB_LIBS";
else else

View File

@ -73,15 +73,15 @@ uint32_t u_m_w = 521288629,
__pure long u_strtol(const char* restrict s, const char* restrict e) __pure long u_strtol(const char* restrict s, const char* restrict e)
{ {
bool neg;
long val; long val;
bool neg = false;
U_INTERNAL_TRACE("u_strtol(%p,%p)", s, e) U_INTERNAL_TRACE("u_strtol(%p,%p)", s, e)
U_INTERNAL_ASSERT_POINTER(s) U_INTERNAL_ASSERT_POINTER(s)
U_INTERNAL_ASSERT_POINTER(e) U_INTERNAL_ASSERT_POINTER(e)
while (u__isspace(*s)) ++s; // while (u__isspace(*s)) ++s;
if (*s == '-') if (*s == '-')
{ {
@ -91,8 +91,6 @@ __pure long u_strtol(const char* restrict s, const char* restrict e)
} }
else else
{ {
neg = false;
if (*s == '+' || if (*s == '+' ||
*s == '0') *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) __pure int64_t u_strtoll(const char* restrict s, const char* restrict e)
{ {
bool neg;
int64_t val; int64_t val;
bool neg = false;
U_INTERNAL_TRACE("u_strtoll(%p,%p)", s, e) U_INTERNAL_TRACE("u_strtoll(%p,%p)", s, e)
U_INTERNAL_ASSERT_POINTER(s) U_INTERNAL_ASSERT_POINTER(s)
U_INTERNAL_ASSERT_POINTER(e) U_INTERNAL_ASSERT_POINTER(e)
while (u__isspace(*s)) ++s; // while (u__isspace(*s)) ++s;
if (*s == '-') if (*s == '-')
{ {
@ -125,8 +123,6 @@ __pure int64_t u_strtoll(const char* restrict s, const char* restrict e)
} }
else else
{ {
neg = false;
if (*s == '+' || if (*s == '+' ||
*s == '0') *s == '0')
{ {
@ -139,6 +135,59 @@ __pure int64_t u_strtoll(const char* restrict s, const char* restrict e)
return (neg ? -val : val); 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 */ /* To avoid libc locale overhead */
__pure int u__strncasecmp(const char* restrict s1, const char* restrict s2, size_t n) __pure int u__strncasecmp(const char* restrict s1, const char* restrict s2, size_t n)

View File

@ -356,11 +356,11 @@ UString UCache::getContent(const char* key, uint32_t keylen)
#ifdef DEBUG #ifdef DEBUG
struct stat st; 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) st.st_mtime >= dir_template_mtime)
{ {
return UFile::contentOf(buffer); return UFile::contentOf(buffer);

View File

@ -11,7 +11,6 @@
// //
// ============================================================================ // ============================================================================
#include <ulib/container/vector.h>
#include <ulib/container/hash_map.h> #include <ulib/container/hash_map.h>
bool UHashMap<void*>::istream_loading; bool UHashMap<void*>::istream_loading;
@ -668,7 +667,9 @@ bool UHashMap<void*>::find(const char* _key, uint32_t keylen)
lookup(pkey); 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) 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); 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 // STREAMS
#ifdef U_STDCPP_ENABLE #ifdef U_STDCPP_ENABLE

View File

@ -11,7 +11,6 @@
// //
// ============================================================================ // ============================================================================
#include <ulib/container/vector.h>
#include <ulib/utility/string_ext.h> #include <ulib/utility/string_ext.h>
#if defined(ENABLE_MEMPOOL) && defined(U_LINUX) #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; } #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) U_TRACE(0, "med3func(%p,%p,%p,%d)", a, b, c, depth)

View File

@ -13,7 +13,6 @@
#include <ulib/db/cdb.h> #include <ulib/db/cdb.h>
#include <ulib/utility/services.h> #include <ulib/utility/services.h>
#include <ulib/container/vector.h>
void UCDB::init_internal(int ignore_case) void UCDB::init_internal(int ignore_case)
{ {

View File

@ -1832,6 +1832,7 @@ bool URDBObjectHandler<UDataStorage*>::getDataStorage()
U_RETURN(false); U_RETURN(false);
} }
bool URDBObjectHandler<UDataStorage*>::bsetEntry;
char* URDBObjectHandler<UDataStorage*>::data_buffer; char* URDBObjectHandler<UDataStorage*>::data_buffer;
uint32_t URDBObjectHandler<UDataStorage*>::data_len; uint32_t URDBObjectHandler<UDataStorage*>::data_len;
iPFpvpv URDBObjectHandler<UDataStorage*>::ds_function_to_call; 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... // NB: in this way now we have the direct reference to mmap memory for the data record and the key...
recval._assign(_data); recval._assign(_data);
pDataStorage->keyid._assign(_key); pDataStorage->keyid._assign(_key);
pDataStorage->fromData(U_STRING_TO_PARAM(recval)); 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 (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); int result = ds_function_to_call(_key, _data);
if (result == 4) // NB: call function later after set record value from db with setEntry()... 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... if (result == 3) // NB: call function later without lock on db...
{ {
result = 1;
pthis->UCDB::addEntryToVector(); pthis->UCDB::addEntryToVector();
U_RETURN(1);
} }
} }
@ -2014,8 +2023,8 @@ void URDBObjectHandler<UDataStorage*>::callForAllEntry(iPFprpr function, vPF fun
if (n > 1) if (n > 1)
{ {
if (compare_obj != (qcompare)-1) vkey.UVector<void*>::sort(compare_obj); if (compare_obj == (qcompare)-1) vkey.sort(UCDB::ignoreCase());
else vkey.sort(UCDB::ignoreCase()); else vkey.UVector<void*>::sort(compare_obj);
} }
lock(); lock();
@ -2052,7 +2061,9 @@ void URDBObjectHandler<UDataStorage*>::callForAllEntry(iPFprpr function, vPF fun
unlock(); unlock();
} }
for (i = 0, n = vec.size(); i < (int)n; i += 2) if ((n = vec.size()))
{
for (i = 0; i < (int)n; i += 2)
{ {
UStringRep* _key = vec.UVector<UStringRep*>::at(i); UStringRep* _key = vec.UVector<UStringRep*>::at(i);
UStringRep* _data = vec.UVector<UStringRep*>::at(i+1); UStringRep* _data = vec.UVector<UStringRep*>::at(i+1);
@ -2069,6 +2080,7 @@ void URDBObjectHandler<UDataStorage*>::callForAllEntry(iPFprpr function, vPF fun
} }
} }
} }
}
pthis = pthis_prev; pthis = pthis_prev;
ds_function_to_call = ds_function_to_call_prev; ds_function_to_call = ds_function_to_call_prev;
@ -2096,7 +2108,6 @@ void URDBObjectHandler<UDataStorage*>::close()
{ {
/* /*
UString x = URDB::print(); 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)); (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]; char buffer[1024];
(void) u__snprintf(U_CONSTANT_TO_PARAM("/tmp/%.*s.init"), U_FILE_TO_TRACE(*this)) (void) u__snprintf(U_CONSTANT_TO_PARAM("/tmp/%.*s.init"), U_FILE_TO_TRACE(*this))
(void) UFile::_unlink(buffer); (void) UFile::_unlink(buffer);
*/ */
} }

View File

@ -13,7 +13,6 @@
#include <ulib/file.h> #include <ulib/file.h>
#include <ulib/tokenizer.h> #include <ulib/tokenizer.h>
#include <ulib/container/vector.h>
#include <ulib/utility/services.h> #include <ulib/utility/services.h>
#include <ulib/utility/dir_walk.h> #include <ulib/utility/dir_walk.h>
#include <ulib/utility/string_ext.h> #include <ulib/utility/string_ext.h>
@ -889,30 +888,17 @@ UString UFile::getContent(bool brdonly, bool bstat, bool bmap)
U_RETURN_STRING(fileContent); 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; UFile file;
UString content; UString content;
file.reset(); file.reset();
file.setPath(_pathname, environment);
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);
if (file.open(flags)) content = file.getContent((((flags & O_RDWR) | (flags & O_WRONLY)) == 0), bstat); if (file.open(flags)) content = file.getContent((((flags & O_RDWR) | (flags & O_WRONLY)) == 0), bstat);

View File

@ -1088,7 +1088,6 @@ U_NO_EXPORT bool UValue::readValue(UTokenizer& tok, UValue* _value)
bool result; bool result;
const char* start = tok.getPointer();
char c = tok.next(); char c = tok.next();
switch (c) switch (c)
@ -1124,6 +1123,8 @@ U_NO_EXPORT bool UValue::readValue(UTokenizer& tok, UValue* _value)
} }
break; break;
case '+':
case '-':
case '0': case '0':
case '1': case '1':
case '2': case '2':
@ -1134,18 +1135,23 @@ U_NO_EXPORT bool UValue::readValue(UTokenizer& tok, UValue* _value)
case '7': case '7':
case '8': case '8':
case '9': 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->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_DUMP("_value.real_ = %g", _value->value.real_)
U_INTERNAL_ASSERT_EQUALS(_value->value.real_, strtod(start, 0))
} }
else if (c == '-') else if (c == '-')
{ {
@ -1429,6 +1435,8 @@ U_NO_EXPORT int UValue::jread_skip(UTokenizer& tok)
case '\0': U_RETURN( NULL_VALUE); case '\0': U_RETURN( NULL_VALUE);
case 't': (void) tok.skipToken(U_CONSTANT_TO_PARAM("rue")); U_RETURN(BOOLEAN_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 'f': (void) tok.skipToken(U_CONSTANT_TO_PARAM("alse")); U_RETURN(BOOLEAN_VALUE);
case '+':
case '-':
case '0': case '0':
case '1': case '1':
case '2': case '2':
@ -1439,11 +1447,8 @@ U_NO_EXPORT int UValue::jread_skip(UTokenizer& tok)
case '7': case '7':
case '8': case '8':
case '9': case '9':
case '-':
{ {
bool breal; tok.skipNumber();
(void) tok.skipNumber(breal);
U_RETURN(NUMBER_VALUE); U_RETURN(NUMBER_VALUE);
} }
@ -1684,7 +1689,6 @@ int UValue::jread(const UString& json, const UString& query, UString& result, ui
U_ASSERT(result.empty()) U_ASSERT(result.empty())
bool breal;
const char* start; const char* start;
uint32_t count, index; uint32_t count, index;
UString jElement, qElement; // qElement = query 'key' UString jElement, qElement; // qElement = query 'key'
@ -1772,9 +1776,7 @@ int UValue::jread(const UString& json, const UString& query, UString& result, ui
{ {
start = tok2.getPointer(); start = tok2.getPointer();
(void) tok2.skipNumber(breal); tok2.skipNumber();
U_INTERNAL_ASSERT_EQUALS(breal, false)
index = u_strtoul(start, tok2.getPointer()); 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) if (qElement == jElement)
{ {
int ret;
// found object key // found object key
++tok1; ++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 // 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 // get array index
(void) tok2.skipNumber(breal); tok2.skipNumber();
U_INTERNAL_ASSERT_EQUALS(breal, false)
index = u_strtoul(start, tok2.getPointer()); 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) if (count == index)
{ {
int ret;
++tok1; ++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 // not this index... skip this value

View File

@ -182,7 +182,7 @@ UNoCatPlugIn::UNoCatPlugIn()
U_NEW(UString, fw_env, UString); U_NEW(UString, fw_env, UString);
U_NEW(UString, extdev, UString); U_NEW(UString, extdev, UString);
U_NEW(UString, intdev, 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, hostname, UString);
U_NEW(UString, localnet, UString); U_NEW(UString, localnet, UString);
U_NEW(UString, location, UString(U_CAPACITY)); U_NEW(UString, location, UString(U_CAPACITY));
@ -2397,14 +2397,15 @@ int UNoCatPlugIn::handlerRequest()
peer = 0; peer = 0;
// NB: check for request from AUTH, which may be: // NB: check for request from AUTH, which may be:
// ----------------------------------------------------- // -------------------------------------------------------------
// 1) /checkFirewall - check firewall and report info // 1) /checkFirewall - check firewall and report info
// 2) /check - check system and report info // 2) /check - check system and report info
// 3) /uptime - report uptime info // 3) /uptime - report uptime info
// 4) /users - report list ip of peers permitted // 4) /users - report list ip of peers permitted
// 5) /status - report status user // 5) /status - report status user
// 6) /logout - logout specific 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)) U_INTERNAL_DUMP("vauth_ip = %p vauth_ip = %S", vauth_ip, UObject2String(*vauth_ip))
@ -2564,6 +2565,38 @@ next: (void) getARPCache();
notifyAuthOfUsersInfo(index_AUTH); 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 else
{ {
UHTTP::setBadRequest(); UHTTP::setBadRequest();

View File

@ -14,7 +14,6 @@
#include <ulib/file.h> #include <ulib/file.h>
#include <ulib/utility/base64.h> #include <ulib/utility/base64.h>
#include <ulib/ssl/certificate.h> #include <ulib/ssl/certificate.h>
#include <ulib/container/vector.h>
#include <ulib/utility/services.h> #include <ulib/utility/services.h>
#include <ulib/utility/string_ext.h> #include <ulib/utility/string_ext.h>
#include <ulib/container/hash_map.h> #include <ulib/container/hash_map.h>

View File

@ -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 * but to only allow newer protocols like SSLv3 or TLSv1
*/ */
# if OPENSSL_VERSION_NUMBER < 0x10100000L
if (bserver) method = (SSL_METHOD*)SSLv23_server_method(); if (bserver) method = (SSL_METHOD*)SSLv23_server_method();
else method = (SSL_METHOD*)SSLv23_client_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); 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 (result == 0) U_RETURN(false);
# if !defined(OPENSSL_NO_OCSP) && defined(SSL_CTRL_SET_TLSEXT_STATUS_REQ_CB) # 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) U_INTERNAL_DUMP("staple.cert = %p", staple.cert)
# endif # 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 (result == 0) U_RETURN(false);
# if !defined(OPENSSL_NO_OCSP) && defined(SSL_CTRL_SET_TLSEXT_STATUS_REQ_CB) # 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) U_INTERNAL_DUMP("staple.pkey = %p", staple.pkey)
# endif # endif

View File

@ -15,7 +15,6 @@
#include <ulib/utility/base64.h> #include <ulib/utility/base64.h>
#include <ulib/ssl/certificate.h> #include <ulib/ssl/certificate.h>
#include <ulib/utility/services.h> #include <ulib/utility/services.h>
#include <ulib/container/vector.h>
#include <ulib/utility/string_ext.h> #include <ulib/utility/string_ext.h>
#include <openssl/pem.h> #include <openssl/pem.h>

View File

@ -14,7 +14,6 @@
#include <ulib/file.h> #include <ulib/file.h>
#include <ulib/utility/escape.h> #include <ulib/utility/escape.h>
#include <ulib/internal/chttp.h> #include <ulib/internal/chttp.h>
#include <ulib/container/vector.h>
#include <ulib/container/hash_map.h> #include <ulib/container/hash_map.h>
struct ustring { ustringrep* rep; }; struct ustring { ustringrep* rep; };

View File

@ -282,30 +282,62 @@ bool UTokenizer::skipToken(const char* token, uint32_t sz)
U_RETURN(false); 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) || if (u__isdigit(c))
u__toupper(c) == 'E')
{ {
isReal = true; if (type_num == 0) type_num = 1;
continue; continue;
} }
U_RETURN(true); if (u__issign(c))
{
if (type_num == INT_MIN) continue;
U_RETURN(0);
} }
U_RETURN(false); 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(type_num);
} }
UString UTokenizer::getTokenQueryParser() UString UTokenizer::getTokenQueryParser()

View File

@ -13,7 +13,6 @@
#include <ulib/file.h> #include <ulib/file.h>
#include <ulib/notifier.h> #include <ulib/notifier.h>
#include <ulib/container/vector.h>
#include <ulib/utility/interrupt.h> #include <ulib/utility/interrupt.h>
#include <ulib/net/server/server.h> #include <ulib/net/server/server.h>

View File

@ -5632,7 +5632,7 @@ U_NO_EXPORT UString UHTTP::getHTMLDirectoryList()
if (size && if (size &&
basename.equal(U_CONSTANT_TO_PARAM("README.txt"))) 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); (void) buffer.append(entry);

View File

@ -213,7 +213,7 @@ UString UZIP::archive(const char** add_to_filenames)
{ {
U_INTERNAL_ASSERT_EQUALS(zip_match("tmp.zip", names), 1) 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); (void) UFile::chdir(0, true);

View File

@ -1,7 +1,6 @@
// test_cdb.cpp // test_cdb.cpp
#include <ulib/db/cdb.h> #include <ulib/db/cdb.h>
#include <ulib/container/vector.h>
static int print(UStringRep* key, UStringRep* data) static int print(UStringRep* key, UStringRep* data)
{ {

View File

@ -161,9 +161,9 @@ U_EXPORT main (int argc, char* argv[])
#ifdef U_TEST_C_STR #ifdef U_TEST_C_STR
// test c_str() // test c_str()
UString tmp0(PAGESIZE, 'a'); UString tmp0(PAGESIZE, 'a'), x(U_STRING_FROM_CONSTANT("PROVA"));
UFile::writeTo(U_STRING_FROM_CONSTANT("PROVA"), tmp0); UFile::writeTo(x, tmp0);
UString tmp1 = UFile::contentOf(U_STRING_FROM_CONSTANT("PROVA")); UString tmp1 = UFile::contentOf(x);
tmp1.c_str(); tmp1.c_str();
#endif #endif

View File

@ -97,7 +97,7 @@ static void check2(UFileConfig& y)
static bool print(UStringRep* key, void* value) 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 << '\n';
cout.write(key->data(), key->size()); cout.write(key->data(), key->size());
@ -109,7 +109,7 @@ static bool print(UStringRep* key, void* value)
static bool cancella(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; static int cnt;

View File

@ -278,6 +278,7 @@ U_EXPORT main (int argc, char* argv[])
int city; int city;
double pricePoint; 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); (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) 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(); testMap();
testVector(); testVector();
testObject(); testObject();
@ -364,7 +375,7 @@ U_EXPORT main (int argc, char* argv[])
result.clear(); 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); (void) UValue::jread(array, UString::getStringNull(), result);

View File

@ -1,6 +1,5 @@
// test_mongodb.cpp // test_mongodb.cpp
#include <ulib/container/vector.h>
#include <ulib/net/client/mongodb.h> #include <ulib/net/client/mongodb.h>
int int

View File

@ -2,7 +2,6 @@
#include <ulib/file_config.h> #include <ulib/file_config.h>
#include <ulib/net/tcpsocket.h> #include <ulib/net/tcpsocket.h>
#include <ulib/container/vector.h>
#include <ulib/net/server/server.h> #include <ulib/net/server/server.h>
U_MACROSERVER(UServerExample, UClientImage<UTCPSocket>, UTCPSocket); U_MACROSERVER(UServerExample, UClientImage<UTCPSocket>, UTCPSocket);

View File

@ -21,8 +21,7 @@ U_EXPORT main (int argc, char* argv[])
if (x.connectServer(hostname, 22)) if (x.connectServer(hostname, 22))
{ {
UString filename(argv[5]); UString dati = UFile::contentOf(UString(argv[5]));
UString dati = UFile::contentOf(filename);
const char* str = dati.data(); const char* str = dati.data();
uint32_t size = dati.size(); uint32_t size = dati.size();

View File

@ -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") ) 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" y = U_STRING_FROM_CONSTANT("DIR_WEB=$HOME/www\n"
"DIR_POLICY=$HOME/policy\n" "DIR_POLICY=$HOME/policy\n"
@ -2173,7 +2173,7 @@ U_EXPORT main (int argc, char* argv[])
U_ASSERT( z == y ) 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); z = UStringExt::minifyCssJs(z);

View File

@ -95,7 +95,7 @@ U_EXPORT main (int argc, char* argv[])
{ {
y.clear(); y.clear();
dati = UFile::contentOf(argv[1]); dati = UFile::contentOf(UString(argv[1]));
t.setData(dati); t.setData(dati);
t.setGroup(U_CONSTANT_TO_PARAM("<%%>")); t.setGroup(U_CONSTANT_TO_PARAM("<%%>"));

View File

@ -258,7 +258,7 @@ U_EXPORT main (int argc, char* argv[])
tmp = v0[2]; tmp = v0[2];
U_ASSERT( tmp == U_STRING_FROM_CONSTANT("@PIPPO") ) 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); UVector<UString> vec1(content, '\n'), vec2(4);
n = vec1.size(); n = vec1.size();
@ -292,7 +292,7 @@ U_EXPORT main (int argc, char* argv[])
vec2.clear(); vec2.clear();
tmp = UFile::contentOf(argv[1]); tmp = UFile::contentOf(UString(argv[1]));
UVector<UString> y(tmp); UVector<UString> y(tmp);
y.sort(false); y.sort(false);