corinthia-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pmke...@apache.org
Subject [3/5] incubator-corinthia git commit: Word: Remove warnings parameters for conversion
Date Sun, 11 Jan 2015 06:17:17 GMT
Word: Remove warnings parameters for conversion

We've always treated warnings as errors, so we might as well disperse
with the idea of exposing a separate data structure to code that uses
WordConverter to record these.

The warnings buffer still exists for now; it's just internal to
WordConverter.


Project: http://git-wip-us.apache.org/repos/asf/incubator-corinthia/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-corinthia/commit/bc6827f6
Tree: http://git-wip-us.apache.org/repos/asf/incubator-corinthia/tree/bc6827f6
Diff: http://git-wip-us.apache.org/repos/asf/incubator-corinthia/diff/bc6827f6

Branch: refs/heads/stable
Commit: bc6827f6130a8b04b3c97598c31d4cc7289a2ddb
Parents: 5c9a2c0
Author: Peter Kelly <peter@uxproductivity.com>
Authored: Sun Jan 11 12:39:56 2015 +0700
Committer: Peter Kelly <peter@uxproductivity.com>
Committed: Sun Jan 11 12:39:56 2015 +0700

----------------------------------------------------------------------
 DocFormats/filters/ooxml/src/word/Word.c          | 12 +++---------
 DocFormats/filters/ooxml/src/word/WordConverter.c | 13 ++++++-------
 DocFormats/filters/ooxml/src/word/WordConverter.h |  4 ++--
 3 files changed, 11 insertions(+), 18 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-corinthia/blob/bc6827f6/DocFormats/filters/ooxml/src/word/Word.c
----------------------------------------------------------------------
diff --git a/DocFormats/filters/ooxml/src/word/Word.c b/DocFormats/filters/ooxml/src/word/Word.c
index a94deaa..1e06448 100644
--- a/DocFormats/filters/ooxml/src/word/Word.c
+++ b/DocFormats/filters/ooxml/src/word/Word.c
@@ -27,7 +27,6 @@ DFDocument *WordGet(DFStorage *concreteStorage, DFStorage *abstractStorage,
DFEr
 {
     int ok = 0;
     WordPackage *wordPackage = NULL;
-    DFBuffer *warnings = DFBufferNew();
     DFDocument *htmlDoc = NULL;
 
     wordPackage = WordPackageOpenFrom(concreteStorage,error);
@@ -35,13 +34,12 @@ DFDocument *WordGet(DFStorage *concreteStorage, DFStorage *abstractStorage,
DFEr
         goto end;
 
     htmlDoc = DFDocumentNew();
-    if (!WordConverterGet(htmlDoc,abstractStorage,"word",wordPackage,warnings,error))
+    if (!WordConverterGet(htmlDoc,abstractStorage,"word",wordPackage,error))
         goto end;
 
     ok = 1;
 
 end:
-    DFBufferRelease(warnings);
     WordPackageRelease(wordPackage);
     if (ok) {
         return htmlDoc;
@@ -56,7 +54,6 @@ int WordPut(DFStorage *concreteStorage, DFStorage *abstractStorage, DFDocument
*
 {
     int ok = 0;
     WordPackage *wordPackage = NULL;
-    DFBuffer *warnings = DFBufferNew();
 
     const char *idPrefix = "word";
 
@@ -64,7 +61,7 @@ int WordPut(DFStorage *concreteStorage, DFStorage *abstractStorage, DFDocument
*
     if (wordPackage == NULL)
         goto end;
 
-    if (!WordConverterPut(htmlDoc,abstractStorage,idPrefix,wordPackage,warnings,error))
+    if (!WordConverterPut(htmlDoc,abstractStorage,idPrefix,wordPackage,error))
         goto end;
 
     if (!WordPackageSave(wordPackage,error))
@@ -74,7 +71,6 @@ int WordPut(DFStorage *concreteStorage, DFStorage *abstractStorage, DFDocument
*
 
 end:
     WordPackageRelease(wordPackage);
-    DFBufferRelease(warnings);
     return ok;
 }
 
@@ -82,7 +78,6 @@ int WordCreate(DFStorage *concreteStorage, DFStorage *abstractStorage, DFDocumen
 {
     int ok = 0;
     WordPackage *wordPackage = NULL;
-    DFBuffer *warnings = DFBufferNew();
 
     const char *idPrefix = "word";
 
@@ -96,7 +91,7 @@ int WordCreate(DFStorage *concreteStorage, DFStorage *abstractStorage, DFDocumen
     // a new word or odf file from it.
     HTMLBreakBDTRefs(htmlDoc->docNode,idPrefix);
 
-    if (!WordConverterPut(htmlDoc,abstractStorage,idPrefix,wordPackage,warnings,error))
+    if (!WordConverterPut(htmlDoc,abstractStorage,idPrefix,wordPackage,error))
         goto end;
 
     if (!WordPackageSave(wordPackage,error))
@@ -106,7 +101,6 @@ int WordCreate(DFStorage *concreteStorage, DFStorage *abstractStorage,
DFDocumen
 
 end:
     WordPackageRelease(wordPackage);
-    DFBufferRelease(warnings);
     return ok;
 }
 

http://git-wip-us.apache.org/repos/asf/incubator-corinthia/blob/bc6827f6/DocFormats/filters/ooxml/src/word/WordConverter.c
----------------------------------------------------------------------
diff --git a/DocFormats/filters/ooxml/src/word/WordConverter.c b/DocFormats/filters/ooxml/src/word/WordConverter.c
index ee00253..f649d26 100644
--- a/DocFormats/filters/ooxml/src/word/WordConverter.c
+++ b/DocFormats/filters/ooxml/src/word/WordConverter.c
@@ -558,8 +558,7 @@ static void Word_postProcessHTMLDoc(WordConverter *conv)
 ////////////////////////////////////////////////////////////////////////////////////////////////////
 
 static WordConverter *WordConverterNew(DFDocument *html, DFStorage *abstractStorage,
-                                       const char *idPrefix, WordPackage *package,
-                                       DFBuffer *warnings)
+                                       const char *idPrefix, WordPackage *package)
 {
     WordConverter *converter = (WordConverter *)calloc(1,sizeof(WordConverter));
     converter->html = DFDocumentRetain(html);
@@ -582,7 +581,7 @@ static WordConverter *WordConverterNew(DFDocument *html, DFStorage *abstractStor
     DFHashTableAdd(converter->supportedContentTypes,"gif","image/gif");
     DFHashTableAdd(converter->supportedContentTypes,"bmp","image/bmp");
     DFHashTableAdd(converter->supportedContentTypes,"png","image/png");
-    converter->warnings = DFBufferRetain(warnings);
+    converter->warnings = DFBufferNew();
     return converter;
 }
 
@@ -722,9 +721,9 @@ static int WordConverterGet2(WordConverter *converter, DFError **error)
 
 int WordConverterGet(DFDocument *html, DFStorage *abstractStorage,
                      const char *idPrefix, WordPackage *package,
-                     DFBuffer *warnings, DFError **error)
+                     DFError **error)
 {
-    WordConverter *converter = WordConverterNew(html,abstractStorage,idPrefix,package,warnings);
+    WordConverter *converter = WordConverterNew(html,abstractStorage,idPrefix,package);
     int ok = WordConverterGet2(converter,error);
     WordConverterFree(converter);
     return ok;
@@ -917,9 +916,9 @@ static int WordConverterPut2(WordConverter *converter, DFError **error)
 
 int WordConverterPut(DFDocument *html, DFStorage *abstractStorage,
                      const char *idPrefix, WordPackage *package,
-                     DFBuffer *warnings, DFError **error)
+                     DFError **error)
 {
-    WordConverter *converter = WordConverterNew(html,abstractStorage,idPrefix,package,warnings);
+    WordConverter *converter = WordConverterNew(html,abstractStorage,idPrefix,package);
     int ok = WordConverterPut2(converter,error);
     WordConverterFree(converter);
     return ok;

http://git-wip-us.apache.org/repos/asf/incubator-corinthia/blob/bc6827f6/DocFormats/filters/ooxml/src/word/WordConverter.h
----------------------------------------------------------------------
diff --git a/DocFormats/filters/ooxml/src/word/WordConverter.h b/DocFormats/filters/ooxml/src/word/WordConverter.h
index eeed849..c0565f2 100644
--- a/DocFormats/filters/ooxml/src/word/WordConverter.h
+++ b/DocFormats/filters/ooxml/src/word/WordConverter.h
@@ -100,10 +100,10 @@ struct WordConverter {
 
 int WordConverterGet(DFDocument *html, DFStorage *abstractStorage,
                      const char *idPrefix, WordPackage *package,
-                     DFBuffer *warnings, DFError **error);
+                     DFError **error);
 int WordConverterPut(DFDocument *html, DFStorage *abstractStorage,
                      const char *idPrefix, WordPackage *package,
-                     DFBuffer *warnings, DFError **error);
+                     DFError **error);
 void WordConverterWarning(WordConverter *converter, const char *format, ...) ATTRIBUTE_FORMAT(printf,2,3);
 
 char *WordStyleIdForStyle(CSSStyle *style);


Mime
View raw message