diff --git a/configure.in b/configure.in index 172f8316..2473f638 100644 --- a/configure.in +++ b/configure.in @@ -3,7 +3,7 @@ dnl dnl Process this file with autoconf to produce a configure script. dnl -AC_INIT([okws], [3.1.34.5]) +AC_INIT([okws], [3.1.34.6]) AM_CONFIG_HEADER([config.h]) AC_CONFIG_AUX_DIR([.]) AM_INIT_AUTOMAKE([subdir-objects]) diff --git a/libahttp/ahutil.h b/libahttp/ahutil.h index eeb388e5..e87187f4 100644 --- a/libahttp/ahutil.h +++ b/libahttp/ahutil.h @@ -67,7 +67,7 @@ class cbbun_t : public virtual refcount { cbv::ptr bwrap () { - return wrap (this, &cbbun_t::dec, mkref (this)); + return wrap (this, &cbbun_t::dec, ptr(mkref (this))); } static ptr alloc (u_int i, cbv c) diff --git a/libamysql/mybind.C b/libamysql/mybind.C index 9c1bb91b..381ee343 100644 --- a/libamysql/mybind.C +++ b/libamysql/mybind.C @@ -58,26 +58,6 @@ str mybind_str_t::to_str () const { return str (buf, size); } //----------------------------------------------------------------------- -void -mybind_sex_t::to_qry (MYSQL *m, strbuf *b, char **s, u_int *l) -{ - buf[1] = sex_to_char (sx); - b->buf (buf, 3); -} - -//----------------------------------------------------------------------- - -str -mybind_sex_t::to_str () const -{ - char b[2]; - b[1] = 0; - b[0] = sex_to_char (sx); - return str (b, 2); -} - -//----------------------------------------------------------------------- - u_int next2pow (u_int i) { diff --git a/libamysql/mybind.h b/libamysql/mybind.h index a3a5d412..7d2f5f13 100644 --- a/libamysql/mybind.h +++ b/libamysql/mybind.h @@ -203,33 +203,24 @@ class mybind_date_t : public mybind_t { class mybind_str_t : public mybind_t { public: - mybind_str_t (const str &s, eft_t t = MYSQL_TYPE_STRING, bool hld = false) : - mybind_t (t), hold (hld ? s : sNULL), size (s.len ()), + mybind_str_t (const str &s) : + mybind_t (MYSQL_TYPE_STRING), hold (s), size (s.len ()), buf (const_cast (s.cstr ())), balloced (false), - pntr (NULL) {} + pntr (nullptr) {} + + mybind_str_t (str *p) : + mybind_t ( MYSQL_TYPE_STRING), hold (nullptr), size (1024), + buf (New char[size]), balloced (true), pntr (p) {} - mybind_str_t (sex_t s) - : mybind_t (MYSQL_TYPE_STRING), hold (sex_to_str (s)), size (hold.len ()), - buf (const_cast (hold.cstr ())), balloced (false), - pntr (NULL) {} - - mybind_str_t (u_int s = 1024, eft_t t = MYSQL_TYPE_STRING) : - mybind_t (t), hold (NULL), size (s), buf (New char[s]), balloced (true), - pntr (NULL) {} - - mybind_str_t (str *p, u_int s = 1024, eft_t t = MYSQL_TYPE_STRING) : - mybind_t (t), hold (NULL), size (s), buf (New char[s]), balloced (true), - pntr (p) {} - ~mybind_str_t () { if (balloced) delete [] buf; } #ifdef HAVE_MYSQL_BIND - void bind (MYSQL_BIND *bnd, bool param); + void bind (MYSQL_BIND *bnd, bool param) override; #endif - virtual void to_qry (MYSQL *m, strbuf *b, char **s, u_int *l); - virtual str to_str () const; - virtual void assign () { *pntr = str (buf, len); } + void to_qry (MYSQL *m, strbuf *b, char **s, u_int *l) override; + str to_str () const override; + void assign () override { *pntr = str (buf, len); } operator str () const { return isnull () ? sNULL : str (buf, len); } - bool read_str (const char *c, unsigned long l, eft_t typ) + bool read_str (const char *c, unsigned long l, eft_t typ) override { *pntr = str (c, l); return true; } protected: @@ -275,11 +266,11 @@ class mybind_var_t : public mybind_t { template class mybind_rpcstr_t : public mybind_t { public: - mybind_rpcstr_t (rpc_bytes *rr) + mybind_rpcstr_t (rpc_bytes *rr) : mybind_t (MYSQL_TYPE_STRING), pntr (rr), mys (&s) {} mybind_rpcstr_t (const rpc_bytes &in) - : mybind_t (MYSQL_TYPE_STRING), - mys (str (in.base (), in.size ()), MYSQL_TYPE_STRING, true) {} + : mybind_t (MYSQL_TYPE_STRING), + mys (str (in.base (), in.size ())) {} #ifdef HAVE_MYSQL_BIND void bind (MYSQL_BIND *bind, bool param) { mys.bind (bind, param); } #endif @@ -301,29 +292,6 @@ class mybind_rpcstr_t : public mybind_t { //----------------------------------------------------------------------- -class mybind_sex_t : public mybind_str_t { -public: - mybind_sex_t (sex_t *p) : mybind_str_t (), pntr (p), sx (NOSEX) {} - mybind_sex_t (sex_t s) : mybind_str_t (s), sx (s) - { sprintf (buf, "\'%c\'", sex_to_char (sx)); } - virtual void to_qry (MYSQL *m, strbuf *b, char **s, u_int *l); - virtual str to_str () const; - virtual void assign () - { - *pntr = size ? str_to_sex (str (buf, size)) : NOSEX; - } - virtual bool read_str (const char *c, unsigned long l, eft_t typ) - { - return ((*pntr = c ? char_to_sex (*c) : NOSEX) != NOSEX); - } -private: - char buf[4]; - sex_t *pntr; - sex_t sx; -}; - -//----------------------------------------------------------------------- - class mybind_json_t : public mybind_t { public: mybind_json_t () : mybind_t (MYSQL_TYPE_NULL), _x (XPUB3_JSON_NULL), @@ -619,7 +587,6 @@ class mybind_res_t : public mybindable_t { mybind_res_t (int *i) { p = New refcounted (i); } mybind_res_t (u_int32_t *i) { p = New refcounted (i); } mybind_res_t (ptr *i) { p = New refcounted (i); } - mybind_res_t (sex_t *s) { p = New refcounted (s); } mybind_res_t (int16_t *i) { p = New refcounted (i); } mybind_res_t (ptr *i) { p = New refcounted (i); } mybind_res_t (u_int16_t *i) { p = New refcounted (i); } @@ -682,7 +649,6 @@ class mybind_param_t : public mybindable_t { mybind_param_t (u_char i) { p = New refcounted (i); } mybind_param_t (okdatep_t d) { p = New refcounted (d); } mybind_param_t (const okdate_t &d) { p = New refcounted (d); } - mybind_param_t (sex_t s) { p = New refcounted (s); } mybind_param_t (const amysql_scalar_t &x); mybind_param_t (mysql_var_t v) { p = New refcounted (v); } @@ -719,8 +685,6 @@ class mybind_param_t : public mybindable_t { { p = New refcounted (d); return (*this); } mybind_param_t &operator= (const okdate_t &d) { p = New refcounted (d); return (*this); } - mybind_param_t &operator= (sex_t s) - { p = New refcounted (s); return (*this); } mybind_param_t &operator= (const x_okdate_t &x) { p = New refcounted (x); return (*this); } mybind_param_t &operator= (const x_okdate_time_t &x) diff --git a/libaok/ok.T b/libaok/ok.T index bee46de0..84df9718 100644 --- a/libaok/ok.T +++ b/libaok/ok.T @@ -769,8 +769,8 @@ oksrvc_t::launch_T () if (ok_svc_life_time > 0) { delaycb (ok_svc_life_time, 0, wrap (this, &oksrvc_t::internal_reliable_shutdown, - "service lifetime expired", - ok_shutdown_timeout_fast)); + str("service lifetime expired"), + static_cast(ok_shutdown_timeout_fast))); } } diff --git a/libpub/pub3tracer.T b/libpub/pub3tracer.T index 4822ac30..14daabc1 100644 --- a/libpub/pub3tracer.T +++ b/libpub/pub3tracer.T @@ -495,9 +495,8 @@ namespace { } }; - wrap_res_t wrap(ptr e, - ref tracer, - const bhash &pure_funs) { + wrap_res_t my_wrap(ptr e, ref tracer, + const bhash &pure_funs) { wrap_res_t res; res.desc.alloc(); ptr c = e->to_callable(); @@ -560,7 +559,7 @@ namespace { auto fld_desc = pub3::expr_dict_t::alloc(); auto res_val = pub3::expr_dict_t::alloc(); for (str fld : *d) { - wrap_res_t v = wrap(d->lookup(fld), tracer, pure_funs); + wrap_res_t v = my_wrap(d->lookup(fld), tracer, pure_funs); if (!v.val || !v.desc) { res.clear(); return res; @@ -595,7 +594,7 @@ namespace { res.clear(); return res; } - auto wrapped = wrap(val, tracer, pure_funs); + auto wrapped = my_wrap(val, tracer, pure_funs); if (!wrapped.val || !wrapped.desc) { res.clear(); return res; diff --git a/libweb/web.C b/libweb/web.C index dac7543d..8e91a247 100644 --- a/libweb/web.C +++ b/libweb/web.C @@ -25,67 +25,6 @@ #include "rxx.h" #include "parseopt.h" -sex_t -str_to_sex (const str &s) -{ - if (!s) - return NOSEX; // ; i don't need it as long as i have my computer - return str_to_sex (s.cstr (), s.len ()); -} - -sex_t -str_to_sex (const char *s, u_int len) -{ - if (len < 1) - return NOSEX; - if (*s == 'M' || *s == 'm') - return MALE; - if (*s == 'F' || *s == 'f') - return FEMALE; - return NOSEX; -} - -str -sex_to_str (sex_t t) -{ - switch (t) { - case MALE: - return "m"; - case FEMALE: - return "f"; - default: - return ""; - } -} - -char -sex_to_char (sex_t t) -{ - switch (t) { - case MALE: - return 'm'; - case FEMALE: - return 'f'; - default: - return 'n'; - } -} - -sex_t -char_to_sex (char c) -{ - switch (c) { - case 'm': - case 'M': - return MALE; - case 'f': - case 'F': - return FEMALE; - default: - return NOSEX; - } -} - const char *date_rxx_str = "(([0-9]{4})-([0-9]{2})-([0-9]{2}))?" "( ([0-9]{2}):([0-9]{2}):([0-9]{2}))?"; diff --git a/libweb/web.h b/libweb/web.h index f80428f9..4237181c 100644 --- a/libweb/web.h +++ b/libweb/web.h @@ -141,11 +141,6 @@ class okdate_t { typedef ptr okdatep_t; -sex_t str_to_sex (const str &s); -sex_t str_to_sex (const char *c, u_int len); -str sex_to_str (sex_t t); -char sex_to_char (sex_t t); -sex_t char_to_sex (char c); str check_email (const str &in); str check_zipcode (const str &in); diff --git a/libweb/web_prot.x b/libweb/web_prot.x index b9dab14f..22d3c97f 100644 --- a/libweb/web_prot.x +++ b/libweb/web_prot.x @@ -1,12 +1,6 @@ /* $Id */ -enum sex_t { - NOSEX = 0, - MALE = 1, - FEMALE = 2 -}; - enum adb_status_t { ADB_OK = 0, ADB_NOT_FOUND = 1,