Skip to content

Commit

Permalink
explicitly cast to long long int
Browse files Browse the repository at this point in the history
  • Loading branch information
DavZim committed Jan 11, 2024
1 parent 74e402f commit 228ec1e
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 6 deletions.
3 changes: 2 additions & 1 deletion cran-comments.md
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
fix failing test where printf was used with a wrong format specifier, also limit data.table to 2 cores
limit data.table to run on 2 cores only (only applies to code examples as tests were already limited to 2 cores).
Also, fix types used in printf.
8 changes: 4 additions & 4 deletions src/filter_itch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -164,10 +164,10 @@ void filter_itch_impl(std::string infile, std::string outfile,
}

if (!quiet) {
Rprintf("[Bytes] scanned " PRId64 ", filtered " PRId64 "\n",
filesize, bytes_written + o);
Rprintf("[Messages] scanned " PRId64 ", filtered " PRId64 "\n",
msg_count, msg_read);
Rprintf("[Bytes] scanned %lld, filtered %lld\n",
(long long int) filesize, (long long int) bytes_written + o);
Rprintf("[Messages] scanned %lld, filtered %lld\n",
(long long int) msg_count, (long long int) msg_read);
}

free(ibuf);
Expand Down
4 changes: 3 additions & 1 deletion src/helper_functions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,9 @@ uint64_t set8bytes(unsigned char* b, int64_t val) {
// i.e., "UFO" with 8 to 0x55534f2020202020 (filled with whitespaces)
uint64_t setCharBytes(unsigned char* b, std::string x, uint64_t n) {
unsigned char *st = new unsigned char[n + 1];
if (x.size() > n) Rprintf("ERROR: setChar Bytes for string '%s' larger than capacity " PRIu64 "\n", x.c_str(), n);
if (x.size() > n)
Rprintf("ERROR: setChar Bytes for string '%s' larger than capacity %lud\n",
x.c_str(), (long long unsigned int) n);
for (uint64_t j = 0; j < n; j++) st[j] = ' '; // fill with n spaces
for (uint64_t j = 0; j < x.size(); j++) st[j] = x[j]; // copy the string x
memcpy(b, st, n);
Expand Down

0 comments on commit 228ec1e

Please sign in to comment.