From bf0566e9542656da165a5cba1b1605980ba600b0 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Tue, 5 Oct 2010 08:53:03 +0200 Subject: Get rid of dependency on FILE from stdio.h --- libxsde/xsde/c/genx/genx.c | 44 +++++--------------------------------------- libxsde/xsde/c/genx/genx.h | 7 ------- 2 files changed, 5 insertions(+), 46 deletions(-) (limited to 'libxsde') diff --git a/libxsde/xsde/c/genx/genx.c b/libxsde/xsde/c/genx/genx.c index cd3cf54..7683b33 100644 --- a/libxsde/xsde/c/genx/genx.c +++ b/libxsde/xsde/c/genx/genx.c @@ -9,6 +9,7 @@ #define GENX_VERSION "cs-1" +#include #include #include @@ -113,7 +114,6 @@ struct genxAttribute_rec */ struct genxWriter_rec { - FILE * file; genxSender * sender; genxStatus status; writerSequence sequence; @@ -1160,12 +1160,7 @@ static genxStatus sendx(genxWriter w, constUtf8 s) if (w->sender) return (*w->sender->send)(w->userData, s); else - { - if (fputs((const char *) s, w->file) == -1) - return GENX_IO_ERROR; - else - return GENX_SUCCESS; - } + return GENX_IO_ERROR; } static genxStatus sendxBounded(genxWriter w, constUtf8 start, constUtf8 end) @@ -1173,11 +1168,7 @@ static genxStatus sendxBounded(genxWriter w, constUtf8 start, constUtf8 end) if (w->sender) return (*w->sender->sendBounded)(w->userData, start, end); else - /* Looks like on VxWorks fwrite returns a signed type which causes warnings. */ - if ((unsigned) fwrite(start, 1, end - start, w->file) != (unsigned) (end - start)) - return GENX_IO_ERROR; - else - return GENX_SUCCESS; + return GENX_IO_ERROR; } #define SendCheck(w,s) if ((w->status=sendx(w,(utf8)s))!=GENX_SUCCESS) return w->status; @@ -1188,34 +1179,12 @@ static genxStatus sendxBounded(genxWriter w, constUtf8 start, constUtf8 end) * for internal routines. */ -/* - * Start a document - */ -genxStatus genxStartDocFile(genxWriter w, FILE * file) -{ - if (w->sequence != SEQUENCE_NO_DOC) - return w->status = GENX_SEQUENCE_ERROR; - - w->sequence = SEQUENCE_PRE_DOC; - w->file = file; - w->sender = NULL; - - if (w->ppIndent) - { - w->ppSimple = True; - w->ppDepth = 0; - } - - return GENX_SUCCESS; -} - genxStatus genxStartDocSender(genxWriter w, genxSender * sender) { if (w->sequence != SEQUENCE_NO_DOC) return w->status = GENX_SEQUENCE_ERROR; w->sequence = SEQUENCE_PRE_DOC; - w->file = NULL; w->sender = sender; if (w->ppIndent) @@ -2029,11 +1998,8 @@ genxStatus genxEndDocument(genxWriter w) if (w->sequence != SEQUENCE_POST_DOC) return w->status = GENX_SEQUENCE_ERROR; - if (w->file) - fflush(w->file); - else - if ((w->status = (*w->sender->flush)(w->userData)) != GENX_SUCCESS) - return w->status; + if ((w->status = (*w->sender->flush)(w->userData)) != GENX_SUCCESS) + return w->status; w->sequence = SEQUENCE_NO_DOC; return GENX_SUCCESS; diff --git a/libxsde/xsde/c/genx/genx.h b/libxsde/xsde/c/genx/genx.h index 5b155cc..56d36aa 100644 --- a/libxsde/xsde/c/genx/genx.h +++ b/libxsde/xsde/c/genx/genx.h @@ -12,8 +12,6 @@ #ifndef GENX_H #define GENX_H -#include - #ifdef __cplusplus extern "C" { #endif @@ -171,11 +169,6 @@ genxAttribute genxDeclareAttribute(genxWriter w, */ /* - * Start a new document. - */ -genxStatus genxStartDocFile(genxWriter w, FILE * file); - -/* * Caller-provided I/O package. * First form is for a null-terminated string. * for second, if you have s="abcdef" and want to send "abc", you'd call -- cgit v1.1