Skip to content

Commit

Permalink
Fix iconv compiler warning on GCC 8
Browse files Browse the repository at this point in the history
  • Loading branch information
jeroen committed Jan 13, 2020
1 parent 489fffd commit 395f344
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
7 changes: 4 additions & 3 deletions DESCRIPTION
@@ -1,7 +1,7 @@
Package: unrtf
Type: Package
Title: Extract Text from Rich Text Format (RTF) Documents
Version: 1.3
Version: 1.4
Authors@R: c(
person("Jeroen", "Ooms", ,"jeroen@berkeley.edu", role = c("aut", "cre")),
person("Free Software Foundation, Inc", role = "cph"))
Expand All @@ -11,8 +11,9 @@ Description: Wraps the 'unrtf' utility to extract text from RTF files. Supports
License: GPL-3
Encoding: UTF-8
Imports: sys (>= 2.0)
URL: https://docs.ropensci.org/unrtf, https://github.com/ropensci/unrtf#readme (devel)
URL: https://docs.ropensci.org/unrtf,
https://github.com/ropensci/unrtf#readme (devel)
https://www.gnu.org/software/unrtf/ (upstream)
BugReports: http://github.com/ropensci/unrtf/issues
RoxygenNote: 6.0.1
RoxygenNote: 7.0.2
Roxygen: list(markdown = TRUE)
10 changes: 8 additions & 2 deletions src/libunrtf/my_iconv.c
Expand Up @@ -24,6 +24,12 @@

extern int verbose_mode;

#ifdef _WIN32
#define ICONV_CONST (const char**)
#else
#define ICONV_CONST
#endif

/* Convert from charmap file entry to charmap table one.
1st byte in table entry is code length
*/
Expand Down Expand Up @@ -53,7 +59,7 @@ get_code_str(FILE *f, iconv_t desc)
return NULL;
icp = utf8;
ocp0 = ocp = obuf + 1;
if (iconv(desc, &icp, &ibytes, &ocp, &obytes) == -1) {
if (iconv(desc, ICONV_CONST &icp, &ibytes, &ocp, &obytes) == -1) {
/* fprintf(stderr, "unrtf: my_iconv: iconv error\n");*/
return NULL;
}
Expand Down Expand Up @@ -146,7 +152,7 @@ my_iconv(my_iconv_t cd, char **inbuf, size_t *inbytesleft, char **outbuf, size_t
}
}
else
result = iconv(cd.desc, inbuf, inbytesleft, outbuf, outbytesleft);
result = iconv(cd.desc, ICONV_CONST inbuf, inbytesleft, outbuf, outbytesleft);

return result;
}
Expand Down

0 comments on commit 395f344

Please sign in to comment.