Skip to content

Commit

Permalink
fix Debian segfault when writing to user library; bump to 0.1.25
Browse files Browse the repository at this point in the history
  • Loading branch information
DavZim committed Jan 13, 2024
1 parent 5b6d74f commit 7a40e5d
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 13 deletions.
6 changes: 3 additions & 3 deletions CRAN-SUBMISSION
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
Version: 0.1.23
Date: 2024-01-10 11:04:24 UTC
SHA: 2bc7b7b06543adfc353402e63d1c6af17bea8909
Version: 0.1.24
Date: 2024-01-11 14:52:01 UTC
SHA: 5b6d74f511f4d1706a428832df3753703ce29d2d
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Package: RITCH
Type: Package
Title: R Parser for the ITCH-Protocol
Version: 0.1.24
Version: 0.1.25
Authors@R: c(
person("David", "Zimmermann-Kollenda", , "[email protected]", role = c("aut", "cre"))
)
Expand Down
4 changes: 4 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# RITCH 0.1.25

* fix Debian segfault when writing to user library

# RITCH 0.1.24

* fix printf warnings about wrong argument type
Expand Down
3 changes: 1 addition & 2 deletions cran-comments.md
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
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.
fix bug around writing to user library in tests.
15 changes: 8 additions & 7 deletions inst/tinytest/test_filter_itch.R
Original file line number Diff line number Diff line change
Expand Up @@ -373,21 +373,21 @@ unlink(outfile)
# filter_itch works on gz input files
infile <- system.file("extdata", "ex20101224.TEST_ITCH_50.gz", package = "RITCH")

outfile <- filter_itch(infile, outfile, filter_msg_class = "orders",
quiet = TRUE, force_gunzip = TRUE, force_cleanup = TRUE)
expect_equal(file.size(outfile), 190012)
outfile_plain <- filter_itch(infile, outfile, filter_msg_class = "orders",
quiet = TRUE, force_gunzip = TRUE, force_cleanup = TRUE)
expect_equal(file.size(outfile_plain), 190012)

odf <- read_orders(outfile, quiet = TRUE, force_gunzip = TRUE, force_cleanup = TRUE)
odf <- read_orders(outfile_plain, quiet = TRUE, force_gunzip = TRUE, force_cleanup = TRUE)
idf <- read_orders(infile, quiet = TRUE, force_gunzip = TRUE, force_cleanup = TRUE)
expect_equal(odf, idf)
unlink(outfile)
unlink(outfile_plain)


################################################################################
# works also on gz-output files
outfile <- "gz_testfile_20101224.TEST_ITCH_50"
tmpoutfile <- file.path(tempdir(), "gz_testfile_20101224.TEST_ITCH_50")

gzoutfile <- filter_itch(infile, outfile, filter_msg_class = "orders", gz = TRUE,
gzoutfile <- filter_itch(infile, tmpoutfile, filter_msg_class = "orders", gz = TRUE,
quiet = TRUE, force_gunzip = TRUE, force_cleanup = TRUE)

expect_true(file.exists(gzoutfile))
Expand All @@ -398,3 +398,4 @@ idf <- read_orders(infile, quiet = TRUE, force_gunzip = TRUE, force_cleanup = TR

expect_equal(odf, idf)
unlink(gzoutfile)
unlink(tmpoutfile)
12 changes: 12 additions & 0 deletions src/gz_functionality.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ void gunzip_file_impl(std::string infile,
int64_t buffer_size = 1e9) {

gzFile gzfile = gzopen(infile.c_str(), "rb");
if (gzfile == NULL) {
Rcpp::stop("Could not open file '%s' for gunzip", infile.c_str());
}

unsigned char* buf;
int64_t buffer_char_size = sizeof(unsigned char) * buffer_size > UINT_MAX ?
Expand All @@ -24,6 +27,9 @@ void gunzip_file_impl(std::string infile,
int64_t this_buffer_size;

FILE* ofile = fopen(outfile.c_str(), "wb");
if (ofile == NULL) {
Rcpp::stop("Could not open file '%s' for gunzip", outfile.c_str());
}
// iterate over the file until the all information is gathered

while (1) {
Expand Down Expand Up @@ -57,6 +63,9 @@ void gzip_file_impl(std::string infile,
int64_t buffer_size = 1e9) {

FILE* file = fopen(infile.c_str(), "rb");
if (file == NULL) {
Rcpp::stop("Could not open file %s for gzip", infile.c_str());
}

unsigned char* buf;
int64_t buffer_char_size = sizeof(unsigned char) * buffer_size > UINT_MAX ?
Expand All @@ -67,6 +76,9 @@ void gzip_file_impl(std::string infile,
int64_t this_buffer_size;

gzFile ofile = gzopen(outfile.c_str(), "wb");
if (ofile == NULL) {
Rcpp::stop("Could not open file %s for gzip", outfile.c_str());
}
// iterate over the file until the all information is gathered

while (1) {
Expand Down

0 comments on commit 7a40e5d

Please sign in to comment.