[cleanup] fix some warnings

This commit is contained in:
Tim Stack 2023-06-13 13:57:53 -07:00
parent 193fd7d8cc
commit 91730b7c3c
9 changed files with 510 additions and 477 deletions

File diff suppressed because it is too large Load Diff

View File

@ -48,7 +48,7 @@ scrub_to_utf8(char* buffer, size_t length)
if (scan_res.is_valid()) {
break;
}
for (int lpc = 0; lpc < scan_res.usr_faulty_bytes; lpc++) {
for (size_t lpc = 0; lpc < scan_res.usr_faulty_bytes; lpc++) {
buffer[scan_res.usr_valid_end + lpc] = '?';
}
}

View File

@ -170,6 +170,23 @@ curl_request::string_cb(void* data, size_t size, size_t nmemb, void* userp)
return realsize;
}
long
curl_request::complete(CURLcode result)
{
double total_time = 0, download_size = 0, download_speed = 0;
this->cr_completions += 1;
curl_easy_getinfo(this->cr_handle, CURLINFO_TOTAL_TIME, &total_time);
log_debug("%s: total_time=%f", this->cr_name.c_str(), total_time);
curl_easy_getinfo(this->cr_handle, CURLINFO_SIZE_DOWNLOAD, &download_size);
log_debug("%s: download_size=%f", this->cr_name.c_str(), download_size);
curl_easy_getinfo(
this->cr_handle, CURLINFO_SPEED_DOWNLOAD, &download_speed);
log_debug("%s: download_speed=%f", this->cr_name.c_str(), download_speed);
return -1;
}
void
curl_looper::loop_body()
{

View File

@ -96,53 +96,19 @@ public:
virtual ~curl_request() = default;
const std::string& get_name() const
{
return this->cr_name;
}
const std::string& get_name() const { return this->cr_name; }
virtual void close()
{
this->cr_open = false;
}
virtual void close() { this->cr_open = false; }
bool is_open() const
{
return this->cr_open;
}
bool is_open() const { return this->cr_open; }
CURL* get_handle() const
{
return this->cr_handle;
}
CURL* get_handle() const { return this->cr_handle; }
operator CURL*() const
{
return this->cr_handle;
}
operator CURL*() const { return this->cr_handle; }
int get_completions() const
{
return this->cr_completions;
}
int get_completions() const { return this->cr_completions; }
virtual long complete(CURLcode result)
{
double total_time = 0, download_size = 0, download_speed = 0;
this->cr_completions += 1;
curl_easy_getinfo(this->cr_handle, CURLINFO_TOTAL_TIME, &total_time);
log_debug("%s: total_time=%f", this->cr_name.c_str(), total_time);
curl_easy_getinfo(
this->cr_handle, CURLINFO_SIZE_DOWNLOAD, &download_size);
log_debug("%s: download_size=%f", this->cr_name.c_str(), download_size);
curl_easy_getinfo(
this->cr_handle, CURLINFO_SPEED_DOWNLOAD, &download_speed);
log_debug(
"%s: download_speed=%f", this->cr_name.c_str(), download_speed);
return -1;
}
virtual long complete(CURLcode result);
Result<std::string, CURLcode> perform()
{

View File

@ -218,7 +218,7 @@ static const std::vector<std::string> DEFAULT_DB_KEY_NAMES = {
"st_gid",
};
const static size_t MAX_STDIN_CAPTURE_SIZE = 10 * 1024 * 1024;
const static file_ssize_t MAX_STDIN_CAPTURE_SIZE = 10 * 1024 * 1024;
static auto bound_pollable_supervisor
= injector::bind<pollable_supervisor>::to_singleton();

View File

@ -290,7 +290,7 @@ code::replace(string_fragment str, const char* repl) const
if (in_escape) {
if (isdigit(ch)) {
auto capture_index = (ch - '0');
auto capture_index = size_t(ch - '0');
if (capture_index < md.get_count()) {
auto cap = md[capture_index];

View File

@ -104,7 +104,7 @@ public:
template<typename T, std::size_t N>
nonstd::optional<string_fragment> operator[](const T (&name)[N]) const;
int get_count() const { return this->md_capture_end; }
size_t get_count() const { return this->md_capture_end; }
uint32_t get_capacity() const { return this->md_ovector_count; }
@ -126,7 +126,7 @@ private:
input md_input;
PCRE2_SIZE* md_ovector{nullptr};
uint32_t md_ovector_count{0};
int md_capture_end{0};
size_t md_capture_end{0};
};
class matcher {
@ -269,7 +269,8 @@ public:
std::vector<string_fragment> get_captures() const;
uint32_t get_match_data_capacity() const {
uint32_t get_match_data_capacity() const
{
return this->p_match_proto.md_ovector_count;
}

View File

@ -76,7 +76,7 @@ find_re(string_fragment re)
auto pair = cache.insert(
std::make_pair(string_fragment::from_str(c.re2->get_pattern()), c));
for (int lpc = 0; lpc < c.re2->get_capture_count(); lpc++) {
for (size_t lpc = 0; lpc < c.re2->get_capture_count(); lpc++) {
c.cn->add_column(string_fragment::from_c_str(
c.re2->get_name_for_capture(lpc + 1)));
}
@ -141,7 +141,7 @@ regexp_match(string_fragment re, string_fragment str)
} else {
yajlpp_map root_map(gen);
for (int lpc = 0; lpc < extractor.get_capture_count(); lpc++) {
for (size_t lpc = 0; lpc < extractor.get_capture_count(); lpc++) {
const auto& colname = reobj->cn->cn_names[lpc];
const auto cap = md[lpc + 1];

View File

@ -1751,7 +1751,7 @@ __inline__ static void trap_instruction(void)
* Same problem and workaround as Thumb mode */
}
#elif defined(__aarch64__) && defined(__APPLE__)
#define DEBUG_BREAK_IMPL DEBUG_BREAK_USE_BULTIN_DEBUGTRAP
#define DEBUG_BREAK_IMPL DEBUG_BREAK_USE_BULTIN_TRAP
#elif defined(__aarch64__)
#define DEBUG_BREAK_IMPL DEBUG_BREAK_USE_TRAP_INSTRUCTION
__attribute__((always_inline))