[libkml] 02/06: Imported Upstream version 1.3.0~rc2

Sebastiaan Couwenberg sebastic at moszumanska.debian.org
Tue Dec 1 22:56:05 UTC 2015


This is an automated email from the git hooks/post-receive script.

sebastic pushed a commit to branch master
in repository libkml.

commit f84b64be6c239ff62f8768d6d0d9e332de464b56
Author: Bas Couwenberg <sebastic at xs4all.nl>
Date:   Tue Dec 1 23:17:52 2015 +0100

    Imported Upstream version 1.3.0~rc2
---
 CMakeLists.txt                              | 11 +++++--
 src/kml/base/contrib/minizip/iomem_simple.c |  4 +--
 src/kml/base/contrib/minizip/unzip.c        | 13 +++++---
 src/kml/dom/CMakeLists.txt                  |  1 +
 src/kml/dom/kml22.cc                        | 47 +++++++++++++++++------------
 src/kml/dom/kml22.h                         | 25 ++-------------
 src/kml/dom/xsd.cc                          | 23 ++++++++------
 7 files changed, 62 insertions(+), 62 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index eac589b..957dcc6 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -11,9 +11,9 @@ option(BUILD_EXAMPLES  "Build examples." OFF)
 option(INSTALL_EXAMPLES   "Install examples sources and executables" OFF)
 option(BUILD_SHARED_LIBS  "Build shared libs." ON)
 
-option(WITH_SWIG   "Build all swig bindings"   ON)
-option(WITH_PYTHON "Build python bindings" ON)
-option(WITH_JAVA   "Build java bindings"   ON)
+option(WITH_SWIG   "Build all swig bindings"   OFF)
+option(WITH_PYTHON "Build python bindings" OFF)
+option(WITH_JAVA   "Build java bindings"   OFF)
 
 set(LIBKML_DATA_DIR  ${CMAKE_SOURCE_DIR}/testdata CACHE "Directory containing test data" PATH)
 
@@ -22,6 +22,11 @@ set(LIBKML_DATA_DIR  ${CMAKE_SOURCE_DIR}/testdata CACHE "Directory containing te
 if(CMAKE_COMPILER_IS_GNUCXX)
 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Wno-unused-parameter -pedantic -fno-rtti")
 set(TEST_FLAGS "-Wall -Wextra -Wno-unused-parameter -fno-rtti -DGTEST_HAS_RTTI=0")
+
+else()
+ if(MSVC)
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /DUNICODE /D_UNICODE")
+ endif()
 endif()
 
 set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
diff --git a/src/kml/base/contrib/minizip/iomem_simple.c b/src/kml/base/contrib/minizip/iomem_simple.c
index eb86fd9..be89226 100644
--- a/src/kml/base/contrib/minizip/iomem_simple.c
+++ b/src/kml/base/contrib/minizip/iomem_simple.c
@@ -136,7 +136,7 @@ static uLong ZCALLBACK mem_read (opaque, stream, buf, size)
      return 0;
    }
 
-   if ( (handle->position + size) > handle->length)
+   if ( (handle->position + size) > (uLong)handle->length)
    {
       /* There is a bug in this original code. It's possible for the position
        * to exceed the size, which results in memcpy being handed a negative
@@ -162,7 +162,7 @@ static uLong ZCALLBACK mem_write (opaque, stream, buf, size)
 {
    MEMFILE* handle = (MEMFILE*) stream;
 
-   if ((handle->position + size) > handle->length)
+   if ((handle->position + size) > (uLong)handle->length)
    {
       handle->length = handle->position + size;
       handle->buffer = realloc(handle->buffer, handle->length);
diff --git a/src/kml/base/contrib/minizip/unzip.c b/src/kml/base/contrib/minizip/unzip.c
index fce867c..a062863 100644
--- a/src/kml/base/contrib/minizip/unzip.c
+++ b/src/kml/base/contrib/minizip/unzip.c
@@ -40,7 +40,7 @@ woven in by Terry Thorsen 1/2003.
 #include <stdlib.h>
 #include <string.h>
 #include <zlib.h> //RR
-#include <minizip/unzip.h> //RR
+#include "unzip.h"
 #include "iomem_simple.h"
 #undef NOUNCRYPT
 
@@ -426,7 +426,6 @@ extern unzFile ZEXPORT libkml_unzOpen2 (path, pzlib_filefunc_def)
     zlib_filefunc_def* pzlib_filefunc_def;
 {
     unz_s us;
-    init_unz_s(&us);
     
     unz_s *s;
     
@@ -442,6 +441,8 @@ extern unzFile ZEXPORT libkml_unzOpen2 (path, pzlib_filefunc_def)
 
     int err=UNZ_OK;
 
+    init_unz_s(&us);
+
     if (libkml_unz_copyright[0]!=' ')
         return NULL;
 
@@ -1652,10 +1653,12 @@ extern unzFile ZEXPORT libkml_unzAttach (stream, pzlib_filefunc_def)
     zlib_filefunc_def* pzlib_filefunc_def;
 {
     unz_s us;
-    init_unz_s(&us);
     
     unz_s *s;
-    uLong central_pos,uL;
+    
+    uLong central_pos;
+    
+    uLong uL;
 
     uLong number_disk;          /* number of the current dist, used for
                                    spaning ZIP, unsupported, always 0*/
@@ -1667,6 +1670,8 @@ extern unzFile ZEXPORT libkml_unzAttach (stream, pzlib_filefunc_def)
 
     int err=UNZ_OK;
 
+    init_unz_s(&us);
+
     if (libkml_unz_copyright[0]!=' ')
         return NULL;
 
diff --git a/src/kml/dom/CMakeLists.txt b/src/kml/dom/CMakeLists.txt
index 8290dbb..242bc7e 100644
--- a/src/kml/dom/CMakeLists.txt
+++ b/src/kml/dom/CMakeLists.txt
@@ -46,6 +46,7 @@ set(INCS
   gx_tour.h
   vec2.h
   xal.h
+  xsd.h
   visitor.h
   visitor_driver.h)
 
diff --git a/src/kml/dom/kml22.cc b/src/kml/dom/kml22.cc
index 6a2ebf4..603e22b 100644
--- a/src/kml/dom/kml22.cc
+++ b/src/kml/dom/kml22.cc
@@ -26,11 +26,12 @@
 // This file contains the KML 2.2 element names as found in the KML 2.2 XSD.
 
 #include "kml/dom/kml22.h"
+#include "kml/dom/xsd.h"
 
 namespace kmldom {
 
 // There is an entry here for each global <xs:element> in the KML 2.2 XSD
- XsdElement kKml22Elements[] = {
+static XsdElement kKml22Elements[] = {
   { "<Unknown>", XSD_UNKNOWN },  // Reserve slot 0, note impossible tag name.
 
   // These are the abstract substitution group elements in the XSD.
@@ -281,22 +282,30 @@ namespace kmldom {
 
 // There is an entry here for each enumeration in the XSD.
 // See the declaration of xsd_simple_type_enum_t for more details.
- const char* kAltitudeModeEnums[] = { "clampToGround", "relativeToGround", "absolute", NULL };
- const char* kColorModeEnums[] = { "normal", "random", NULL };
- const char* kDisplayModeEnums[] = { "default", "hide", NULL };
- const char* kGridOriginEnums[] = { "lowerLeft", "upperLeft", NULL };
- const char* kItemIconStateEnums[] = { "open", "closed", "error", "fetching0", "fetching1", "fetching2", NULL };
- const char* kListItemTypeEnums[] = { "check", "radioFolder", "checkOffOnly", "checkHideChildren", NULL };
- const char* kRefreshModeEnums[] = { "onChange", "onInterval", "onExpire", NULL };
- const char* kShapeEnums[] = { "rectangle", "cylinder", "sphere", NULL };
- const char* kStyleStateEnums[] = { "normal", "highlight", NULL };
- const char* kUnitsEnums[] = { "fraction", "pixels", "insetPixels", NULL };
- const char* kViewRefreshModeEnums[] = { "never", "onRequest", "onStop", "onRegion", NULL };
- const char* kGxAltitudeModeEnums[] = { "clampToSeaFloor", "relativeToSeaFloor", NULL };
- const char* kGxFlyToViewEnums[] = { "bounce", "smooth", NULL };
- const char* kGxPlayModeEnums[] =  { "pause", NULL };
-
- XsdSimpleTypeEnum kKml22Enums[] = {
+static const char* kAltitudeModeEnums[] =
+  { "clampToGround", "relativeToGround", "absolute", NULL };
+static const char* kColorModeEnums[] = { "normal", "random", NULL };
+static const char* kDisplayModeEnums[] = { "default", "hide", NULL };
+static const char* kGridOriginEnums[] = { "lowerLeft", "upperLeft", NULL };
+static const char* kItemIconStateEnums[] =
+  { "open", "closed", "error", "fetching0", "fetching1", "fetching2", NULL };
+static const char* kListItemTypeEnums[] =
+  { "check", "radioFolder", "checkOffOnly", "checkHideChildren", NULL };
+static const char* kRefreshModeEnums[] =
+  { "onChange", "onInterval", "onExpire", NULL };
+static const char* kShapeEnums[] = { "rectangle", "cylinder", "sphere", NULL };
+static const char* kStyleStateEnums[] = { "normal", "highlight", NULL };
+static const char* kUnitsEnums[] =
+  { "fraction", "pixels", "insetPixels", NULL };
+static const char* kViewRefreshModeEnums[] =
+  { "never", "onRequest", "onStop", "onRegion", NULL };
+static const char* kGxAltitudeModeEnums[] =
+  { "clampToSeaFloor", "relativeToSeaFloor", NULL };
+static const char* kGxFlyToViewEnums[] =
+  { "bounce", "smooth", NULL };
+static const char* kGxPlayModeEnums[] =
+  { "pause", NULL };
+static XsdSimpleTypeEnum kKml22Enums[] = {
   { Type_altitudeMode, kAltitudeModeEnums },
   { Type_colorMode, kColorModeEnums },
   { Type_displayMode, kDisplayModeEnums },
@@ -310,9 +319,7 @@ namespace kmldom {
   { Type_viewRefreshMode, kViewRefreshModeEnums },
   { Type_GxAltitudeMode, kGxAltitudeModeEnums },
   { Type_GxFlyToMode, kGxFlyToViewEnums },
-  { Type_GxPlayMode, kGxPlayModeEnums },
+  { Type_GxPlayMode, kGxPlayModeEnums }
 };
 
-int kKml22Enums_size = sizeof(kKml22Enums);
-
 }  // namespace kmldom
diff --git a/src/kml/dom/kml22.h b/src/kml/dom/kml22.h
index 3fa5bfc..b994c8c 100644
--- a/src/kml/dom/kml22.h
+++ b/src/kml/dom/kml22.h
@@ -31,10 +31,8 @@
 // http://code.google.com/apis/kml/documentation/kmlreference.html
 // Type_${element_name}
 
-#ifndef KML_DOM_KML22_H__
-#define KML_DOM_KML22_H__
-
-#include "kml/dom/xsd.h"
+#ifndef KML_DOM_KML22_H
+#define KML_DOM_KML22_H
 
 namespace kmldom {
 
@@ -377,25 +375,6 @@ typedef enum {
   GX_PLAYMODE_PAUSE = 0
 } GxPlayModeEnum;
 
- extern const char* kAltitudeModeEnums[];
- extern const char* kColorModeEnums[];
- extern const char* kDisplayModeEnums[];
- extern const char* kGridOriginEnums[];
- extern const char* kItemIconStateEnums[];
- extern const char* kListItemTypeEnums[];
- extern const char* kRefreshModeEnums[];
- extern const char* kShapeEnums[];
- extern const char* kStyleStateEnums[];
- extern const char* kUnitsEnums[];
- extern const char* kViewRefreshModeEnums[];
- extern const char* kGxAltitudeModeEnums[];
- extern const char* kGxFlyToViewEnums[];
- extern const char* kGxPlayModeEnums[];
- 
- extern XsdElement kKml22Elements[];
- extern XsdSimpleTypeEnum kKml22Enums[];
- extern int kKml22Enums_size;
- 
 }  // end namespace kmldom
 
 #endif  // KML_DOM_KML22_H__
diff --git a/src/kml/dom/xsd.cc b/src/kml/dom/xsd.cc
index dae5e62..628ddfc 100644
--- a/src/kml/dom/xsd.cc
+++ b/src/kml/dom/xsd.cc
@@ -1,9 +1,9 @@
-// Copyright 2008, Google Inc. All rights reserved.
+// Copyright 2008, Google Inc. All rights reserved.
 //
-// Redistribution and use in source and binary forms, with or without 
+// Redistribution and use in source and binary forms, with or without
 // modification, are permitted provided that the following conditions are met:
 //
-//  1. Redistributions of source code must retain the above copyright notice, 
+//  1. Redistributions of source code must retain the above copyright notice,
 //     this list of conditions and the following disclaimer.
 //  2. Redistributions in binary form must reproduce the above copyright notice,
 //     this list of conditions and the following disclaimer in the documentation
@@ -13,20 +13,21 @@
 //     specific prior written permission.
 //
 // THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
-// WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 
+// WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
 // MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
-// EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 
+// EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
 // OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
-// WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 
-// OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 
+// WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+// OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
 // ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
 // This file implements the internal Xsd class specifically for KML 2.2.
 
 #include "kml/dom/xsd.h"
 #include "kml/dom/kml22.h"
+#include "kml/dom/kml22.cc"
 
 namespace kmldom {
 
@@ -79,8 +80,8 @@ XsdType Xsd::ElementType(int id) const {
 }
 
 int Xsd::EnumId(int type_id, string enum_value) const {
-
-  for (int i = 0; i < kKml22Enums_size; ++i) {
+const int size = sizeof(kKml22Enums)/sizeof(XsdSimpleTypeEnum);
+  for (int i = 0; i < size ; ++i) {
     if (kKml22Enums[i].type_id == type_id) {
       for (const char** enum_value_item = kKml22Enums[i].enum_value_list;
            *enum_value_item;
@@ -103,7 +104,9 @@ string Xsd::EnumValue(int type_id, int enum_id) const {
   if (enum_id < 0) {
     return string();
   }
-  for (int i = 0; i < kKml22Enums_size; ++i) {  
+const int size = sizeof(kKml22Enums)/sizeof(XsdSimpleTypeEnum);
+
+  for (int i = 0; i < size; ++i) {
     if (kKml22Enums[i].type_id == type_id) {
       return kKml22Enums[i].enum_value_list[enum_id];
     }

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-grass/libkml.git



More information about the Pkg-grass-devel mailing list