Skip to content

Commit

Permalink
Fix -Wformat warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
brodieG committed Dec 5, 2023
2 parents 4263b69 + 6689dc4 commit 3d7e546
Show file tree
Hide file tree
Showing 21 changed files with 82 additions and 32 deletions.
3 changes: 2 additions & 1 deletion .Rbuildignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
^CONTRIBUTING\.md$
^CRAN\.md$
^\.travis\.yml$
.Rdata
\.Rdata
\.Rhistory
^covr\.R
^extra$
^scratch
Expand Down
4 changes: 2 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ Package: fansi
Title: ANSI Control Sequence Aware String Functions
Description: Counterparts to R string manipulation functions that account for
the effects of ANSI text formatting control sequences.
Version: 1.0.4
Version: 1.0.6
Authors@R: c(
person("Brodie", "Gaslam", email="[email protected]",
role=c("aut", "cre")),
Expand All @@ -24,7 +24,7 @@ Suggests:
Imports:
grDevices,
utils
RoxygenNote: 7.1.1
RoxygenNote: 7.2.3
Roxygen: list(markdown = TRUE, load = "installed")
Encoding: UTF-8
Collate:
Expand Down
11 changes: 11 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
# fansi Release Notes

## v1.0.6

* Fix new `-Wformat` warnings.

## v1.0.5

* Address roxygen2 breaking changes:
* Add explicit alias for `fansi-package` now that it is no longer
auto-generated by roxgen2 from the [`@docType package` directive](https://github.com/r-lib/roxygen2/issues/1491).
* Work around [changed behavior for `@inheritParams`](https://github.com/r-lib/roxygen2/issues/1515).

## v1.0.4

CRAN compiled code warning suppression release.
Expand Down
1 change: 1 addition & 0 deletions R/fansi-package.R
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,7 @@
#'
#' @useDynLib fansi, .registration=TRUE, .fixes="FANSI_"
#' @docType package
#' @aliases fansi-package
#' @name fansi

NULL
Expand Down
1 change: 1 addition & 0 deletions R/strsplit.R
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
#' @inherit substr_ctl seealso
#' @inheritSection substr_ctl Control and Special Sequences
#' @inheritSection substr_ctl Output Stability
#' @inheritSection substr_ctl Bidirectional Text
#' @note Non-ASCII strings are converted to and returned in UTF-8 encoding.
#' Width calculations will not work properly in R < 3.2.2.
#' @return Like [`base::strsplit`], with _Control Sequences_ excluded.
Expand Down
1 change: 1 addition & 0 deletions R/strwrap.R
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
#' @inheritSection substr_ctl Control and Special Sequences
#' @inheritSection substr_ctl Graphemes
#' @inheritSection substr_ctl Output Stability
#' @inheritSection substr_ctl Bidirectional Text
#' @inheritParams base::strwrap
#' @inheritParams tabs_as_spaces
#' @inheritParams substr_ctl
Expand Down
9 changes: 8 additions & 1 deletion R/substr2.R
Original file line number Diff line number Diff line change
Expand Up @@ -148,17 +148,24 @@
#' The [`utf8`](https://cran.r-project.org/package=utf8) package provides a
#' conforming grapheme parsing implementation.
#'
#' @section Bidirectional Text:
#'
#' `fansi` is unaware of text directionality and operates as if all strings are
#' left to right (LTR). Using `fansi` function with strings that contain mixed
#' direction scripts (i.e. both LTR and RTL) may produce undesirable results.
#'
#' @note Non-ASCII strings are converted to and returned in UTF-8 encoding.
#' Width calculations will not work properly in R < 3.2.2.
#' @note If `stop` < `start`, the return value is always an empty string.
#' @inheritParams base::substr
#' @export
#' @seealso [`?fansi`][fansi] for details on how _Control Sequences_ are
#' interpreted, particularly if you are getting unexpected results,
#' [`normalize_state`] for more details on what the `normalize` parameter does,
#' [`state_at_end`] to compute active state at the end of strings,
#' [`close_state`] to compute the sequence required to close active state.
#' @param x a character vector or object that can be coerced to such.
#' @param start integer. The first element to be extracted or replaced.
#' @param stop integer. The first element to be extracted or replaced.
#' @param type character(1L) partial matching
#' `c("chars", "width", "graphemes")`, although types other than "chars" only
#' work correctly with R >= 3.2.2. See [`?nchar`][base::nchar].
Expand Down
2 changes: 1 addition & 1 deletion README.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ library(fansi)
# fansi - ANSI Control Sequence Aware String Functions

[![R build status](https://github.com/brodieG/fansi/workflows/R-CMD-check/badge.svg)](https://github.com/brodieG/fansi/actions)
[![](https://codecov.io/gh/brodieG/fansi/branch/master/graphs/badge.svg?branch=master)](https://codecov.io/github/brodieG/fansi?branch=master)
[![](https://codecov.io/gh/brodieG/fansi/branch/master/graphs/badge.svg?branch=master)](https://app.codecov.io/github/brodieG/fansi?branch=master)
[![](http://www.r-pkg.org/badges/version/fansi)](https://cran.r-project.org/package=fansi)
[![Dependencies direct/recursive](https://tinyverse.netlify.app/badge/fansi)](https://tinyverse.netlify.app/)

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ render('README.Rmd', output_format=html_document())

[![R build
status](https://github.com/brodieG/fansi/workflows/R-CMD-check/badge.svg)](https://github.com/brodieG/fansi/actions)
[![](https://codecov.io/gh/brodieG/fansi/branch/master/graphs/badge.svg?branch=master)](https://codecov.io/github/brodieG/fansi?branch=master)
[![](https://codecov.io/gh/brodieG/fansi/branch/master/graphs/badge.svg?branch=master)](https://app.codecov.io/github/brodieG/fansi?branch=master)
[![](http://www.r-pkg.org/badges/version/fansi)](https://cran.r-project.org/package=fansi)
[![Dependencies
direct/recursive](https://tinyverse.netlify.app/badge/fansi)](https://tinyverse.netlify.app/)
Expand Down
19 changes: 13 additions & 6 deletions man/fansi.Rd

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

8 changes: 8 additions & 0 deletions man/strsplit_ctl.Rd

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

2 changes: 1 addition & 1 deletion man/strtrim_ctl.Rd

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

2 changes: 1 addition & 1 deletion man/strtrim_sgr.Rd

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

13 changes: 9 additions & 4 deletions man/strwrap_ctl.Rd

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

5 changes: 1 addition & 4 deletions man/strwrap_sgr.Rd

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

22 changes: 17 additions & 5 deletions man/substr_ctl.Rd

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

2 changes: 1 addition & 1 deletion man/substr_sgr.Rd

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

2 changes: 1 addition & 1 deletion man/trimws_ctl.Rd

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

1 change: 0 additions & 1 deletion src/unhandled.c
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,6 @@ SEXP FANSI_unhandled_esc(SEXP x, SEXP term_cap) {
if(res == R_NilValue)
// nocov start
error(
"%s%s",
"Internal Error: mismatch between list and err count; "
"contact maintainer."
);
Expand Down
2 changes: 1 addition & 1 deletion src/wrap.c
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ static struct FANSI_prefix_dat drop_pre_indent(struct FANSI_prefix_dat dat) {
if(dat.indent < 0)
// nocov start
error(
"Internal Error: cannot drop indent when there is none; contact ",
"Internal Error: cannot drop indent when there is none; contact "
"maintainer."
);
// nocov end
Expand Down
2 changes: 1 addition & 1 deletion src/write.c
Original file line number Diff line number Diff line change
Expand Up @@ -717,7 +717,7 @@ static char * color_token(
// nocov start
error(
"Internal Error: exceeded color buffer (%d vs %d).",
buff_track - buff, CLR_BUFF_SIZE
(int) (buff_track - buff), CLR_BUFF_SIZE
);
// nocov end
return buff;
Expand Down

0 comments on commit 3d7e546

Please sign in to comment.