mirror of
https://github.com/tstack/lnav
synced 2024-11-01 21:40:34 +00:00
[build] fix some issues on 32-bit arch
This commit is contained in:
parent
a4e6328ff7
commit
c3646be987
@ -45,7 +45,7 @@ public:
|
|||||||
void get_columns(std::vector<vtab_column> &cols) const {
|
void get_columns(std::vector<vtab_column> &cols) const {
|
||||||
cols.emplace_back(this->alv_value_name.get());
|
cols.emplace_back(this->alv_value_name.get());
|
||||||
cols.emplace_back(this->alv_msg_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,
|
void extract(std::shared_ptr<logfile> lf,
|
||||||
|
@ -89,7 +89,7 @@ public:
|
|||||||
|
|
||||||
dp.parse();
|
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();
|
for (auto pair_iter = dp.dp_pairs.begin();
|
||||||
pair_iter != dp.dp_pairs.end();
|
pair_iter != dp.dp_pairs.end();
|
||||||
++pair_iter) {
|
++pair_iter) {
|
||||||
@ -97,7 +97,7 @@ public:
|
|||||||
pair_iter->e_sub_elements->front());
|
pair_iter->e_sub_elements->front());
|
||||||
std::string colname = cn.add_column(key_str);
|
std::string colname = cn.add_column(key_str);
|
||||||
int sql_type = SQLITE3_TEXT;
|
int sql_type = SQLITE3_TEXT;
|
||||||
const char *collator = NULL;
|
std::string collator;
|
||||||
|
|
||||||
switch (pair_iter->e_sub_elements->back().value_token()) {
|
switch (pair_iter->e_sub_elements->back().value_token()) {
|
||||||
case DT_IPV4_ADDRESS:
|
case DT_IPV4_ADDRESS:
|
||||||
|
@ -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());
|
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;
|
std::vector<std::string>::iterator act_iter;
|
||||||
|
|
||||||
if (!vd->vd_internal &&
|
if (!vd->vd_internal &&
|
||||||
@ -1874,7 +1874,7 @@ public:
|
|||||||
cols[vd->vd_column].vc_name = vd->vd_name.get();
|
cols[vd->vd_column].vc_name = vd->vd_name.get();
|
||||||
cols[vd->vd_column].vc_type = type_pair.first;
|
cols[vd->vd_column].vc_type = type_pair.first;
|
||||||
cols[vd->vd_column].vc_subtype = type_pair.second;
|
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;
|
cols[vd->vd_column].vc_comment = vd->vd_description;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -355,20 +355,19 @@ public:
|
|||||||
const intern_string_t fd_name;
|
const intern_string_t fd_name;
|
||||||
logline_value::kind_t fd_kind;
|
logline_value::kind_t fd_kind;
|
||||||
bool fd_identifier;
|
bool fd_identifier;
|
||||||
const char *fd_collator;
|
std::string fd_collator;
|
||||||
int fd_numeric_index;
|
int fd_numeric_index;
|
||||||
|
|
||||||
field_def(const intern_string_t name)
|
field_def(const intern_string_t name)
|
||||||
: fd_name(name),
|
: fd_name(name),
|
||||||
fd_kind(logline_value::VALUE_TEXT),
|
fd_kind(logline_value::VALUE_TEXT),
|
||||||
fd_identifier(false),
|
fd_identifier(false),
|
||||||
fd_collator(nullptr),
|
|
||||||
fd_numeric_index(-1) {
|
fd_numeric_index(-1) {
|
||||||
};
|
};
|
||||||
|
|
||||||
field_def &with_kind(logline_value::kind_t kind,
|
field_def &with_kind(logline_value::kind_t kind,
|
||||||
bool identifier = false,
|
bool identifier = false,
|
||||||
const char *collator = nullptr) {
|
const std::string &collator = "") {
|
||||||
this->fd_kind = kind;
|
this->fd_kind = kind;
|
||||||
this->fd_identifier = identifier;
|
this->fd_identifier = identifier;
|
||||||
this->fd_collator = collator;
|
this->fd_collator = collator;
|
||||||
|
@ -62,7 +62,7 @@ public:
|
|||||||
cols.emplace_back(LOG_MSG_INSTANCE, SQLITE_INTEGER);
|
cols.emplace_back(LOG_MSG_INSTANCE, SQLITE_INTEGER);
|
||||||
for (int lpc = 0; lpc < this->lst_regex.get_capture_count(); lpc++) {
|
for (int lpc = 0; lpc < this->lst_regex.get_capture_count(); lpc++) {
|
||||||
std::vector<pcre_context::capture>::const_iterator iter;
|
std::vector<pcre_context::capture>::const_iterator iter;
|
||||||
const char *collator = NULL;
|
std::string collator;
|
||||||
std::string cap_re, colname;
|
std::string cap_re, colname;
|
||||||
int sqlite_type = SQLITE3_TEXT;
|
int sqlite_type = SQLITE3_TEXT;
|
||||||
|
|
||||||
@ -70,7 +70,7 @@ public:
|
|||||||
iter = this->lst_regex.cap_begin() + lpc;
|
iter = this->lst_regex.cap_begin() + lpc;
|
||||||
cap_re = this->lst_regex_string.substr(iter->c_begin,
|
cap_re = this->lst_regex_string.substr(iter->c_begin,
|
||||||
iter->length());
|
iter->length());
|
||||||
sqlite_type = guess_type_from_pcre(cap_re, &collator);
|
sqlite_type = guess_type_from_pcre(cap_re, collator);
|
||||||
switch (sqlite_type) {
|
switch (sqlite_type) {
|
||||||
case SQLITE_FLOAT:
|
case SQLITE_FLOAT:
|
||||||
this->lst_column_types.push_back(
|
this->lst_column_types.push_back(
|
||||||
@ -87,7 +87,7 @@ public:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
colname = cn.add_column(this->lst_regex.name_for_capture(lpc));
|
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);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -114,9 +114,8 @@ std::string log_vtab_impl::get_table_statement()
|
|||||||
colname.in(),
|
colname.in(),
|
||||||
type_to_string(iter->vc_type),
|
type_to_string(iter->vc_type),
|
||||||
iter->vc_hidden ? "hidden" : "",
|
iter->vc_hidden ? "hidden" : "",
|
||||||
(iter->vc_collator == NULL ||
|
iter->vc_collator.empty() ?
|
||||||
iter->vc_collator[0] == '\0') ?
|
"BINARY" : iter->vc_collator.c_str(),
|
||||||
"BINARY" : iter->vc_collator,
|
|
||||||
comment.c_str());
|
comment.c_str());
|
||||||
oss << coldecl;
|
oss << coldecl;
|
||||||
}
|
}
|
||||||
|
@ -76,7 +76,7 @@ public:
|
|||||||
struct vtab_column {
|
struct vtab_column {
|
||||||
vtab_column(const std::string name = "",
|
vtab_column(const std::string name = "",
|
||||||
int type = SQLITE3_TEXT,
|
int type = SQLITE3_TEXT,
|
||||||
const char *collator = NULL,
|
const std::string collator = "",
|
||||||
bool hidden = false,
|
bool hidden = false,
|
||||||
const std::string comment = "",
|
const std::string comment = "",
|
||||||
unsigned int subtype = 0)
|
unsigned int subtype = 0)
|
||||||
@ -90,7 +90,7 @@ public:
|
|||||||
|
|
||||||
std::string vc_name;
|
std::string vc_name;
|
||||||
int vc_type;
|
int vc_type;
|
||||||
const char *vc_collator;
|
std::string vc_collator;
|
||||||
bool vc_hidden;
|
bool vc_hidden;
|
||||||
std::string vc_comment;
|
std::string vc_comment;
|
||||||
int vc_subtype;
|
int vc_subtype;
|
||||||
|
@ -795,22 +795,22 @@ static struct {
|
|||||||
const char *collator;
|
const char *collator;
|
||||||
const char *sample;
|
const char *sample;
|
||||||
} TYPE_TEST_VALUE[] = {
|
} TYPE_TEST_VALUE[] = {
|
||||||
{ SQLITE3_TEXT, NULL, "foobar" },
|
{ SQLITE3_TEXT, "", "foobar" },
|
||||||
{ SQLITE_INTEGER, NULL, "123" },
|
{ SQLITE_INTEGER, "", "123" },
|
||||||
{ SQLITE_FLOAT, NULL, "123.0" },
|
{ SQLITE_FLOAT, "", "123.0" },
|
||||||
{ SQLITE_TEXT, "ipaddress", "127.0.0.1" },
|
{ SQLITE_TEXT, "ipaddress", "127.0.0.1" },
|
||||||
|
|
||||||
{ SQLITE_NULL }
|
{ 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 {
|
try {
|
||||||
pcrepp re(pattern.c_str());
|
pcrepp re(pattern.c_str());
|
||||||
vector<int> matches;
|
vector<int> matches;
|
||||||
int retval = SQLITE3_TEXT;
|
int retval = SQLITE3_TEXT;
|
||||||
|
|
||||||
*collator = NULL;
|
collator.clear();
|
||||||
for (int lpc = 0; TYPE_TEST_VALUE[lpc].sqlite_type != SQLITE_NULL; lpc++) {
|
for (int lpc = 0; TYPE_TEST_VALUE[lpc].sqlite_type != SQLITE_NULL; lpc++) {
|
||||||
pcre_context_static<30> pc;
|
pcre_context_static<30> pc;
|
||||||
pcre_input pi(TYPE_TEST_VALUE[lpc].sample);
|
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) {
|
if (matches.size() == 1) {
|
||||||
retval = TYPE_TEST_VALUE[matches.front()].sqlite_type;
|
retval = TYPE_TEST_VALUE[matches.front()].sqlite_type;
|
||||||
*collator = TYPE_TEST_VALUE[matches.front()].collator;
|
collator = TYPE_TEST_VALUE[matches.front()].collator;
|
||||||
}
|
}
|
||||||
|
|
||||||
return retval;
|
return retval;
|
||||||
|
@ -99,7 +99,7 @@ void sql_execute_script(sqlite3 *db,
|
|||||||
const char *script,
|
const char *script,
|
||||||
std::vector<std::string> &errors);
|
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 */
|
/* XXX figure out how to do this with the template */
|
||||||
void sqlite_close_wrapper(void *mem);
|
void sqlite_close_wrapper(void *mem);
|
||||||
|
Loading…
Reference in New Issue
Block a user