Skip to content

Commit

Permalink
Apply CRAN submission feedback. Round 1
Browse files Browse the repository at this point in the history
  • Loading branch information
coolbutuseless committed Jan 15, 2024
1 parent c2e4267 commit 8eb8c7c
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 10 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Package: yyjsonr
Type: Package
Title: Fast JSON Parser and Generator
Version: 0.1.14
Version: 0.1.15
Authors@R: c(
person("Mike", "Cheng", role = c("aut", "cre", 'cph'),
email = "[email protected]"),
Expand Down
7 changes: 7 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@


# yyjson4 0.1.15 2024-01-15

* Fixes for CRAN
* Simply example to remove checkRd NOTE
* Platform specific handling of error location format string to fix WARNING

# yyjson4 0.1.14 2024-01-13

* Add `int64 = "double"` option to `opts_read_json()`
Expand Down
2 changes: 1 addition & 1 deletion R/json-opts.R
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
#'
#' \item{YYJSON_READ_ALLOW_TRAILING_COMMAS}{
#' Allow single trailing comma at the end of an object or array,
#' such as \code{"[1,2,3,]"}, '{"a":1,"b":2,}' (non-standard).
#' such as \code{"[1,2,3,]"}
#' }
#'
#' \item{YYJSON_READ_ALLOW_COMMENTS}{
Expand Down
2 changes: 1 addition & 1 deletion man/yyjson_read_flag.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

27 changes: 20 additions & 7 deletions src/R-yyjson-parse.c
Original file line number Diff line number Diff line change
Expand Up @@ -1846,7 +1846,11 @@ SEXP parse_json_from_str(const char *str, parse_options *opt) {
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
if (doc == NULL) {
output_verbose_error(str, err);
error("Error parsing JSON: %s code: %u at position: %ld\n", err.msg, err.code, err.pos);
#if defined(__APPLE__) || defined(_WIN32)
error("Error parsing JSON: %s code: %u at position: %llu\n", err.msg, err.code, err.pos);
#else
error("Error parsing JSON: %s code: %u at position: %lu\n", err.msg, err.code, err.pos);
#endif
}

//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Expand Down Expand Up @@ -1879,8 +1883,11 @@ SEXP parse_json_from_file(const char *filename, parse_options *opt) {
// If doc is NULL, then an error occurred during parsing.
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
if (doc == NULL) {
error("Error parsing JSON file '%s': %s code: %u at position: %ld\n",
filename, err.msg, err.code, err.pos);
#if defined(__APPLE__) || defined(_WIN32)
error("Error parsing JSON file '%s': %s code: %u at position: %llu\n", filename, err.msg, err.code, err.pos);
#else
error("Error parsing JSON file '%s': %s code: %u at position: %lu\n", filename, err.msg, err.code, err.pos);
#endif

}

Expand Down Expand Up @@ -1961,8 +1968,11 @@ SEXP validate_json_file_(SEXP filename_, SEXP verbose_, SEXP parse_opts_) {
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
if (doc == NULL) {
if (asLogical(verbose_)) {
warning("Error parsing JSON file '%s': %s code: %u at position: %ld\n",
filename, err.msg, err.code, err.pos);
#if defined(__APPLE__) || defined(_WIN32)
warning("Error parsing JSON file '%s': %s code: %u at position: %llu\n", filename, err.msg, err.code, err.pos);
#else
warning("Error parsing JSON file '%s': %s code: %u at position: %lu\n", filename, err.msg, err.code, err.pos);
#endif
}
return ScalarLogical(0);

Expand Down Expand Up @@ -1990,8 +2000,11 @@ SEXP validate_json_str_(SEXP str_, SEXP verbose_, SEXP parse_opts_) {
if (doc == NULL) {
if (asLogical(verbose_)) {
output_verbose_error(str, err);
warning("Error parsing JSON: %s code: %u at position: %ld\n",
err.msg, err.code, err.pos);
#if defined(__APPLE__) || defined(_WIN32)
warning("Error parsing JSON: %s code: %u at position: %llu\n", err.msg, err.code, err.pos);
#else
warning("Error parsing JSON: %s code: %u at position: %lu\n", err.msg, err.code, err.pos);
#endif
}
return ScalarLogical(0);
}
Expand Down

0 comments on commit 8eb8c7c

Please sign in to comment.