[build] fix some issues on 32-bit arch

This commit is contained in:
Timothy Stack 2020-09-23 22:36:47 -07:00
parent a4e6328ff7
commit c3646be987
9 changed files with 21 additions and 23 deletions

View File

@ -45,7 +45,7 @@ public:
void get_columns(std::vector<vtab_column> &cols) const {
cols.emplace_back(this->alv_value_name.get());
cols.emplace_back(this->alv_msg_name.get());
cols.emplace_back(this->alv_schema_name.get(), SQLITE3_TEXT, nullptr, true);
cols.emplace_back(this->alv_schema_name.get(), SQLITE3_TEXT, "", true);
};
void extract(std::shared_ptr<logfile> lf,

View File

@ -89,7 +89,7 @@ public:
dp.parse();
cols.emplace_back("log_msg_instance", SQLITE_INTEGER, nullptr);
cols.emplace_back("log_msg_instance", SQLITE_INTEGER);
for (auto pair_iter = dp.dp_pairs.begin();
pair_iter != dp.dp_pairs.end();
++pair_iter) {
@ -97,7 +97,7 @@ public:
pair_iter->e_sub_elements->front());
std::string colname = cn.add_column(key_str);
int sql_type = SQLITE3_TEXT;
const char *collator = NULL;
std::string collator;
switch (pair_iter->e_sub_elements->back().value_token()) {
case DT_IPV4_ADDRESS:

View File

@ -1487,7 +1487,7 @@ void external_log_format::build(std::vector<std::string> &errors) {
stable_sort(this->elf_level_pairs.begin(), this->elf_level_pairs.end());
for (auto vd : this->elf_value_def_order) {
for (auto &vd : this->elf_value_def_order) {
std::vector<std::string>::iterator act_iter;
if (!vd->vd_internal &&
@ -1874,7 +1874,7 @@ public:
cols[vd->vd_column].vc_name = vd->vd_name.get();
cols[vd->vd_column].vc_type = type_pair.first;
cols[vd->vd_column].vc_subtype = type_pair.second;
cols[vd->vd_column].vc_collator = vd->vd_collate.c_str();
cols[vd->vd_column].vc_collator = vd->vd_collate;
cols[vd->vd_column].vc_comment = vd->vd_description;
}
};

View File

@ -355,20 +355,19 @@ public:
const intern_string_t fd_name;
logline_value::kind_t fd_kind;
bool fd_identifier;
const char *fd_collator;
std::string fd_collator;
int fd_numeric_index;
field_def(const intern_string_t name)
: fd_name(name),
fd_kind(logline_value::VALUE_TEXT),
fd_identifier(false),
fd_collator(nullptr),
fd_numeric_index(-1) {
};
field_def &with_kind(logline_value::kind_t kind,
bool identifier = false,
const char *collator = nullptr) {
const std::string &collator = "") {
this->fd_kind = kind;
this->fd_identifier = identifier;
this->fd_collator = collator;

View File

@ -62,7 +62,7 @@ public:
cols.emplace_back(LOG_MSG_INSTANCE, SQLITE_INTEGER);
for (int lpc = 0; lpc < this->lst_regex.get_capture_count(); lpc++) {
std::vector<pcre_context::capture>::const_iterator iter;
const char *collator = NULL;
std::string collator;
std::string cap_re, colname;
int sqlite_type = SQLITE3_TEXT;
@ -70,7 +70,7 @@ public:
iter = this->lst_regex.cap_begin() + lpc;
cap_re = this->lst_regex_string.substr(iter->c_begin,
iter->length());
sqlite_type = guess_type_from_pcre(cap_re, &collator);
sqlite_type = guess_type_from_pcre(cap_re, collator);
switch (sqlite_type) {
case SQLITE_FLOAT:
this->lst_column_types.push_back(
@ -87,7 +87,7 @@ public:
}
}
colname = cn.add_column(this->lst_regex.name_for_capture(lpc));
cols.push_back(vtab_column(colname, sqlite_type, collator));
cols.emplace_back(colname, sqlite_type, collator);
}
};

View File

@ -114,9 +114,8 @@ std::string log_vtab_impl::get_table_statement()
colname.in(),
type_to_string(iter->vc_type),
iter->vc_hidden ? "hidden" : "",
(iter->vc_collator == NULL ||
iter->vc_collator[0] == '\0') ?
"BINARY" : iter->vc_collator,
iter->vc_collator.empty() ?
"BINARY" : iter->vc_collator.c_str(),
comment.c_str());
oss << coldecl;
}

View File

@ -76,7 +76,7 @@ public:
struct vtab_column {
vtab_column(const std::string name = "",
int type = SQLITE3_TEXT,
const char *collator = NULL,
const std::string collator = "",
bool hidden = false,
const std::string comment = "",
unsigned int subtype = 0)
@ -90,7 +90,7 @@ public:
std::string vc_name;
int vc_type;
const char *vc_collator;
std::string vc_collator;
bool vc_hidden;
std::string vc_comment;
int vc_subtype;

View File

@ -795,22 +795,22 @@ static struct {
const char *collator;
const char *sample;
} TYPE_TEST_VALUE[] = {
{ SQLITE3_TEXT, NULL, "foobar" },
{ SQLITE_INTEGER, NULL, "123" },
{ SQLITE_FLOAT, NULL, "123.0" },
{ SQLITE3_TEXT, "", "foobar" },
{ SQLITE_INTEGER, "", "123" },
{ SQLITE_FLOAT, "", "123.0" },
{ SQLITE_TEXT, "ipaddress", "127.0.0.1" },
{ SQLITE_NULL }
};
int guess_type_from_pcre(const string &pattern, const char **collator)
int guess_type_from_pcre(const string &pattern, std::string &collator)
{
try {
pcrepp re(pattern.c_str());
vector<int> matches;
int retval = SQLITE3_TEXT;
*collator = NULL;
collator.clear();
for (int lpc = 0; TYPE_TEST_VALUE[lpc].sqlite_type != SQLITE_NULL; lpc++) {
pcre_context_static<30> pc;
pcre_input pi(TYPE_TEST_VALUE[lpc].sample);
@ -823,7 +823,7 @@ int guess_type_from_pcre(const string &pattern, const char **collator)
if (matches.size() == 1) {
retval = TYPE_TEST_VALUE[matches.front()].sqlite_type;
*collator = TYPE_TEST_VALUE[matches.front()].collator;
collator = TYPE_TEST_VALUE[matches.front()].collator;
}
return retval;

View File

@ -99,7 +99,7 @@ void sql_execute_script(sqlite3 *db,
const char *script,
std::vector<std::string> &errors);
int guess_type_from_pcre(const std::string &pattern, const char **collator);
int guess_type_from_pcre(const std::string &pattern, std::string &collator);
/* XXX figure out how to do this with the template */
void sqlite_close_wrapper(void *mem);