You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@corinthia.apache.org by ja...@apache.org on 2015/01/02 18:10:30 UTC

incubator-corinthia git commit: Removed #ifdef WIN32 in all sources outside platform

Repository: incubator-corinthia
Updated Branches:
  refs/heads/master f27803f4c -> 42c3c7240


Removed #ifdef WIN32 in all sources outside platform

DFPlatform.h has been updated to include a couple of differences,
DFPlatform.h has been moved to DocFormats/headers, because some of the functions will be handy for
consumers.
CMakeFile.txt has been updated to the new location of DFPLatform.c
createDirectory() in 2 consumers has been moved to DFFilesystem.c and made portable.


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

Branch: refs/heads/master
Commit: 42c3c72406c41cc3b4ad644417ebe941cbc1be53
Parents: f27803f
Author: jani <ja...@apache.org>
Authored: Fri Jan 2 18:06:58 2015 +0100
Committer: jani <ja...@apache.org>
Committed: Fri Jan 2 18:06:58 2015 +0100

----------------------------------------------------------------------
 DocFormats/CMakeLists.txt                       | 14 +++-
 DocFormats/api/CMakeLists.txt                   |  1 -
 DocFormats/core/CMakeLists.txt                  |  1 -
 DocFormats/core/src/html/DFHTML.c               |  1 +
 DocFormats/core/src/lib/DFFilesystem.c          | 24 +++++--
 DocFormats/core/src/lib/DFFilesystem.h          |  2 +-
 DocFormats/core/src/lib/DFHashTable.c           |  1 +
 DocFormats/core/src/lib/DFString.c              |  1 +
 DocFormats/core/src/xml/DFDOM.c                 |  1 +
 DocFormats/core/src/xml/DFMarkupCompatibility.c |  1 +
 DocFormats/core/src/xml/DFXML.c                 |  1 +
 DocFormats/core/tests/css/CSSTests.c            |  1 +
 DocFormats/filters/latex/CMakeLists.txt         |  1 -
 DocFormats/filters/latex/src/HTMLToLaTeX.c      |  1 +
 DocFormats/filters/odf/CMakeLists.txt           |  1 -
 DocFormats/filters/ooxml/CMakeLists.txt         |  1 -
 .../filters/ooxml/src/word/WordConverter.c      |  1 +
 DocFormats/filters/ooxml/src/word/WordLists.c   |  1 +
 .../filters/ooxml/src/word/WordNumbering.c      |  1 +
 .../filters/ooxml/src/word/formatting/WordPPr.c |  1 +
 .../filters/ooxml/src/word/formatting/WordRPr.c |  1 +
 .../filters/ooxml/src/word/lenses/WordField.c   |  1 +
 DocFormats/filters/ooxml/tests/word/WordPlain.c |  1 +
 DocFormats/filters/ooxml/tests/word/WordTests.c |  1 +
 DocFormats/headers/DFCommon.h                   |  7 --
 DocFormats/headers/DFPlatform.h                 | 72 ++++++++++++++++++++
 DocFormats/headers/DFTypes.h                    |  4 --
 DocFormats/platform/CMakeLists.txt              | 11 +--
 DocFormats/platform/headers/DFPlatform.h        | 54 ---------------
 DocFormats/platform/src/Win32.c                 |  3 -
 DocFormats/unittest/CMakeLists.txt              |  1 -
 consumers/dftest/src/main.c                     | 29 +-------
 consumers/dfutil/src/CMakeLists.txt             |  1 -
 consumers/dfutil/src/Commands.c                 | 30 +-------
 consumers/dfutil/src/Commands.h                 |  2 -
 35 files changed, 127 insertions(+), 148 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-corinthia/blob/42c3c724/DocFormats/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/DocFormats/CMakeLists.txt b/DocFormats/CMakeLists.txt
index ce72d7b..c21a05f 100644
--- a/DocFormats/CMakeLists.txt
+++ b/DocFormats/CMakeLists.txt
@@ -43,6 +43,16 @@ set(GroupSrcRoot
 
 
 ###
+## group main headers
+###
+set(GroupHeaderRoot
+    headers/DFCommon.h
+    headers/DFCore.h
+    headers/DFPlatform.h
+	headers/DFTypes.h)
+
+
+###
 ## group subproject objects
 ###
 set(GroupObjRoot
@@ -61,7 +71,9 @@ set(GroupObjRoot
 ###
 add_library(DocFormats
     ${GroupSrcRoot}
+    ${GroupHeaderRoot}
     ${GroupObjRoot})
 
-source_group(src FILES ${GroupSrcRoot})
+source_group(src     FILES ${GroupSrcRoot})
+source_group(headers FILES ${GroupHeaderRoot})
 set_property(TARGET DocFormats PROPERTY FOLDER DocFormats)

http://git-wip-us.apache.org/repos/asf/incubator-corinthia/blob/42c3c724/DocFormats/api/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/DocFormats/api/CMakeLists.txt b/DocFormats/api/CMakeLists.txt
index 4df69cc..e0146ef 100644
--- a/DocFormats/api/CMakeLists.txt
+++ b/DocFormats/api/CMakeLists.txt
@@ -48,7 +48,6 @@ include_directories(../../DocFormats/3rdparty/external/w3c-tidy-html5/src)
 include_directories(SYSTEM ${INCLUDE_DIRS})
 include_directories(SYSTEM ../api/headers)
 include_directories(../headers)
-include_directories(../platform/headers)
 include_directories(../core/src/common)
 include_directories(../core/src/css)
 include_directories(../core/src/html)

http://git-wip-us.apache.org/repos/asf/incubator-corinthia/blob/42c3c724/DocFormats/core/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/DocFormats/core/CMakeLists.txt b/DocFormats/core/CMakeLists.txt
index 9590118..02212cc 100644
--- a/DocFormats/core/CMakeLists.txt
+++ b/DocFormats/core/CMakeLists.txt
@@ -151,7 +151,6 @@ include_directories(../../DocFormats/platform/3rdparty/w3c-tidy-html5/include)
 include_directories(../../DocFormats/platform/3rdparty//w3c-tidy-html5/src)
 include_directories(SYSTEM ${INCLUDE_DIRS})
 include_directories(SYSTEM ../api/headers)
-include_directories(../platform/headers)
 include_directories(src/common)
 include_directories(src/css)
 include_directories(src/html)

http://git-wip-us.apache.org/repos/asf/incubator-corinthia/blob/42c3c724/DocFormats/core/src/html/DFHTML.c
----------------------------------------------------------------------
diff --git a/DocFormats/core/src/html/DFHTML.c b/DocFormats/core/src/html/DFHTML.c
index afa5f49..0f2a348 100644
--- a/DocFormats/core/src/html/DFHTML.c
+++ b/DocFormats/core/src/html/DFHTML.c
@@ -12,6 +12,7 @@
 // See the License for the specific language governing permissions and
 // limitations under the License.
 
+#include "DFPlatform.h"
 #include "DFHTML.h"
 #include "DFFilesystem.h"
 #include "DFDOM.h"

http://git-wip-us.apache.org/repos/asf/incubator-corinthia/blob/42c3c724/DocFormats/core/src/lib/DFFilesystem.c
----------------------------------------------------------------------
diff --git a/DocFormats/core/src/lib/DFFilesystem.c b/DocFormats/core/src/lib/DFFilesystem.c
index e4d4ab7..b6707ef 100644
--- a/DocFormats/core/src/lib/DFFilesystem.c
+++ b/DocFormats/core/src/lib/DFFilesystem.c
@@ -26,11 +26,9 @@
 #include <stdlib.h>
 #include <string.h>
 #include <sys/stat.h>
-#ifdef WIN32
-#include <direct.h>
-#else
-#include <unistd.h>
-#endif
+#include <io.h>
+
+
 
 int DFFileExists(const char *path)
 {
@@ -394,3 +392,19 @@ char *DFRemovePercentEncoding(const char *encoded)
     output[outpos] = 0;
     return output;
 }
+
+
+char *DFCreateTempDir(DFError **error)
+{
+    char *ctemplate = strdup("dfutil.XXXXXX");
+    char *name      = mktemp(ctemplate);
+    if (!name) {
+        free(ctemplate);
+        return NULL;
+    }
+    if (!DFCreateDirectory(name, 1, error)) {
+        free(ctemplate);
+        return NULL;
+    }
+    return name;
+}

http://git-wip-us.apache.org/repos/asf/incubator-corinthia/blob/42c3c724/DocFormats/core/src/lib/DFFilesystem.h
----------------------------------------------------------------------
diff --git a/DocFormats/core/src/lib/DFFilesystem.h b/DocFormats/core/src/lib/DFFilesystem.h
index f597720..b1536e1 100644
--- a/DocFormats/core/src/lib/DFFilesystem.h
+++ b/DocFormats/core/src/lib/DFFilesystem.h
@@ -34,5 +34,5 @@ char *DFPathWithoutExtension(const char *path);
 char *DFPathResolveAbsolute(const char *base, const char *relative);
 char *DFPathNormalize(const char *path);
 char *DFRemovePercentEncoding(const char *encoded);
-
+char *DFCreateTempDir(DFError **error);
 #endif

http://git-wip-us.apache.org/repos/asf/incubator-corinthia/blob/42c3c724/DocFormats/core/src/lib/DFHashTable.c
----------------------------------------------------------------------
diff --git a/DocFormats/core/src/lib/DFHashTable.c b/DocFormats/core/src/lib/DFHashTable.c
index 88d46aa..6a1cfe8 100644
--- a/DocFormats/core/src/lib/DFHashTable.c
+++ b/DocFormats/core/src/lib/DFHashTable.c
@@ -12,6 +12,7 @@
 // See the License for the specific language governing permissions and
 // limitations under the License.
 
+#include "DFPlatform.h"
 #include "DFHashTable.h"
 #include "DFCommon.h"
 #include <assert.h>

http://git-wip-us.apache.org/repos/asf/incubator-corinthia/blob/42c3c724/DocFormats/core/src/lib/DFString.c
----------------------------------------------------------------------
diff --git a/DocFormats/core/src/lib/DFString.c b/DocFormats/core/src/lib/DFString.c
index a2be219..b768ef4 100644
--- a/DocFormats/core/src/lib/DFString.c
+++ b/DocFormats/core/src/lib/DFString.c
@@ -12,6 +12,7 @@
 // See the License for the specific language governing permissions and
 // limitations under the License.
 
+#include "DFPlatform.h"
 #include "DFString.h"
 #include "DFBuffer.h"
 #include "DFCharacterSet.h"

http://git-wip-us.apache.org/repos/asf/incubator-corinthia/blob/42c3c724/DocFormats/core/src/xml/DFDOM.c
----------------------------------------------------------------------
diff --git a/DocFormats/core/src/xml/DFDOM.c b/DocFormats/core/src/xml/DFDOM.c
index c5de0ab..413880e 100644
--- a/DocFormats/core/src/xml/DFDOM.c
+++ b/DocFormats/core/src/xml/DFDOM.c
@@ -12,6 +12,7 @@
 // See the License for the specific language governing permissions and
 // limitations under the License.
 
+#include "DFPlatform.h"
 #include "DFDOM.h"
 #include "DFXMLNames.h"
 #include "DFHashTable.h"

http://git-wip-us.apache.org/repos/asf/incubator-corinthia/blob/42c3c724/DocFormats/core/src/xml/DFMarkupCompatibility.c
----------------------------------------------------------------------
diff --git a/DocFormats/core/src/xml/DFMarkupCompatibility.c b/DocFormats/core/src/xml/DFMarkupCompatibility.c
index 18bc1ac..33dc69d 100644
--- a/DocFormats/core/src/xml/DFMarkupCompatibility.c
+++ b/DocFormats/core/src/xml/DFMarkupCompatibility.c
@@ -12,6 +12,7 @@
 // See the License for the specific language governing permissions and
 // limitations under the License.
 
+#include "DFPlatform.h"
 #include "DFMarkupCompatibility.h"
 #include "DFNameMap.h"
 #include "DFString.h"

http://git-wip-us.apache.org/repos/asf/incubator-corinthia/blob/42c3c724/DocFormats/core/src/xml/DFXML.c
----------------------------------------------------------------------
diff --git a/DocFormats/core/src/xml/DFXML.c b/DocFormats/core/src/xml/DFXML.c
index cf9a4f4..2172651 100644
--- a/DocFormats/core/src/xml/DFXML.c
+++ b/DocFormats/core/src/xml/DFXML.c
@@ -12,6 +12,7 @@
 // See the License for the specific language governing permissions and
 // limitations under the License.
 
+#include "DFPlatform.h"
 #include "DFXML.h"
 #include "DFDOM.h"
 #include "DFMarkupCompatibility.h"

http://git-wip-us.apache.org/repos/asf/incubator-corinthia/blob/42c3c724/DocFormats/core/tests/css/CSSTests.c
----------------------------------------------------------------------
diff --git a/DocFormats/core/tests/css/CSSTests.c b/DocFormats/core/tests/css/CSSTests.c
index ea2bbc1..4612588 100644
--- a/DocFormats/core/tests/css/CSSTests.c
+++ b/DocFormats/core/tests/css/CSSTests.c
@@ -12,6 +12,7 @@
 // See the License for the specific language governing permissions and
 // limitations under the License.
 
+#include "DFPlatform.h"
 #include "DFUnitTest.h"
 #include "DFHashTable.h"
 #include "DFBuffer.h"

http://git-wip-us.apache.org/repos/asf/incubator-corinthia/blob/42c3c724/DocFormats/filters/latex/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/DocFormats/filters/latex/CMakeLists.txt b/DocFormats/filters/latex/CMakeLists.txt
index 0aca5e3..4cdf023 100644
--- a/DocFormats/filters/latex/CMakeLists.txt
+++ b/DocFormats/filters/latex/CMakeLists.txt
@@ -35,7 +35,6 @@ include_directories(../../DocFormats/3rdparty/external/w3c-tidy-html5/src)
 include_directories(SYSTEM ${INCLUDE_DIRS})
 include_directories(SYSTEM ../../api/headers)
 include_directories(../../headers)
-include_directories(../../platform/headers)
 include_directories(../../core/src/common)
 include_directories(../../core/src/css)
 include_directories(../../core/src/html)

http://git-wip-us.apache.org/repos/asf/incubator-corinthia/blob/42c3c724/DocFormats/filters/latex/src/HTMLToLaTeX.c
----------------------------------------------------------------------
diff --git a/DocFormats/filters/latex/src/HTMLToLaTeX.c b/DocFormats/filters/latex/src/HTMLToLaTeX.c
index 2db204f..10be122 100644
--- a/DocFormats/filters/latex/src/HTMLToLaTeX.c
+++ b/DocFormats/filters/latex/src/HTMLToLaTeX.c
@@ -12,6 +12,7 @@
 // See the License for the specific language governing permissions and
 // limitations under the License.
 
+#include "DFPlatform.h"
 #include "HTMLToLaTeX.h"
 #include "DFHTML.h"
 #include "DFTable.h"

http://git-wip-us.apache.org/repos/asf/incubator-corinthia/blob/42c3c724/DocFormats/filters/odf/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/DocFormats/filters/odf/CMakeLists.txt b/DocFormats/filters/odf/CMakeLists.txt
index 4673096..7787ad6 100644
--- a/DocFormats/filters/odf/CMakeLists.txt
+++ b/DocFormats/filters/odf/CMakeLists.txt
@@ -41,7 +41,6 @@ include_directories(../../DocFormats/3rdparty/external/w3c-tidy-html5/src)
 include_directories(SYSTEM ${INCLUDE_DIRS})
 include_directories(SYSTEM ../../api/headers)
 include_directories(../../headers)
-include_directories(../../platform/headers)
 include_directories(../../core/src/common)
 include_directories(../../core/src/css)
 include_directories(../../core/src/html)

http://git-wip-us.apache.org/repos/asf/incubator-corinthia/blob/42c3c724/DocFormats/filters/ooxml/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/DocFormats/filters/ooxml/CMakeLists.txt b/DocFormats/filters/ooxml/CMakeLists.txt
index acc28c2..92f46f8 100644
--- a/DocFormats/filters/ooxml/CMakeLists.txt
+++ b/DocFormats/filters/ooxml/CMakeLists.txt
@@ -127,7 +127,6 @@ include_directories(../../DocFormats/3rdparty/external/w3c-tidy-html5/src)
 include_directories(SYSTEM ${INCLUDE_DIRS})
 include_directories(SYSTEM ../../api/headers)
 include_directories(../../headers)
-include_directories(../../platform/headers)
 include_directories(../../core/src/common)
 include_directories(../../core/src/css)
 include_directories(../../core/src/html)

http://git-wip-us.apache.org/repos/asf/incubator-corinthia/blob/42c3c724/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 33dacaa..5e3a2fa 100644
--- a/DocFormats/filters/ooxml/src/word/WordConverter.c
+++ b/DocFormats/filters/ooxml/src/word/WordConverter.c
@@ -12,6 +12,7 @@
 // See the License for the specific language governing permissions and
 // limitations under the License.
 
+#include "DFPlatform.h"
 #include "WordConverter.h"
 #include "WordBookmark.h"
 #include "WordField.h"

http://git-wip-us.apache.org/repos/asf/incubator-corinthia/blob/42c3c724/DocFormats/filters/ooxml/src/word/WordLists.c
----------------------------------------------------------------------
diff --git a/DocFormats/filters/ooxml/src/word/WordLists.c b/DocFormats/filters/ooxml/src/word/WordLists.c
index e8aef52..8416fce 100644
--- a/DocFormats/filters/ooxml/src/word/WordLists.c
+++ b/DocFormats/filters/ooxml/src/word/WordLists.c
@@ -12,6 +12,7 @@
 // See the License for the specific language governing permissions and
 // limitations under the License.
 
+#include "DFPlatform.h"
 #include "WordLists.h"
 #include "DFDOM.h"
 #include "CSSProperties.h"

http://git-wip-us.apache.org/repos/asf/incubator-corinthia/blob/42c3c724/DocFormats/filters/ooxml/src/word/WordNumbering.c
----------------------------------------------------------------------
diff --git a/DocFormats/filters/ooxml/src/word/WordNumbering.c b/DocFormats/filters/ooxml/src/word/WordNumbering.c
index e8914c8..76408e5 100644
--- a/DocFormats/filters/ooxml/src/word/WordNumbering.c
+++ b/DocFormats/filters/ooxml/src/word/WordNumbering.c
@@ -12,6 +12,7 @@
 // See the License for the specific language governing permissions and
 // limitations under the License.
 
+#include "DFPlatform.h"
 #include "WordNumbering.h"
 #include "WordStyles.h"
 #include "DFDOM.h"

http://git-wip-us.apache.org/repos/asf/incubator-corinthia/blob/42c3c724/DocFormats/filters/ooxml/src/word/formatting/WordPPr.c
----------------------------------------------------------------------
diff --git a/DocFormats/filters/ooxml/src/word/formatting/WordPPr.c b/DocFormats/filters/ooxml/src/word/formatting/WordPPr.c
index a837149..a40da92 100644
--- a/DocFormats/filters/ooxml/src/word/formatting/WordPPr.c
+++ b/DocFormats/filters/ooxml/src/word/formatting/WordPPr.c
@@ -12,6 +12,7 @@
 // See the License for the specific language governing permissions and
 // limitations under the License.
 
+#include "DFPlatform.h"
 #include "WordPPr.h"
 #include "WordStyles.h"
 #include "WordSection.h"

http://git-wip-us.apache.org/repos/asf/incubator-corinthia/blob/42c3c724/DocFormats/filters/ooxml/src/word/formatting/WordRPr.c
----------------------------------------------------------------------
diff --git a/DocFormats/filters/ooxml/src/word/formatting/WordRPr.c b/DocFormats/filters/ooxml/src/word/formatting/WordRPr.c
index 87f16d8..551d145 100644
--- a/DocFormats/filters/ooxml/src/word/formatting/WordRPr.c
+++ b/DocFormats/filters/ooxml/src/word/formatting/WordRPr.c
@@ -12,6 +12,7 @@
 // See the License for the specific language governing permissions and
 // limitations under the License.
 
+#include "DFPlatform.h"
 #include "WordRPr.h"
 #include "WordStyles.h"
 #include "WordTheme.h"

http://git-wip-us.apache.org/repos/asf/incubator-corinthia/blob/42c3c724/DocFormats/filters/ooxml/src/word/lenses/WordField.c
----------------------------------------------------------------------
diff --git a/DocFormats/filters/ooxml/src/word/lenses/WordField.c b/DocFormats/filters/ooxml/src/word/lenses/WordField.c
index 240736e..9235a45 100644
--- a/DocFormats/filters/ooxml/src/word/lenses/WordField.c
+++ b/DocFormats/filters/ooxml/src/word/lenses/WordField.c
@@ -12,6 +12,7 @@
 // See the License for the specific language governing permissions and
 // limitations under the License.
 
+#include "DFPlatform.h"
 #include "WordField.h"
 #include "WordLenses.h"
 #include "WordBookmark.h"

http://git-wip-us.apache.org/repos/asf/incubator-corinthia/blob/42c3c724/DocFormats/filters/ooxml/tests/word/WordPlain.c
----------------------------------------------------------------------
diff --git a/DocFormats/filters/ooxml/tests/word/WordPlain.c b/DocFormats/filters/ooxml/tests/word/WordPlain.c
index 13a25aa..ffbbe8a 100644
--- a/DocFormats/filters/ooxml/tests/word/WordPlain.c
+++ b/DocFormats/filters/ooxml/tests/word/WordPlain.c
@@ -12,6 +12,7 @@
 // See the License for the specific language governing permissions and
 // limitations under the License.
 
+#include "DFPlatform.h"
 #include "WordPlain.h"
 #include "TextPackage.h"
 #include "OPC.h"

http://git-wip-us.apache.org/repos/asf/incubator-corinthia/blob/42c3c724/DocFormats/filters/ooxml/tests/word/WordTests.c
----------------------------------------------------------------------
diff --git a/DocFormats/filters/ooxml/tests/word/WordTests.c b/DocFormats/filters/ooxml/tests/word/WordTests.c
index fc6df68..270403d 100644
--- a/DocFormats/filters/ooxml/tests/word/WordTests.c
+++ b/DocFormats/filters/ooxml/tests/word/WordTests.c
@@ -12,6 +12,7 @@
 // See the License for the specific language governing permissions and
 // limitations under the License.
 
+#include "DFPlatform.h"
 #include "DFUnitTest.h"
 #include "DFCommon.h"
 #include "WordPlain.h"

http://git-wip-us.apache.org/repos/asf/incubator-corinthia/blob/42c3c724/DocFormats/headers/DFCommon.h
----------------------------------------------------------------------
diff --git a/DocFormats/headers/DFCommon.h b/DocFormats/headers/DFCommon.h
index d6cdbd7..27b3e5c 100644
--- a/DocFormats/headers/DFCommon.h
+++ b/DocFormats/headers/DFCommon.h
@@ -17,13 +17,6 @@
 
 #include "DFTypes.h"
 
-#ifdef WIN32
-#define snprintf _snprintf
-#define strcasecmp _stricmp
-#define bzero(mem,size) memset(mem,0,size)
-#else // not WIN32
-#endif
-
 #ifndef S_ISDIR
 #define S_ISDIR(m)      (((m) & S_IFMT) == S_IFDIR)     /* directory */
 #endif

http://git-wip-us.apache.org/repos/asf/incubator-corinthia/blob/42c3c724/DocFormats/headers/DFPlatform.h
----------------------------------------------------------------------
diff --git a/DocFormats/headers/DFPlatform.h b/DocFormats/headers/DFPlatform.h
new file mode 100755
index 0000000..f36269f
--- /dev/null
+++ b/DocFormats/headers/DFPlatform.h
@@ -0,0 +1,72 @@
+// Copyright 2012-2014 UX Productivity Pty Ltd
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+#ifndef DocFormats_DFPlatform_h
+#define DocFormats_DFPlatform_h
+
+#ifdef WIN32
+#include <direct.h>
+
+#define _CRT_SECURE_NO_WARNINGS
+#define snprintf _snprintf
+#define strcasecmp _stricmp
+#define mktemp _mktemp
+#define mkdir  _mkdir
+#define bzero(mem,size) memset(mem,0,size)
+
+#ifndef snprintf
+#define snprintf _snprintf
+#endif
+
+#else
+#include <unistd.h>
+#endif
+
+
+
+typedef struct DFDirEntryList DFDirEntryList;
+
+struct DFDirEntryList {
+    char *name;
+    DFDirEntryList *next;
+};
+
+int DFMkdirIfAbsent(const char *path, char **errmsg);
+int DFAddDirContents(const char *absPath, const char *relPath, int recursive, DFDirEntryList ***list, char **errmsg);
+int DFGetImageDimensions(const void *data, size_t len, const char *ext,
+                         unsigned int *width, unsigned int *height, char **errmsg);
+
+#define DF_ONCE_INIT 0
+typedef int DFOnce;
+typedef void (*DFOnceFunction)(void);
+void DFInitOnce(DFOnce *once, DFOnceFunction fun);
+
+// Zip functions
+typedef struct {
+        void *handle;
+        int   zipFlag;
+        int   zipFirst;
+        } DFextZipHandle;
+typedef DFextZipHandle * DFextZipHandleP;
+
+DFextZipHandleP DFextZipOpen(const char *zipFilename, int doUnzip);
+int             DFextZipClose(DFextZipHandleP zipHandle);
+
+int             DFextZipOpenNextFile(DFextZipHandleP zipHandle, char *entryName, const int maxName);
+int             DFextZipAppendNewFile(DFextZipHandleP zipHandle, const char *entryName);
+int             DFextZipCloseFile(DFextZipHandleP zipHandle);
+
+int DFextZipReadCurrentFile(DFextZipHandleP zipHandle, void *buf, const int maxLen);
+int DFextZipWriteCurrentFile(DFextZipHandleP zipHandle, const void *buf, const int len);
+#endif

http://git-wip-us.apache.org/repos/asf/incubator-corinthia/blob/42c3c724/DocFormats/headers/DFTypes.h
----------------------------------------------------------------------
diff --git a/DocFormats/headers/DFTypes.h b/DocFormats/headers/DFTypes.h
index d8fe590..3b563c0 100644
--- a/DocFormats/headers/DFTypes.h
+++ b/DocFormats/headers/DFTypes.h
@@ -23,10 +23,6 @@
 #define ATTRIBUTE_FORMAT(archetype,index,first) __attribute__((format(archetype,index,first)))
 #endif
 
-#ifdef WIN32
-#define _CRT_SECURE_NO_WARNINGS
-#endif
-
 #include <sys/types.h>
 #include <stdint.h>
 #include <stdarg.h>

http://git-wip-us.apache.org/repos/asf/incubator-corinthia/blob/42c3c724/DocFormats/platform/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/DocFormats/platform/CMakeLists.txt b/DocFormats/platform/CMakeLists.txt
index f3752e9..f3ba68b 100644
--- a/DocFormats/platform/CMakeLists.txt
+++ b/DocFormats/platform/CMakeLists.txt
@@ -88,13 +88,6 @@ set(GroupHtml5
     3rdparty/w3c-tidy-html5/src/win32tc.h
    )
 
-
-###
-## group platform code
-###
-set(GroupHeaders
-    headers/DFPlatform.h)
-
 set(GroupSrc
     src/Apple.c
     src/Linux.c
@@ -117,7 +110,7 @@ include_directories(3rdparty/w3c-tidy-html5/include)
 include_directories(3rdparty/w3c-tidy-html5/src)
 include_directories(../../external/include)
 include_directories(SYSTEM ${INCLUDE_DIRS})
-include_directories(headers)
+include_directories(../headers)
 include_directories(../unittest)
 
 
@@ -128,10 +121,8 @@ include_directories(../unittest)
 add_library(platform OBJECT
     ${GroupMinizip}
     ${GroupHtml5}
-    ${GroupHeaders}
     ${GroupSrc}
     ${GroupTests})
-source_group(headers             FILES ${GroupHeaders})
 source_group(src                 FILES ${GroupSrc})
 source_group(tests               FILES ${GroupTests})
 source_group(src\\minizip        FILES ${GroupMinizip})

http://git-wip-us.apache.org/repos/asf/incubator-corinthia/blob/42c3c724/DocFormats/platform/headers/DFPlatform.h
----------------------------------------------------------------------
diff --git a/DocFormats/platform/headers/DFPlatform.h b/DocFormats/platform/headers/DFPlatform.h
deleted file mode 100755
index 6f16983..0000000
--- a/DocFormats/platform/headers/DFPlatform.h
+++ /dev/null
@@ -1,54 +0,0 @@
-// Copyright 2012-2014 UX Productivity Pty Ltd
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-#ifndef DocFormats_DFPlatform_h
-#define DocFormats_DFPlatform_h
-
-#include <stddef.h>
-
-typedef struct DFDirEntryList DFDirEntryList;
-
-struct DFDirEntryList {
-    char *name;
-    DFDirEntryList *next;
-};
-
-int DFMkdirIfAbsent(const char *path, char **errmsg);
-int DFAddDirContents(const char *absPath, const char *relPath, int recursive, DFDirEntryList ***list, char **errmsg);
-int DFGetImageDimensions(const void *data, size_t len, const char *ext,
-                         unsigned int *width, unsigned int *height, char **errmsg);
-
-#define DF_ONCE_INIT 0
-typedef int DFOnce;
-typedef void (*DFOnceFunction)(void);
-void DFInitOnce(DFOnce *once, DFOnceFunction fun);
-
-// Zip functions
-typedef struct {
-        void *handle;
-        int   zipFlag;
-        int   zipFirst;
-        } DFextZipHandle;
-typedef DFextZipHandle * DFextZipHandleP;
-
-DFextZipHandleP DFextZipOpen(const char *zipFilename, int doUnzip);
-int             DFextZipClose(DFextZipHandleP zipHandle);
-
-int             DFextZipOpenNextFile(DFextZipHandleP zipHandle, char *entryName, const int maxName);
-int             DFextZipAppendNewFile(DFextZipHandleP zipHandle, const char *entryName);
-int             DFextZipCloseFile(DFextZipHandleP zipHandle);
-
-int DFextZipReadCurrentFile(DFextZipHandleP zipHandle, void *buf, const int maxLen);
-int DFextZipWriteCurrentFile(DFextZipHandleP zipHandle, const void *buf, const int len);
-#endif

http://git-wip-us.apache.org/repos/asf/incubator-corinthia/blob/42c3c724/DocFormats/platform/src/Win32.c
----------------------------------------------------------------------
diff --git a/DocFormats/platform/src/Win32.c b/DocFormats/platform/src/Win32.c
index d5a0ff5..f17303e 100755
--- a/DocFormats/platform/src/Win32.c
+++ b/DocFormats/platform/src/Win32.c
@@ -22,9 +22,6 @@
 #include <SDL_image.h>
 #include <stdio.h>
 
-#ifndef snprintf
-#define snprintf _snprintf
-#endif
 
 static void DFErrorMsgSetWin32(char **errmsg, DWORD code)
 {

http://git-wip-us.apache.org/repos/asf/incubator-corinthia/blob/42c3c724/DocFormats/unittest/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/DocFormats/unittest/CMakeLists.txt b/DocFormats/unittest/CMakeLists.txt
index f1d7d7e..750bb3b 100644
--- a/DocFormats/unittest/CMakeLists.txt
+++ b/DocFormats/unittest/CMakeLists.txt
@@ -32,7 +32,6 @@ include_directories(../../DocFormats/3rdparty/external/w3c-tidy-html5/src)
 include_directories(SYSTEM ${INCLUDE_DIRS})
 include_directories(SYSTEM ../api/headers)
 include_directories(../headers)
-include_directories(../platform/headers)
 include_directories(../core/src/common)
 include_directories(../core/src/css)
 include_directories(../core/src/html)

http://git-wip-us.apache.org/repos/asf/incubator-corinthia/blob/42c3c724/consumers/dftest/src/main.c
----------------------------------------------------------------------
diff --git a/consumers/dftest/src/main.c b/consumers/dftest/src/main.c
index 737bf7f..1cc1f69 100644
--- a/consumers/dftest/src/main.c
+++ b/consumers/dftest/src/main.c
@@ -12,6 +12,7 @@
 // See the License for the specific language governing permissions and
 // limitations under the License.
 
+#include "DFPlatform.h"
 #include "DFUnitTest.h"
 #include "TextPackage.h"
 #include "DFString.h"
@@ -24,9 +25,6 @@
 #include <stdlib.h>
 #include <string.h>
 #include <errno.h>
-#ifndef WIN32
-#include <unistd.h>
-#endif
 
 extern TestGroup APITests;
 extern TestGroup CSSTests;
@@ -62,29 +60,6 @@ typedef struct {
     int failed;
 } TestHarness;
 
-char *createTempDir(DFError **error)
-{
-#ifdef WIN32
-    // Windows lacks mkdtemp. For the purposes of a single-threaded app it's ok just to use the same name
-    // each time we do a conversion, as long as we ensure that the directory is cleared first.
-    const char *name = "dfutil.temp";
-    if (DFFileExists(name) && !DFDeleteFile(name,error))
-        return NULL;
-    if (!DFCreateDirectory(name,1,error))
-        return NULL;
-    return strdup(name);
-#else
-    char *ctemplate = strdup("dfutil.XXXXXX");
-    char *r = mkdtemp(ctemplate);
-    if (r == NULL) {
-        DFErrorFormat(error,"mkdtemp: %s",strerror(errno));
-        free(ctemplate);
-        return NULL;
-    }
-    return ctemplate;
-#endif
-}
-
 static int diffResults2(const char *from, const char *to, const char *tempDir, DFError **error)
 {
     char *fromFilename = DFAppendPathComponent(tempDir,"from");
@@ -109,7 +84,7 @@ static int diffResults2(const char *from, const char *to, const char *tempDir, D
 
 static int diffResults(const char *from, const char *to, DFError **error)
 {
-    char *tempDir = createTempDir(error);
+    char *tempDir = DFCreateTempDir(error);
     if (tempDir == NULL)
         return 0;
 

http://git-wip-us.apache.org/repos/asf/incubator-corinthia/blob/42c3c724/consumers/dfutil/src/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/consumers/dfutil/src/CMakeLists.txt b/consumers/dfutil/src/CMakeLists.txt
index 9c511a9..6847569 100644
--- a/consumers/dfutil/src/CMakeLists.txt
+++ b/consumers/dfutil/src/CMakeLists.txt
@@ -43,7 +43,6 @@ include_directories(SYSTEM ../../../DocFormats/api/headers)
 include_directories(.)
 include_directories(../../../DocFormats/headers)
 include_directories(../../../DocFormats/unittest)
-include_directories(../../../DocFormats/platform/headers)
 include_directories(../../../DocFormats/core/src/common)
 include_directories(../../../DocFormats/core/src/css)
 include_directories(../../../DocFormats/core/src/html)

http://git-wip-us.apache.org/repos/asf/incubator-corinthia/blob/42c3c724/consumers/dfutil/src/Commands.c
----------------------------------------------------------------------
diff --git a/consumers/dfutil/src/Commands.c b/consumers/dfutil/src/Commands.c
index 626ff93..f1054d9 100644
--- a/consumers/dfutil/src/Commands.c
+++ b/consumers/dfutil/src/Commands.c
@@ -12,6 +12,7 @@
 // See the License for the specific language governing permissions and
 // limitations under the License.
 
+#include "DFPlatform.h"
 #include "Commands.h"
 #include "BDTTests.h"
 #include "WordPlain.h"
@@ -34,9 +35,6 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
-#ifndef WIN32
-#include <unistd.h>
-#endif
 
 static DFBuffer *readData(const char *filename, DFError **error)
 {
@@ -104,7 +102,7 @@ static int prettyPrintXMLFile(const char *filename, int html, DFError **error)
 
 static int prettyPrintWordFile(const char *filename, DFError **error)
 {
-    char *tempPath = createTempDir(error);
+    char *tempPath = DFCreateTempDir(error);
     if (tempPath == NULL)
         return 0;;
     int ok = 0;
@@ -187,7 +185,7 @@ int fromPlain(const char *inFilename, const char *outFilename, DFError **error)
     if (inStr == NULL)
         return 0;
 
-    char *tempPath = createTempDir(error);
+    char *tempPath = DFCreateTempDir(error);
     if (tempPath == NULL) {
         free(inStr);
         return 0;
@@ -424,25 +422,3 @@ int unescapeCSSIdent(const char *filename, DFError **error)
     return 1;
 }
 
-char *createTempDir(DFError **error)
-{
-#ifdef WIN32
-    // Windows lacks mkdtemp. For the purposes of a single-threaded app it's ok just to use the same name
-    // each time we do a conversion, as long as we ensure that the directory is cleared first.
-    const char *name = "dfutil.temp";
-    if (DFFileExists(name) && !DFDeleteFile(name,error))
-        return NULL;
-    if (!DFCreateDirectory(name,1,error))
-        return NULL;
-    return strdup(name);
-#else
-    char *ctemplate = strdup("dfutil.XXXXXX");
-    char *r = mkdtemp(ctemplate);
-    if (r == NULL) {
-        DFErrorFormat(error,"mkdtemp: %s",strerror(errno));
-        free(ctemplate);
-        return NULL;
-    }
-    return ctemplate;
-#endif
-}

http://git-wip-us.apache.org/repos/asf/incubator-corinthia/blob/42c3c724/consumers/dfutil/src/Commands.h
----------------------------------------------------------------------
diff --git a/consumers/dfutil/src/Commands.h b/consumers/dfutil/src/Commands.h
index e8acef8..69b8912 100644
--- a/consumers/dfutil/src/Commands.h
+++ b/consumers/dfutil/src/Commands.h
@@ -33,6 +33,4 @@ int stobFile(const char *inFilename, const char *outFilename, DFError **error);
 int escapeCSSIdent(const char *filename, DFError **error);
 int unescapeCSSIdent(const char *filename, DFError **error);
 
-char *createTempDir(DFError **error);
-
 #endif