Skip to content
This repository was archived by the owner on Jan 16, 2021. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion configure.in
Original file line number Diff line number Diff line change
Expand Up @@ -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])
Expand Down
2 changes: 1 addition & 1 deletion libahttp/ahutil.h
Original file line number Diff line number Diff line change
Expand Up @@ -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<cbbun_t>(mkref (this)));
}

static ptr<cbbun_t> alloc (u_int i, cbv c)
Expand Down
20 changes: 0 additions & 20 deletions libamysql/mybind.C
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down
66 changes: 15 additions & 51 deletions libamysql/mybind.h
Original file line number Diff line number Diff line change
Expand Up @@ -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<char *> (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<char *> (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:
Expand Down Expand Up @@ -275,11 +266,11 @@ class mybind_var_t : public mybind_t {
template<size_t n>
class mybind_rpcstr_t : public mybind_t {
public:
mybind_rpcstr_t (rpc_bytes<n> *rr)
mybind_rpcstr_t (rpc_bytes<n> *rr)
: mybind_t (MYSQL_TYPE_STRING), pntr (rr), mys (&s) {}
mybind_rpcstr_t (const rpc_bytes<n> &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
Expand All @@ -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),
Expand Down Expand Up @@ -619,7 +587,6 @@ class mybind_res_t : public mybindable_t {
mybind_res_t (int *i) { p = New refcounted<mybind_int_t> (i); }
mybind_res_t (u_int32_t *i) { p = New refcounted<mybind_u32_t> (i); }
mybind_res_t (ptr<u_int32_t> *i) { p = New refcounted<mybind_u32_t> (i); }
mybind_res_t (sex_t *s) { p = New refcounted<mybind_sex_t> (s); }
mybind_res_t (int16_t *i) { p = New refcounted<mybind_short_t> (i); }
mybind_res_t (ptr<int16_t> *i) { p = New refcounted<mybind_short_t> (i); }
mybind_res_t (u_int16_t *i) { p = New refcounted<mybind_u16_t> (i); }
Expand Down Expand Up @@ -682,7 +649,6 @@ class mybind_param_t : public mybindable_t {
mybind_param_t (u_char i) { p = New refcounted<mybind_u8_t> (i); }
mybind_param_t (okdatep_t d) { p = New refcounted<mybind_date_t> (d); }
mybind_param_t (const okdate_t &d) { p = New refcounted<mybind_date_t> (d); }
mybind_param_t (sex_t s) { p = New refcounted<mybind_sex_t> (s); }
mybind_param_t (const amysql_scalar_t &x);
mybind_param_t (mysql_var_t v) { p = New refcounted<mybind_var_t> (v); }

Expand Down Expand Up @@ -719,8 +685,6 @@ class mybind_param_t : public mybindable_t {
{ p = New refcounted<mybind_date_t> (d); return (*this); }
mybind_param_t &operator= (const okdate_t &d)
{ p = New refcounted<mybind_date_t> (d); return (*this); }
mybind_param_t &operator= (sex_t s)
{ p = New refcounted<mybind_sex_t> (s); return (*this); }
mybind_param_t &operator= (const x_okdate_t &x)
{ p = New refcounted<mybind_date_t> (x); return (*this); }
mybind_param_t &operator= (const x_okdate_time_t &x)
Expand Down
4 changes: 2 additions & 2 deletions libaok/ok.T
Original file line number Diff line number Diff line change
Expand Up @@ -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<int>(ok_shutdown_timeout_fast)));
}
}

Expand Down
9 changes: 4 additions & 5 deletions libpub/pub3tracer.T
Original file line number Diff line number Diff line change
Expand Up @@ -495,9 +495,8 @@ namespace {
}
};

wrap_res_t wrap(ptr<pub3::expr_t> e,
ref<pub3::pub_tracer_t> tracer,
const bhash<str> &pure_funs) {
wrap_res_t my_wrap(ptr<pub3::expr_t> e, ref<pub3::pub_tracer_t> tracer,
const bhash<str> &pure_funs) {
wrap_res_t res;
res.desc.alloc();
ptr<const pub3::callable_t> c = e->to_callable();
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down
61 changes: 0 additions & 61 deletions libweb/web.C
Original file line number Diff line number Diff line change
Expand Up @@ -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}))?";

Expand Down
5 changes: 0 additions & 5 deletions libweb/web.h
Original file line number Diff line number Diff line change
Expand Up @@ -141,11 +141,6 @@ class okdate_t {

typedef ptr<okdate_t> 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);

Expand Down
6 changes: 0 additions & 6 deletions libweb/web_prot.x
Original file line number Diff line number Diff line change
@@ -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,
Expand Down