From 0559a98f91120f020f600aa8e52881f54b6e62ff Mon Sep 17 00:00:00 2001 From: Adam Spiers Date: Sun, 20 Nov 2016 12:19:31 +0000 Subject: [PATCH 01/10] fix -Wsign-compare warnings (#369) Fix repeated errors like this: log_format.hh:1138:27: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] if (len < jfe.jfe_min_width) { Fixes #369. https://github.com/tstack/lnav/issues/369 --- src/log_format.hh | 4 ++-- src/yajlpp.hh | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/log_format.hh b/src/log_format.hh index e27a341d..c3cfc892 100644 --- a/src/log_format.hh +++ b/src/log_format.hh @@ -1018,8 +1018,8 @@ public: json_log_field jfe_type; intern_string_t jfe_value; std::string jfe_default_value; - long long jfe_min_width; - long long jfe_max_width; + unsigned long long jfe_min_width; + unsigned long long jfe_max_width; align_t jfe_align; overflow_t jfe_overflow; std::string jfe_ts_format; diff --git a/src/yajlpp.hh b/src/yajlpp.hh index 957fa6e5..c2e871e9 100644 --- a/src/yajlpp.hh +++ b/src/yajlpp.hh @@ -273,7 +273,7 @@ struct json_path_handler : public json_path_handler_base { return *this; }; - json_path_handler &for_field(long long *field) { + json_path_handler &for_field(unsigned long long *field) { this->add_cb(yajlpp_static_number); this->jph_simple_offset = field; this->jph_validator = yajlpp_validator_for_int; From 43ac6366cb5e99a2a86059cbdac1411c254f3aff Mon Sep 17 00:00:00 2001 From: Adam Spiers Date: Sun, 20 Nov 2016 12:22:10 +0000 Subject: [PATCH 02/10] fix -Wformat time_t warnings (#368) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fix warnings like: ptimec.hh: In function ‘void ftime_i(char*, off_t&, ssize_t, const exttm&)’: ptimec.hh:387:57: warning: format ‘%lld’ expects argument of type ‘long long int’, but argument 4 has type ‘uint64_t {aka long unsigned int}’ [-Wformat=] snprintf(&dst[off_inout], len - off_inout, "%lld", t); ^ In this case we know that the `t` returned by `tm2sec` is a number of seconds, so a long should be long enough, and anyway there is already code checking for overflow. Fixes #368. https://github.com/tstack/lnav/issues/368 --- src/lnav_util.cc | 10 +++++----- src/ptimec.hh | 4 ++-- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/lnav_util.cc b/src/lnav_util.cc index abbc1163..05069ca0 100644 --- a/src/lnav_util.cc +++ b/src/lnav_util.cc @@ -319,7 +319,7 @@ static time_t BAD_DATE = -1; time_t tm2sec(const struct tm *t) { int year; - time_t days; + time_t days, secs; const int dayoffset[12] = { 306, 337, 0, 31, 61, 92, 122, 153, 184, 214, 245, 275 }; @@ -341,18 +341,18 @@ time_t tm2sec(const struct tm *t) days += dayoffset[t->tm_mon] + t->tm_mday - 1; days -= 25508; /* 1 jan 1970 is 25508 days since 1 mar 1900 */ - days = ((days * 24 + t->tm_hour) * 60 + t->tm_min) * 60 + t->tm_sec; + secs = ((days * 24 + t->tm_hour) * 60 + t->tm_min) * 60 + t->tm_sec; - if (days < 0) { + if (secs < 0) { return BAD_DATE; } /* must have overflowed */ else { #ifdef HAVE_STRUCT_TM_TM_ZONE if (t->tm_zone) { - days -= t->tm_gmtoff; + secs -= t->tm_gmtoff; } #endif - return days; + return secs; } /* must be a valid time */ } diff --git a/src/ptimec.hh b/src/ptimec.hh index 683f0714..6c7f5d88 100644 --- a/src/ptimec.hh +++ b/src/ptimec.hh @@ -381,10 +381,10 @@ inline bool ptime_i(struct exttm *dst, const char *str, off_t &off_inout, ssize_ inline void ftime_i(char *dst, off_t &off_inout, ssize_t len, const struct exttm &tm) { - uint64_t t = tm2sec(&tm.et_tm); + time_t t = tm2sec(&tm.et_tm); t += tm.et_nsec / 1000000; - snprintf(&dst[off_inout], len - off_inout, "%lld", t); + snprintf(&dst[off_inout], len - off_inout, "%ld", t); off_inout = strlen(dst); } From 79882007019a23d30f07e344477acae48d5193bd Mon Sep 17 00:00:00 2001 From: Adam Spiers Date: Sun, 20 Nov 2016 12:21:12 +0000 Subject: [PATCH 03/10] fix -Wunused-result warnings when calling asprintf() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fix these warnings: papertrail_proc.hh: In constructor ‘papertrail_proc::papertrail_proc(const string&, time_t, time_t)’: papertrail_proc.hh:107:36: warning: ignoring return value of ‘int asprintf(char**, const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result] this->ptp_api_key); ^ papertrail_proc.hh: In member function ‘void papertrail_proc::set_url()’: papertrail_proc.hh:146:47: warning: ignoring return value of ‘int asprintf(char**, const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result] this->ptp_quoted_search.in()); --- src/papertrail_proc.hh | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/src/papertrail_proc.hh b/src/papertrail_proc.hh index ecaa383a..613383ea 100644 --- a/src/papertrail_proc.hh +++ b/src/papertrail_proc.hh @@ -102,9 +102,11 @@ public: this->ptp_search.c_str(), this->ptp_search.size()); - asprintf(this->ptp_token_header.out(), - "X-Papertrail-Token: %s", - this->ptp_api_key); + if (asprintf(this->ptp_token_header.out(), + "X-Papertrail-Token: %s", + this->ptp_api_key) == -1) { + perror("Failed to allocate X-Papertrail-Token string"); + } this->ptp_header_list = curl_slist_append(this->ptp_header_list, this->ptp_token_header.in()); @@ -140,10 +142,12 @@ public: "max_time=%ld&", this->ptp_max_time); } - asprintf(this->ptp_url.out(), - "%sq=%s", - base_url, - this->ptp_quoted_search.in()); + if (asprintf(this->ptp_url.out(), + "%sq=%s", + base_url, + this->ptp_quoted_search.in()) == -1) { + perror("Failed to allocate ptp_url"); + } curl_easy_setopt(this->cr_handle, CURLOPT_URL, this->ptp_url.in()); }; From 2aebf4f3818e36b15d93d168379bba7e7adc2062 Mon Sep 17 00:00:00 2001 From: Adam Spiers Date: Sun, 20 Nov 2016 12:21:12 +0000 Subject: [PATCH 04/10] fix -Wunused-result warnings when calling write() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fix these warnings: papertrail_proc.hh: In constructor ‘papertrail_proc::papertrail_proc(const string&, time_t, time_t)’: papertrail_proc.hh:107:36: warning: ignoring return value of ‘int asprintf(char**, const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result] this->ptp_api_key); ^ papertrail_proc.hh: In member function ‘void papertrail_proc::set_url()’: papertrail_proc.hh:146:47: warning: ignoring return value of ‘int asprintf(char**, const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result] this->ptp_quoted_search.in()); --- src/url_loader.hh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/url_loader.hh b/src/url_loader.hh index da8c148f..204cf4da 100644 --- a/src/url_loader.hh +++ b/src/url_loader.hh @@ -76,7 +76,10 @@ public: default: log_error("%s:curl failure -- %ld %s", this->cr_name.c_str(), result, curl_easy_strerror(result)); - write(this->ul_fd, this->cr_error_buffer, strlen(this->cr_error_buffer)); + if (write(this->ul_fd, this->cr_error_buffer, + strlen(this->cr_error_buffer)) == -1) { + perror("curl failure: write failure"); + } return -1; } From 961cac8ec07e090ea95b3de3597aa580c3f0dcb6 Mon Sep 17 00:00:00 2001 From: Adam Spiers Date: Sun, 20 Nov 2016 12:48:07 +0000 Subject: [PATCH 05/10] fix sscanf %qd type mismatch warning MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixes this warning: relative_time.cc: In member function ‘bool relative_time::parse(const char*, size_t, relative_time::parse_error&)’: relative_time.cc:222:62: warning: format ‘%qd’ expects argument of type ‘long long int*’, but argument 3 has type ‘int64_t* {aka long int*}’ [-Wformat=] if (sscanf(numstr.c_str(), "%qd", &number) != 1) { ^ --- src/relative_time.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/relative_time.cc b/src/relative_time.cc index 813028b6..05808430 100644 --- a/src/relative_time.cc +++ b/src/relative_time.cc @@ -219,7 +219,7 @@ bool relative_time::parse(const char *str, size_t len, struct parse_error &pe_ou string numstr = pi.get_substr(pc[0]); - if (sscanf(numstr.c_str(), "%qd", &number) != 1) { + if (sscanf(numstr.c_str(), "%ld", &number) != 1) { pe_out.pe_msg = "Invalid number: " + numstr; return false; } From dc500774a8e269df0e161ca61059d70b7d56cf57 Mon Sep 17 00:00:00 2001 From: Adam Spiers Date: Sun, 20 Nov 2016 12:49:21 +0000 Subject: [PATCH 06/10] fix -Wsign-compare warnings in lnav_commands.cc MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixes these warnings: lnav_commands.cc: In function ‘std::string remaining_args(const string&, const std::vector >&, size_t)’: lnav_commands.cc:67:29: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] for (int lpc = 0; lpc < index; lpc++) { ^ lnav_commands.cc: In function ‘std::string com_save_to(std::string, std::vector >&)’: lnav_commands.cc:574:53: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] for (int lpc = 0; lpc < dls.text_line_count(); lpc++) { --- src/lnav_commands.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/lnav_commands.cc b/src/lnav_commands.cc index 43b0bb0b..70502ee9 100644 --- a/src/lnav_commands.cc +++ b/src/lnav_commands.cc @@ -64,7 +64,7 @@ static string remaining_args(const string &cmdline, require(index > 0); - for (int lpc = 0; lpc < index; lpc++) { + for (unsigned int lpc = 0; lpc < index; lpc++) { start_pos += args[lpc].length(); } @@ -571,7 +571,7 @@ static string com_save_to(string cmdline, vector &args) dos.list_value_for_overlay(lnav_data.ld_views[LNV_DB], vis_line_t(0), header_line); fputs(header_line.get_string().c_str(), outfile); fputc('\n', outfile); - for (int lpc = 0; lpc < dls.text_line_count(); lpc++) { + for (unsigned int lpc = 0; lpc < dls.text_line_count(); lpc++) { string line; dls.text_value_for_line(lnav_data.ld_views[LNV_DB], lpc, line, true); From 04627c174388b5a66d083d611c39fdc2737f8aa2 Mon Sep 17 00:00:00 2001 From: Adam Spiers Date: Sun, 20 Nov 2016 12:55:41 +0000 Subject: [PATCH 07/10] fix -Wunused-result warnings when calling read() and write() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fix warnings like these: lnav.cc: In function ‘int main(int, char**)’: lnav.cc:2407:33: warning: ignoring return value of ‘int system(const char*)’, declared with attribute warn_unused_result [-Wunused-result] system(pull_cmd); ^ lnav.cc:2966:66: warning: ignoring return value of ‘ssize_t write(int, const void*, size_t)’, declared with attribute warn_unused_result [-Wunused-result] write(STDOUT_FILENO, str.c_str(), str.size()); ^ lnav.cc:2967:50: warning: ignoring return value of ‘ssize_t write(int, const void*, size_t)’, declared with attribute warn_unused_result [-Wunused-result] write(STDOUT_FILENO, "\n", 1); ^ --- src/lnav.cc | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/src/lnav.cc b/src/lnav.cc index 7ae45124..6c80b054 100644 --- a/src/lnav.cc +++ b/src/lnav.cc @@ -2355,7 +2355,9 @@ int main(int argc, char *argv[]) case 'W': { char b; - read(STDIN_FILENO, &b, 1); + if (read(STDIN_FILENO, &b, 1) == -1) { + perror("Read key from STDIN"); + } } break; @@ -2886,8 +2888,11 @@ int main(int argc, char *argv[]) ++vl, ++y) { while (los != NULL && los->list_value_for_overlay(*tc, y, al)) { - write(STDOUT_FILENO, line.c_str(), line.length()); - write(STDOUT_FILENO, "\n", 1); + if (write(STDOUT_FILENO, line.c_str(), + line.length()) == -1 or + write(STDOUT_FILENO, "\n", 1) == -1) { + perror("write to STDOUT"); + } ++y; } @@ -2898,9 +2903,11 @@ int main(int argc, char *argv[]) struct line_range lr = find_string_attr_range( al.get_attrs(), &textview_curses::SA_ORIGINAL_LINE); - write(STDOUT_FILENO, lr.substr(al.get_string()), - lr.sublen(al.get_string())); - write(STDOUT_FILENO, "\n", 1); + if (write(STDOUT_FILENO, lr.substr(al.get_string()), + lr.sublen(al.get_string())) == -1 or + write(STDOUT_FILENO, "\n", 1) == -1) { + perror("write to STDOUT"); + } } } } @@ -2956,8 +2963,10 @@ int main(int argc, char *argv[]) ++line_iter) { lf->read_line(line_iter, str); - write(STDOUT_FILENO, str.c_str(), str.size()); - write(STDOUT_FILENO, "\n", 1); + if (write(STDOUT_FILENO, str.c_str(), str.size()) == -1 or + write(STDOUT_FILENO, "\n", 1) == -1) { + perror("write to STDOUT"); + } } } } From 81f5a843cf2fcd9f61886af3eb903e08f7d52f97 Mon Sep 17 00:00:00 2001 From: Adam Spiers Date: Sun, 20 Nov 2016 13:04:18 +0000 Subject: [PATCH 08/10] check return value of git pull command MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This is obviously worthwhile, but also eliminates this compiler warning: lnav.cc: In function ‘int main(int, char**)’: lnav.cc:2407:33: warning: ignoring return value of ‘int system(const char*)’, declared with attribute warn_unused_result [-Wunused-result] system(pull_cmd); ^ --- src/lnav.cc | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/lnav.cc b/src/lnav.cc index 6c80b054..33ca6acc 100644 --- a/src/lnav.cc +++ b/src/lnav.cc @@ -2404,7 +2404,17 @@ int main(int argc, char *argv[]) snprintf(pull_cmd, sizeof(pull_cmd), "cd %s && git pull", git_dir); - system(pull_cmd); + int ret = system(pull_cmd); + if (ret == -1) { + std::cerr << "Failed to spawn command " + << "\"" << pull_cmd << "\": " + << strerror(errno) << std::endl; + } + else if (ret > 0) { + std::cerr << "Command " + << "\"" << pull_cmd << "\" failed: " + << strerror(errno) << std::endl; + } found = true; } } From fb96e948e273cba8fe5121cc7fee19660d456a03 Mon Sep 17 00:00:00 2001 From: Adam Spiers Date: Sun, 20 Nov 2016 13:08:58 +0000 Subject: [PATCH 09/10] fix -Wunused-result warning when calling getcwd() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fix this warning: lnav_log.cc: In function ‘void log_host_info()’: lnav_log.cc:185:29: warning: ignoring return value of ‘char* getcwd(char*, size_t)’, declared with attribute warn_unused_result [-Wunused-result] getcwd(cwd, sizeof(cwd)); ^ --- src/lnav_log.cc | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/lnav_log.cc b/src/lnav_log.cc index 1f9bf059..c26358e6 100644 --- a/src/lnav_log.cc +++ b/src/lnav_log.cc @@ -182,8 +182,12 @@ void log_host_info(void) log_info(" gid=%d", getgid()); log_info(" euid=%d", geteuid()); log_info(" egid=%d", getegid()); - getcwd(cwd, sizeof(cwd)); - log_info(" cwd=%s", cwd); + if (getcwd(cwd, sizeof(cwd)) == NULL) { + log_info(" ERROR: getcwd failed"); + } + else { + log_info(" cwd=%s", cwd); + } log_info("Executable:"); log_info(" version=%s", VCS_PACKAGE_STRING); From d799cc227e5d0909d9e00f95a460d250b0419fa8 Mon Sep 17 00:00:00 2001 From: Timothy Stack Date: Sat, 17 Dec 2016 21:13:38 -0800 Subject: [PATCH 10/10] some tweaks to these changes --- src/lnav.cc | 6 +++--- src/lnav_commands.cc | 4 ++-- src/log_format.hh | 4 ++-- src/papertrail_proc.hh | 18 +++++++----------- src/ptimec.hh | 5 +++-- src/relative_time.cc | 2 +- src/url_loader.hh | 6 ++---- src/yajlpp.hh | 2 +- test/test_json_format.sh | 1 - 9 files changed, 21 insertions(+), 27 deletions(-) diff --git a/src/lnav.cc b/src/lnav.cc index 19443511..9d0e954b 100644 --- a/src/lnav.cc +++ b/src/lnav.cc @@ -3013,7 +3013,7 @@ int main(int argc, char *argv[]) while (los != NULL && los->list_value_for_overlay(*tc, y, al)) { if (write(STDOUT_FILENO, line.c_str(), - line.length()) == -1 or + line.length()) == -1 || write(STDOUT_FILENO, "\n", 1) == -1) { perror("write to STDOUT"); } @@ -3028,7 +3028,7 @@ int main(int argc, char *argv[]) struct line_range lr = find_string_attr_range( al.get_attrs(), &textview_curses::SA_ORIGINAL_LINE); if (write(STDOUT_FILENO, lr.substr(al.get_string()), - lr.sublen(al.get_string())) == -1 or + lr.sublen(al.get_string())) == -1 || write(STDOUT_FILENO, "\n", 1) == -1) { perror("write to STDOUT"); } @@ -3087,7 +3087,7 @@ int main(int argc, char *argv[]) ++line_iter) { lf->read_line(line_iter, str); - if (write(STDOUT_FILENO, str.c_str(), str.size()) == -1 or + if (write(STDOUT_FILENO, str.c_str(), str.size()) == -1 || write(STDOUT_FILENO, "\n", 1) == -1) { perror("write to STDOUT"); } diff --git a/src/lnav_commands.cc b/src/lnav_commands.cc index 2958e192..99df3fe0 100644 --- a/src/lnav_commands.cc +++ b/src/lnav_commands.cc @@ -64,7 +64,7 @@ static string remaining_args(const string &cmdline, require(index > 0); - for (unsigned int lpc = 0; lpc < index; lpc++) { + for (size_t lpc = 0; lpc < index; lpc++) { start_pos += args[lpc].length(); } @@ -571,7 +571,7 @@ static string com_save_to(exec_context &ec, string cmdline, vector &args dos.list_value_for_overlay(lnav_data.ld_views[LNV_DB], vis_line_t(0), header_line); fputs(header_line.get_string().c_str(), outfile); fputc('\n', outfile); - for (unsigned int lpc = 0; lpc < dls.text_line_count(); lpc++) { + for (size_t lpc = 0; lpc < dls.text_line_count(); lpc++) { string line; dls.text_value_for_line(lnav_data.ld_views[LNV_DB], lpc, line, true); diff --git a/src/log_format.hh b/src/log_format.hh index 3c1ddbdb..e2daeb9f 100644 --- a/src/log_format.hh +++ b/src/log_format.hh @@ -1065,8 +1065,8 @@ public: json_log_field jfe_type; intern_string_t jfe_value; std::string jfe_default_value; - unsigned long long jfe_min_width; - unsigned long long jfe_max_width; + long long jfe_min_width; + long long jfe_max_width; align_t jfe_align; overflow_t jfe_overflow; std::string jfe_ts_format; diff --git a/src/papertrail_proc.hh b/src/papertrail_proc.hh index 613383ea..63a96398 100644 --- a/src/papertrail_proc.hh +++ b/src/papertrail_proc.hh @@ -102,11 +102,9 @@ public: this->ptp_search.c_str(), this->ptp_search.size()); - if (asprintf(this->ptp_token_header.out(), - "X-Papertrail-Token: %s", - this->ptp_api_key) == -1) { - perror("Failed to allocate X-Papertrail-Token string"); - } + log_perror(asprintf(this->ptp_token_header.out(), + "X-Papertrail-Token: %s", + this->ptp_api_key)); this->ptp_header_list = curl_slist_append(this->ptp_header_list, this->ptp_token_header.in()); @@ -142,12 +140,10 @@ public: "max_time=%ld&", this->ptp_max_time); } - if (asprintf(this->ptp_url.out(), - "%sq=%s", - base_url, - this->ptp_quoted_search.in()) == -1) { - perror("Failed to allocate ptp_url"); - } + log_perror(asprintf(this->ptp_url.out(), + "%sq=%s", + base_url, + this->ptp_quoted_search.in())); curl_easy_setopt(this->cr_handle, CURLOPT_URL, this->ptp_url.in()); }; diff --git a/src/ptimec.hh b/src/ptimec.hh index 6c7f5d88..2593818f 100644 --- a/src/ptimec.hh +++ b/src/ptimec.hh @@ -38,6 +38,7 @@ #include #include #include +#include #include #include @@ -381,10 +382,10 @@ inline bool ptime_i(struct exttm *dst, const char *str, off_t &off_inout, ssize_ inline void ftime_i(char *dst, off_t &off_inout, ssize_t len, const struct exttm &tm) { - time_t t = tm2sec(&tm.et_tm); + int64_t t = tm2sec(&tm.et_tm); t += tm.et_nsec / 1000000; - snprintf(&dst[off_inout], len - off_inout, "%ld", t); + snprintf(&dst[off_inout], len - off_inout, "%" PRId64, t); off_inout = strlen(dst); } diff --git a/src/relative_time.cc b/src/relative_time.cc index 05808430..8c04a121 100644 --- a/src/relative_time.cc +++ b/src/relative_time.cc @@ -219,7 +219,7 @@ bool relative_time::parse(const char *str, size_t len, struct parse_error &pe_ou string numstr = pi.get_substr(pc[0]); - if (sscanf(numstr.c_str(), "%ld", &number) != 1) { + if (sscanf(numstr.c_str(), "%" PRId64, &number) != 1) { pe_out.pe_msg = "Invalid number: " + numstr; return false; } diff --git a/src/url_loader.hh b/src/url_loader.hh index 204cf4da..6a779031 100644 --- a/src/url_loader.hh +++ b/src/url_loader.hh @@ -76,10 +76,8 @@ public: default: log_error("%s:curl failure -- %ld %s", this->cr_name.c_str(), result, curl_easy_strerror(result)); - if (write(this->ul_fd, this->cr_error_buffer, - strlen(this->cr_error_buffer)) == -1) { - perror("curl failure: write failure"); - } + log_perror(write(this->ul_fd, this->cr_error_buffer, + strlen(this->cr_error_buffer))); return -1; } diff --git a/src/yajlpp.hh b/src/yajlpp.hh index 398de095..668b7aea 100644 --- a/src/yajlpp.hh +++ b/src/yajlpp.hh @@ -284,7 +284,7 @@ struct json_path_handler : public json_path_handler_base { return *this; }; - json_path_handler &for_field(unsigned long long *field) { + json_path_handler &for_field(long long *field) { this->add_cb(yajlpp_static_number); this->jph_simple_offset = field; this->jph_validator = yajlpp_validator_for_int; diff --git a/test/test_json_format.sh b/test/test_json_format.sh index f492c2f3..bd0dc4d7 100644 --- a/test/test_json_format.sh +++ b/test/test_json_format.sh @@ -100,7 +100,6 @@ Caused by: java.lang.ClassNotFoundException: javax.el.StaticFieldELResolver at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1720) at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1571) ... 33 common frames omitted - @version: 1 logger_name: org.apache.jasper.runtime.JspFactoryImpl thread_name: http-bio-0.0.0.0-8081-exec-198