Skip to content

Commit

Permalink
Fix format string issues (#421)
Browse files Browse the repository at this point in the history
  • Loading branch information
hadley committed Nov 30, 2023
1 parent b9f65ba commit bc5fa30
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 2 deletions.
2 changes: 2 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# xml2 (development version)

* Fix format string issues detected in R-devel.

* `xml_serialize()` now includes the document type so that `xml_unserialize()` works also for HTML documents (#407, @HenrikBengtsson).

* Remove unused dependencies on glue, withr and lifecycle (@mgirlich).
Expand Down
2 changes: 1 addition & 1 deletion src/xml2_init.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ void handleGenericError(void *ctx, const char *fmt, ...)

va_start(arg, fmt);
vsnprintf(buffer, BUFSIZ, fmt, arg);
Rf_error(buffer);
Rf_error("%s", buffer);
}

// [[export]]
Expand Down
2 changes: 1 addition & 1 deletion src/xml2_output.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ int xml_write_callback(SEXP con, const char * buffer, int len) {
size_t write_size;

if ((write_size = R_WriteConnection(con, (void *) buffer, len)) != static_cast<size_t>(len)) {
Rf_error("write failed, expected %l, got %l", len, write_size);
Rf_error("write failed, expected %i, got %li", len, write_size);
}
return write_size;
}
Expand Down

0 comments on commit bc5fa30

Please sign in to comment.