Browse Source

CRAN check fixes

tags/v0.2.0
hrbrmstr 8 years ago
parent
commit
8928104eb5
  1. 14
      README.Rmd
  2. 15
      README.md
  3. 11
      src/alloc.cpp
  4. 3
      src/lexer.c
  5. 14
      src/sprtf.cpp
  6. 13
      src/streamio.c
  7. 30
      src/tidylib.c

14
README.Rmd

@ -32,20 +32,6 @@ The following functions are implemented:
- `tidy_html` : Clean up gnarly HTML/XML - `tidy_html` : Clean up gnarly HTML/XML
### TODO
Fix:
```{text}
* checking compiled code ... WARNING
File ‘htmltidy/libs/htmltidy.so’:
Found ‘___stderrp’, possibly from ‘stderr’ (C)
Objects: ‘alloc.o’, ‘streamio.o’, ‘tidylib.o’
Found ‘___stdoutp’, possibly from ‘stdout’ (C)
Objects: ‘sprtf.o’, ‘tidylib.o’
Found ‘_exit’, possibly from ‘exit’ (C)
Objects: ‘alloc.o’, ‘sprtf.o’
```
### Installation ### Installation

15
README.md

@ -17,21 +17,6 @@ The following functions are implemented:
- `tidy_html` : Clean up gnarly HTML/XML - `tidy_html` : Clean up gnarly HTML/XML
### TODO
Fix:
``` text
* checking compiled code ... WARNING
File ‘htmltidy/libs/htmltidy.so’:
Found ‘___stderrp’, possibly from ‘stderr’ (C)
Objects: ‘alloc.o’, ‘streamio.o’, ‘tidylib.o’
Found ‘___stdoutp’, possibly from ‘stdout’ (C)
Objects: ‘sprtf.o’, ‘tidylib.o’
Found ‘_exit’, possibly from ‘exit’ (C)
Objects: ‘alloc.o’, ‘sprtf.o’
```
### Installation ### Installation
``` r ``` r

11
src/alloc.c → src/alloc.cpp

@ -1,3 +1,5 @@
#include <Rcpp.h>
/* alloc.c -- Default memory allocation routines. /* alloc.c -- Default memory allocation routines.
(c) 1998-2006 (W3C) MIT, ERCIM, Keio University (c) 1998-2006 (W3C) MIT, ERCIM, Keio University
@ -44,14 +46,7 @@ static void TIDY_CALL defaultPanic( TidyAllocator* ARG_UNUSED(allocator), ctmbst
if ( g_panic ) if ( g_panic )
g_panic( msg ); g_panic( msg );
else else
{ Rcpp::stop("Fatal memory error");
/* 2 signifies a serious error */
fprintf( stderr, "Fatal error: %s\n", msg );
#ifdef _DEBUG
assert(0);
#endif
exit(2);
}
} }
static void* TIDY_CALL defaultAlloc( TidyAllocator* allocator, size_t size ) static void* TIDY_CALL defaultAlloc( TidyAllocator* allocator, size_t size )

3
src/lexer.c

@ -1000,9 +1000,6 @@ void TY_(AddCharToLexer)( Lexer *lexer, uint c )
err = TY_(EncodeCharToUTF8Bytes)( c, buf, NULL, &count ); err = TY_(EncodeCharToUTF8Bytes)( c, buf, NULL, &count );
if (err) if (err)
{ {
#if 0 && defined(_DEBUG)
fprintf( stderr, "lexer UTF-8 encoding error for U+%x : ", c );
#endif
/* replacement character 0xFFFD encoded as UTF-8 */ /* replacement character 0xFFFD encoded as UTF-8 */
buf[0] = (byte) 0xEF; buf[0] = (byte) 0xEF;
buf[1] = (byte) 0xBF; buf[1] = (byte) 0xBF;

14
src/sprtf.c → src/sprtf.cpp

@ -1,3 +1,5 @@
#include <Rcpp.h>
/* /*
* SPRTF - Log output utility * SPRTF - Log output utility
* *
@ -156,8 +158,7 @@ int open_log_file( void )
outfile = fopen(logfile, mode); outfile = fopen(logfile, mode);
if( outfile == 0 ) { if( outfile == 0 ) {
outfile = (FILE *)-1; outfile = (FILE *)-1;
sprtf("ERROR: Failed to open log file [%s] ...\n", logfile); Rcpp::stop("Failed to open log file");
exit(1); /* failed */
return 0; /* failed */ return 0; /* failed */
} }
return 1; /* success */ return 1; /* success */
@ -299,16 +300,15 @@ static void oi( char * psin )
if( w != len ) { if( w != len ) {
fclose(outfile); fclose(outfile);
outfile = (FILE *)-1; outfile = (FILE *)-1;
sprtf("WARNING: Failed write to log file [%s] ...\n", logfile); Rcpp::stop("Failed write to log file");
exit(1);
} else if (addflush) { } else if (addflush) {
fflush( outfile ); fflush( outfile );
} }
} }
if( addstdout ) { // if( addstdout ) {
fwrite( ps, 1, len, stdout ); // fwrite( ps, 1, len, stdout );
} // }
#ifdef ADD_LISTVIEW #ifdef ADD_LISTVIEW
if (add2listview) { if (add2listview) {
LVInsertItem(ps); LVInsertItem(ps);

13
src/streamio.c

@ -75,20 +75,11 @@ static StreamOut stdoutStreamOut =
StreamOut* TY_(StdErrOutput)(void) StreamOut* TY_(StdErrOutput)(void)
{ {
if ( stderrStreamOut.sink.sinkData == 0 ) // if ( stderrStreamOut.sink.sinkData == 0 )
stderrStreamOut.sink.sinkData = stderr; // stderrStreamOut.sink.sinkData = stderr;
return &stderrStreamOut; return &stderrStreamOut;
} }
#if 0
StreamOut* TY_(StdOutOutput)(void)
{
if ( stdoutStreamOut.sink.sinkData == 0 )
stdoutStreamOut.sink.sinkData = stdout;
return &stdoutStreamOut;
}
#endif
void TY_(ReleaseStreamOut)( TidyDocImpl *doc, StreamOut* out ) void TY_(ReleaseStreamOut)( TidyDocImpl *doc, StreamOut* out )
{ {
if ( out && out != &stderrStreamOut && out != &stdoutStreamOut ) if ( out && out != &stderrStreamOut && out != &stdoutStreamOut )

30
src/tidylib.c

@ -1081,35 +1081,17 @@ int tidyDocSaveStdout( TidyDocImpl* doc )
int status = 0; int status = 0;
uint outenc = cfg( doc, TidyOutCharEncoding ); uint outenc = cfg( doc, TidyOutCharEncoding );
uint nl = cfg( doc, TidyNewline ); uint nl = cfg( doc, TidyNewline );
StreamOut* out = TY_(FileOutput)( doc, stdout, outenc, nl ); // StreamOut* out = TY_(FileOutput)( doc, stdout, outenc, nl );
#if !defined(NO_SETMODE_SUPPORT) // if ( 0 == status )
// status = tidyDocSaveStream( doc, out );
#if defined(_WIN32) || defined(OS2_OS)
oldstdoutmode = setmode( fileno(stdout), _O_BINARY );
oldstderrmode = setmode( fileno(stderr), _O_BINARY );
#endif
#endif
if ( 0 == status )
status = tidyDocSaveStream( doc, out );
fflush(stdout); // fflush(stdout);
fflush(stderr); // fflush(stderr);
#if !defined(NO_SETMODE_SUPPORT)
#if defined(_WIN32) || defined(OS2_OS)
if ( oldstdoutmode != -1 )
oldstdoutmode = setmode( fileno(stdout), oldstdoutmode );
if ( oldstderrmode != -1 )
oldstderrmode = setmode( fileno(stderr), oldstderrmode );
#endif
#endif // TidyDocFree( doc, out );
TidyDocFree( doc, out );
return status; return status;
} }

Loading…
Cancel
Save