corinthia-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From g..@apache.org
Subject incubator-corinthia git commit: Move DFFileExists check to top of DFGetFile.
Date Mon, 04 May 2015 11:49:51 GMT
Repository: incubator-corinthia
Updated Branches:
  refs/heads/master aa2938d31 -> 74e451a98


Move DFFileExists check to top of DFGetFile.

* DocFormats/api/src/Operations.c

  (DFGetFile): Rename variable 'r' to 'success'.  Move DFFileExists
    check to the top to avoid futile compuations.

* CorinthiaDirectoryTree.html

   Update directory tree.


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

Branch: refs/heads/master
Commit: 74e451a982eeced641ccf50fb71143b0fe86bff6
Parents: aa2938d
Author: Gabriela Gibson <gbg@apache.org>
Authored: Mon May 4 12:50:15 2015 +0100
Committer: Gabriela Gibson <gbg@apache.org>
Committed: Mon May 4 12:50:15 2015 +0100

----------------------------------------------------------------------
 CorinthiaDirectoryTree.html     |  7 +------
 DocFormats/api/src/Operations.c | 21 +++++++++++----------
 2 files changed, 12 insertions(+), 16 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-corinthia/blob/74e451a9/CorinthiaDirectoryTree.html
----------------------------------------------------------------------
diff --git a/CorinthiaDirectoryTree.html b/CorinthiaDirectoryTree.html
index 7140eb7..edd8f3d 100644
--- a/CorinthiaDirectoryTree.html
+++ b/CorinthiaDirectoryTree.html
@@ -46,11 +46,8 @@
 	│   │   │   &nbsp;&nbsp;&nbsp; └── <a href="./consumers/dfwebserver/examples/node/server/">server</a><br>
 	│   │   ├── <a href="./consumers/dfwebserver/node/">node</a><br>
 	│   │   │   └── <a href="./consumers/dfwebserver/node/src/">src</a><br>
-	│   │   ├── <a href="./consumers/dfwebserver/pool/">pool</a><br>
-	│   │   │   └── <a href="./consumers/dfwebserver/pool/sample.docx/">sample.docx</a><br>
 	│   │   ├── <a href="./consumers/dfwebserver/python/">python</a><br>
 	│   │   │   └── <a href="./consumers/dfwebserver/python/src/">src</a><br>
-	│   │   ├── <a href="./consumers/dfwebserver/src/">src</a><br>
 	│   │   └── <a href="./consumers/dfwebserver/web/">web</a><br>
 	│   │   &nbsp;&nbsp;&nbsp; └── <a href="./consumers/dfwebserver/web/client/">client</a><br>
 	│   └── <a href="./consumers/web/">web</a><br>
@@ -105,8 +102,6 @@
 	│   │   └── <a href="./DocFormats/filters/ooxml/">ooxml</a><br>
 	│   │   &nbsp;&nbsp;&nbsp; ├── <a href="./DocFormats/filters/ooxml/src/">src</a><br>
 	│   │   &nbsp;&nbsp;&nbsp; │   ├── <a href="./DocFormats/filters/ooxml/src/common/">common</a><br>
-	│   │   &nbsp;&nbsp;&nbsp; │   ├── <a href="./DocFormats/filters/ooxml/src/odf/">odf</a><br>
-	│   │   &nbsp;&nbsp;&nbsp; │   │   └── <a href="./DocFormats/filters/ooxml/src/odf/lenses/">lenses</a><br>
 	│   │   &nbsp;&nbsp;&nbsp; │   └── <a href="./DocFormats/filters/ooxml/src/word/">word</a><br>
 	│   │   &nbsp;&nbsp;&nbsp; │   &nbsp;&nbsp;&nbsp; ├──
<a href="./DocFormats/filters/ooxml/src/word/formatting/">formatting</a><br>
 	│   │   &nbsp;&nbsp;&nbsp; │   &nbsp;&nbsp;&nbsp; └──
<a href="./DocFormats/filters/ooxml/src/word/lenses/">lenses</a><br>
@@ -211,7 +206,7 @@
 	</p>
 	<p>
 
-178 directories
+173 directories
 	<br><br>
 	</p>
 	<hr>

http://git-wip-us.apache.org/repos/asf/incubator-corinthia/blob/74e451a9/DocFormats/api/src/Operations.c
----------------------------------------------------------------------
diff --git a/DocFormats/api/src/Operations.c b/DocFormats/api/src/Operations.c
index 62b6e7b..addc1c4 100644
--- a/DocFormats/api/src/Operations.c
+++ b/DocFormats/api/src/Operations.c
@@ -356,7 +356,15 @@ int DFGetFile(const char *concreteFilename,
               const char *abstractFilename,
               DFError **error)
 {
-    int r = 0;
+    int success = 0;
+
+    if (DFFileExists(abstractFilename)) {
+        DFErrorFormat(error,
+                      "%s: File already exists",
+                      abstractFilename);
+        return success;
+    }
+
     char *abstractPath = DFPathDirName(abstractFilename);
     DFStorage *abstractStorage =
       DFStorageNewFilesystem(abstractPath, DFFileFormatHTML);
@@ -381,13 +389,6 @@ int DFGetFile(const char *concreteFilename,
         goto end;
     }
 
-    if (DFFileExists(abstractFilename)) {
-        DFErrorFormat(error,
-                      "%s: File already exists",
-                      abstractFilename);
-        goto end;
-    }
-
     if (!DFSerializeXMLFile(abstractDoc->htmlDoc,
                             0, 0,
                             abstractFilename,error)) {
@@ -397,14 +398,14 @@ int DFGetFile(const char *concreteFilename,
         goto end;
     }
 
-    r = 1;
+    success = 1;
 
 end:
     free(abstractPath);
     DFStorageRelease(abstractStorage);
     DFConcreteDocumentRelease(concreteDoc);
     DFAbstractDocumentRelease(abstractDoc);
-    return r;
+    return success;
 }
 
 int DFPutFile(const char *concreteFilename,


Mime
View raw message