[Liblas-commits] hg-main-tree: add new defn for compare_no_case

liblas-commits at liblas.org liblas-commits at liblas.org
Fri Apr 22 10:53:02 EDT 2011


details:   http://hg.libpc.orghg-main-tree/rev/f62cecc435a9
changeset: 615:f62cecc435a9
user:      Howard Butler <hobu.inc at gmail.com>
date:      Fri Apr 22 09:52:48 2011 -0500
description:
add new defn for compare_no_case
Subject: hg-main-tree: remove extra qualifications

details:   http://hg.libpc.orghg-main-tree/rev/612558fc3c34
changeset: 616:612558fc3c34
user:      Howard Butler <hobu.inc at gmail.com>
date:      Fri Apr 22 09:52:55 2011 -0500
description:
remove extra qualifications

diffstat:

 include/libpc/drivers/liblas/Reader.hpp |   6 +-
 include/libpc/drivers/oci/Common.hpp    |   7 +-
 src/drivers/oci/Reader.cpp              |  24 ++++----
 src/drivers/oci/Schema.cpp              |  94 +++++++++++++++-----------------
 src/drivers/oci/Writer.cpp              |   4 +-
 5 files changed, 67 insertions(+), 68 deletions(-)

diffs (truncated from 373 to 300 lines):

diff -r 61902169d63b -r 612558fc3c34 include/libpc/drivers/liblas/Reader.hpp
--- a/include/libpc/drivers/liblas/Reader.hpp	Thu Apr 21 14:28:58 2011 -0700
+++ b/include/libpc/drivers/liblas/Reader.hpp	Fri Apr 22 09:52:55 2011 -0500
@@ -68,8 +68,8 @@
     boost::uint8_t getVersionMajor() const;
     boost::uint8_t getVersionMinor() const;
 
-    int LiblasReader::getMetadataRecordCount() const;
-    const MetadataRecord& LiblasReader::getMetadataRecord(int index) const;
+    int getMetadataRecordCount() const;
+    const MetadataRecord& getMetadataRecord(int index) const;
 
     bool supportsIterator (StageIteratorType t) const
     {   
@@ -85,7 +85,7 @@
 private:
     void processExternalHeader(::liblas::Reader& externalReader);
     void registerFields(::liblas::Reader& externalReader);
-    MetadataRecord& LiblasReader::getMetadataRecordRef(int index);
+    MetadataRecord& getMetadataRecordRef(int index);
 
     std::string m_filename;
 
diff -r 61902169d63b -r 612558fc3c34 include/libpc/drivers/oci/Common.hpp
--- a/include/libpc/drivers/oci/Common.hpp	Thu Apr 21 14:28:58 2011 -0700
+++ b/include/libpc/drivers/oci/Common.hpp	Fri Apr 22 09:52:55 2011 -0500
@@ -113,9 +113,12 @@
 
 
 #ifdef LIBPC_COMPILER_MSVC
-#define compare_no_case(a,b,n)  _strnicmp( (a), (b), (n) )
+#define compare_no_case_n(a,b,n)  _strnicmp( (a), (b), (n) )
+#define compare_no_case(a, b) _stricmp( (a), (b) )
 #else
-#define compare_no_case(a,b,n)  strncasecmp( (a), (b), (n) )
+#define compare_no_case_n(a,b,n)  strncasecmp( (a), (b), (n) )
+#define compare_no_case(a, b) strcasecmp( (a), (b) )
+
 #endif
 
 struct FiveDimensionOCI
diff -r 61902169d63b -r 612558fc3c34 src/drivers/oci/Reader.cpp
--- a/src/drivers/oci/Reader.cpp	Thu Apr 21 14:28:58 2011 -0700
+++ b/src/drivers/oci/Reader.cpp	Fri Apr 22 09:52:55 2011 -0500
@@ -354,9 +354,9 @@
         if ( hType == SQLT_NTY)
         {
                 
-                if (compare_no_case(szTypeName, "SDO_PC", 6) == 0)
+                if (compare_no_case(szTypeName, "SDO_PC") == 0)
                     isPCObject = true;
-                if (compare_no_case(szTypeName, "SDO_PC_BLK_TYPE", 6) == 0)
+                if (compare_no_case(szTypeName, "SDO_PC_BLK_TYPE") == 0)
                     isBlockTableType = true;
                 std::cout << "Field " << szFieldName << " is SQLT_NTY with type name " << szTypeName  << std::endl;
         }
@@ -437,52 +437,52 @@
     {
         std::string name = to_upper(std::string(szFieldName));
 
-        if (compare_no_case(szFieldName, "OBJ_ID", 6) == 0)
+        if (compare_no_case(szFieldName, "OBJ_ID") == 0)
         {
             m_statement->Define(&(block->obj_id));
         }
 
-        if (compare_no_case(szFieldName, "BLK_ID", 6) == 0)
+        if (compare_no_case(szFieldName, "BLK_ID") == 0)
         {
             m_statement->Define(&(block->blk_id));
         }
 
-        if (compare_no_case(szFieldName, "BLK_EXTENT", 10) == 0)
+        if (compare_no_case(szFieldName, "BLK_EXTENT") == 0)
         {
             m_statement->Define(&(block->blk_extent));
         }
 
-        if (compare_no_case(szFieldName, "BLK_DOMAIN", 10) == 0)
+        if (compare_no_case(szFieldName, "BLK_DOMAIN") == 0)
         {
             m_statement->Define(&(block->blk_domain));
         }
         
-        if (compare_no_case(szFieldName, "PCBLK_MIN_RES", 13) == 0)
+        if (compare_no_case(szFieldName, "PCBLK_MIN_RES") == 0)
         {
             m_statement->Define(&(block->pcblk_min_res));
         }
 
-        if (compare_no_case(szFieldName, "PCBLK_MAX_RES", 13) == 0)
+        if (compare_no_case(szFieldName, "PCBLK_MAX_RES") == 0)
         {
             m_statement->Define(&(block->pcblk_max_res));
         }
 
-        if (compare_no_case(szFieldName, "NUM_POINTS", 10) == 0)
+        if (compare_no_case(szFieldName, "NUM_POINTS") == 0)
         {
             m_statement->Define(&(block->num_points));
         }
 
-        if (compare_no_case(szFieldName, "NUM_UNSORTED_POINTS", 19) == 0)
+        if (compare_no_case(szFieldName, "NUM_UNSORTED_POINTS") == 0)
         {
             m_statement->Define(&(block->num_unsorted_points));
         }
 
-        if (compare_no_case(szFieldName, "PT_SORT_DIM", 11) == 0)
+        if (compare_no_case(szFieldName, "PT_SORT_DIM") == 0)
         {
             m_statement->Define(&(block->pt_sort_dim));
         }
 
-        if (compare_no_case(szFieldName, "POINTS", 6) == 0)
+        if (compare_no_case(szFieldName, "POINTS") == 0)
         {
             std::cout << "Defined POINTS as BLOB" << std::endl;
             m_statement->Define( &(block->locator) ); 
diff -r 61902169d63b -r 612558fc3c34 src/drivers/oci/Schema.cpp
--- a/src/drivers/oci/Schema.cpp	Thu Apr 21 14:28:58 2011 -0700
+++ b/src/drivers/oci/Schema.cpp	Fri Apr 22 09:52:55 2011 -0500
@@ -44,10 +44,6 @@
 
 #include <string.h>
 
-#ifdef LIBPC_COMPILER_MSVC
-#pragma warning(disable:4996) // "strcmpi is deprecated"
-#endif
-
 
 struct XMLDocDeleter
 {
@@ -282,7 +278,7 @@
     // print_element_names(root);
 
     
-    if (strcmpi((const char*)root->name, "PointCloudSchema"))
+    if (compare_no_case((const char*)root->name, "PointCloudSchema"))
         throw schema_error("First node of document was not named 'PointCloudSchema'");
     
     xmlNode* dimension = root->children;
@@ -315,7 +311,7 @@
                 continue;
             }
             
-            if (!strcmpi((const char*)properties->name, "name"))
+            if (!compare_no_case((const char*)properties->name, "name"))
             {
                 xmlChar* n = xmlNodeListGetString(doc, properties->children, 1);
                 if (!n) throw schema_error("Unable to fetch name!");
@@ -324,7 +320,7 @@
                 std::cout << "Dimension name: " << name << std::endl;
             }
 
-            if (!strcmpi((const char*)properties->name, "size"))
+            if (!compare_no_case((const char*)properties->name, "size"))
             {
                 xmlChar* n = xmlNodeListGetString(doc, properties->children, 1);
                 if (!n) throw schema_error("Unable to fetch size!");
@@ -338,7 +334,7 @@
                 std::cout << "Dimension size: " << size << std::endl;
             }
 
-            if (!strcmpi((const char*)properties->name, "position"))
+            if (!compare_no_case((const char*)properties->name, "position"))
             {
                 xmlChar* n = xmlNodeListGetString(doc, properties->children, 1);
                 if (!n) throw schema_error("Unable to fetch position!");
@@ -351,14 +347,14 @@
                 position = static_cast<boost::uint32_t>(p);
                 std::cout << "Dimension position: " << position << std::endl;
             }
-            if (!strcmpi((const char*)properties->name, "description"))
+            if (!compare_no_case((const char*)properties->name, "description"))
             {
                 xmlChar* n = xmlNodeListGetString(doc, properties->children, 1);
                 if (!n) throw schema_error("Unable to fetch description!");
                 description = std::string((const char*)n);
                 xmlFree(n);
             }
-            if (!strcmpi((const char*)properties->name, "interpretation"))
+            if (!compare_no_case((const char*)properties->name, "interpretation"))
             {
                 xmlChar* n = xmlNodeListGetString(doc, properties->children, 1);
                 if (!n) throw schema_error("Unable to fetch interpretation!");
@@ -366,7 +362,7 @@
                 xmlFree(n);
             }
 
-            if (!strcmpi((const char*)properties->name, "minimum"))
+            if (!compare_no_case((const char*)properties->name, "minimum"))
             {
                 xmlChar* n = xmlGetProp(properties, (const xmlChar*) "value");
                 if (!n) throw schema_error("Unable to fetch minimum value!");
@@ -376,7 +372,7 @@
                 std::cout << "Dimension minimum: " << minimum << std::endl;
             }
 
-            if (!strcmpi((const char*)properties->name, "maximum"))
+            if (!compare_no_case((const char*)properties->name, "maximum"))
             {
                 xmlChar* n = xmlGetProp(properties, (const xmlChar*) "value");
                 if (!n) throw schema_error("Unable to fetch maximum value!");
@@ -386,7 +382,7 @@
                 std::cout << "Dimension maximum: " << maximum << std::endl;
             }
 
-            if (!strcmpi((const char*)properties->name, "offset"))
+            if (!compare_no_case((const char*)properties->name, "offset"))
             {
                 xmlChar* n = xmlNodeListGetString(doc, properties->children, 1);
                 if (!n) throw schema_error("Unable to fetch offset value!");
@@ -395,7 +391,7 @@
                 xmlFree(n);
                 std::cout << "Dimension offset: " << offset << std::endl;
             }
-            if (!strcmpi((const char*)properties->name, "scale"))
+            if (!compare_no_case((const char*)properties->name, "scale"))
             {
                 xmlChar* n = xmlNodeListGetString(doc, properties->children, 1);
                 if (!n) throw schema_error("Unable to fetch scale value!");
@@ -439,43 +435,43 @@
     // };
 
 
-    if (!strcmpi(interpretation.c_str(), "int8_t") || 
-        !strcmpi(interpretation.c_str(), "int8"))
+    if (!compare_no_case(interpretation.c_str(), "int8_t") || 
+        !compare_no_case(interpretation.c_str(), "int8"))
         return Dimension::Int8;
 
-    if (!strcmpi(interpretation.c_str(), "uint8_t") || 
-        !strcmpi(interpretation.c_str(), "uint8"))
+    if (!compare_no_case(interpretation.c_str(), "uint8_t") || 
+        !compare_no_case(interpretation.c_str(), "uint8"))
         return Dimension::Uint8;
 
-    if (!strcmpi(interpretation.c_str(), "int16_t") || 
-        !strcmpi(interpretation.c_str(), "int16"))
+    if (!compare_no_case(interpretation.c_str(), "int16_t") || 
+        !compare_no_case(interpretation.c_str(), "int16"))
         return Dimension::Int16;
 
-    if (!strcmpi(interpretation.c_str(), "uint16_t") || 
-        !strcmpi(interpretation.c_str(), "uint16"))
+    if (!compare_no_case(interpretation.c_str(), "uint16_t") || 
+        !compare_no_case(interpretation.c_str(), "uint16"))
         return Dimension::Uint16;
     
     
-    if (!strcmpi(interpretation.c_str(), "int32_t") || 
-        !strcmpi(interpretation.c_str(), "int32"))
+    if (!compare_no_case(interpretation.c_str(), "int32_t") || 
+        !compare_no_case(interpretation.c_str(), "int32"))
         return Dimension::Int32;
 
-    if (!strcmpi(interpretation.c_str(), "uint32_t") || 
-        !strcmpi(interpretation.c_str(), "uint32"))
+    if (!compare_no_case(interpretation.c_str(), "uint32_t") || 
+        !compare_no_case(interpretation.c_str(), "uint32"))
         return Dimension::Uint32;
 
-    if (!strcmpi(interpretation.c_str(), "int64_t") || 
-        !strcmpi(interpretation.c_str(), "int64"))
+    if (!compare_no_case(interpretation.c_str(), "int64_t") || 
+        !compare_no_case(interpretation.c_str(), "int64"))
         return Dimension::Int64;
 
-    if (!strcmpi(interpretation.c_str(), "uint64_t") || 
-        !strcmpi(interpretation.c_str(), "uint64"))
+    if (!compare_no_case(interpretation.c_str(), "uint64_t") || 
+        !compare_no_case(interpretation.c_str(), "uint64"))
         return Dimension::Uint64;
 
-    if (!strcmpi(interpretation.c_str(), "float"))
+    if (!compare_no_case(interpretation.c_str(), "float"))
         return Dimension::Float;
 
-    if (!strcmpi(interpretation.c_str(), "double"))
+    if (!compare_no_case(interpretation.c_str(), "double"))
         return Dimension::Double;
 
 
@@ -497,55 +493,55 @@
         }
     }
     
-    if (!strcmpi(name.c_str(), "X"))
+    if (!compare_no_case(name.c_str(), "X"))
         return Dimension::Field_X;
 
-    if (!strcmpi(name.c_str(), "Y"))
+    if (!compare_no_case(name.c_str(), "Y"))
         return Dimension::Field_Y;
 
-    if (!strcmpi(name.c_str(), "Z"))
+    if (!compare_no_case(name.c_str(), "Z"))
         return Dimension::Field_Z;
 


More information about the Liblas-commits mailing list