]> granicus.if.org Git - postgis/commitdiff
Remove the ifdef/endif blocks for HAVE_ICONV (#367)
authorPaul Ramsey <pramsey@cleverelephant.ca>
Mon, 4 Jan 2010 05:47:04 +0000 (05:47 +0000)
committerPaul Ramsey <pramsey@cleverelephant.ca>
Mon, 4 Jan 2010 05:47:04 +0000 (05:47 +0000)
git-svn-id: http://svn.osgeo.org/postgis/trunk@5098 b70326c6-7e19-0410-871a-916f4a2858ee

loader/shp2pgsql-cli.c
loader/shp2pgsql-core.c
loader/shp2pgsql-core.h

index 73af13f21b1ba4734964f4ec08e6e2efe8ed53f7..ed56b90cd47eceecd47ecd3c2660402c0ff8845a 100644 (file)
@@ -39,10 +39,8 @@ usage()
        printf("  -i  Use int4 type for all integer dbf fields.\n");
        printf("  -I  Create a spatial index on the geocolumn.\n");
        printf("  -S  Generate simple geometries instead of MULTI geometries.\n");
-#ifdef HAVE_ICONV
        printf("  -W <encoding> Specify the character encoding of Shape's\n");
        printf("     attribute column. (default : \"ASCII\")\n");
-#endif
        printf("  -N <policy> NULL geometries handling policy (insert*,skip,abort)\n");
        printf("  -n  Only import DBF file.\n");
        printf("  -?  Display this help screen.\n");
@@ -139,11 +137,7 @@ main (int argc, char **argv)
                                break;
 
                        case 'W':
-#ifdef HAVE_ICONV
                                config->encoding = optarg;
-#else
-                               fprintf(stderr, "WARNING: the -W switch will have no effect. UTF8 disabled at compile time\n");
-#endif
                                break;
 
                        case 'N':
index 58fb696bc98458355b487dc0c38566ca4be6c8d4..ce442897e3652b5c692aeaab23acfa645f7dd868 100644 (file)
@@ -40,9 +40,7 @@ void lwgeom_init_allocators()
  * Internal functions
  */
 
-#ifdef HAVE_ICONV
 char *utf8(const char *fromcode, char *inputbuf);
-#endif
 void vasbappend(stringbuffer_t *sb, char *fmt, ... );
 char *escape_copy_string(char *str);
 char *escape_insert_string(char *str);
@@ -77,8 +75,6 @@ vasbappend(stringbuffer_t *sb, char *fmt, ... )
        va_end(ap);
 }
 
-
-#ifdef HAVE_ICONV
 /* Return allocated string containing UTF8 string converted from encoding fromcode */
 char *
 utf8(const char *fromcode, char *inputbuf)
@@ -111,8 +107,6 @@ utf8(const char *fromcode, char *inputbuf)
 
        return outputbuf;
 }
-#endif
-
 
 /**
  * Escape input string suitable for COPY. If no characters require escaping, simply return
@@ -894,9 +888,7 @@ ShpLoaderOpenShape(SHPLOADERSTATE *state)
        char name[MAXFIELDNAMELEN];
        char name2[MAXFIELDNAMELEN];
        DBFFieldType type = -1;
-#ifdef HAVE_ICONV
        char *utf8str;
-#endif
 
        /* If we are reading the entire shapefile, open it */
        if (state->config->readshape == 1)
@@ -1149,7 +1141,6 @@ ShpLoaderOpenShape(SHPLOADERSTATE *state)
                state->widths[j] = field_width;
                state->precisions[j] = field_precision;
 
-#ifdef HAVE_ICONV
                if (state->config->encoding)
                {
                        /* If we are converting from another encoding to UTF8, convert the field name to UTF8 */
@@ -1163,7 +1154,6 @@ ShpLoaderOpenShape(SHPLOADERSTATE *state)
                        strncpy(name, utf8str, MAXFIELDNAMELEN);
                        free(utf8str);
                }
-#endif
 
                /*
                 * Make field names lowercase unless asked to
@@ -1241,13 +1231,11 @@ ShpLoaderGetSQLHeader(SHPLOADERSTATE *state, char **strheader)
        sb = stringbuffer_create();
        stringbuffer_clear(sb);
 
-#ifdef HAVE_ICONV
        /* Set the client encoding if required */
        if (state->config->encoding)
        {
                vasbappend(sb, "SET CLIENT_ENCODING TO UTF8;\n");
        }
-#endif
 
        /* Use SQL-standard string escaping rather than PostgreSQL standard */
        vasbappend(sb, "SET STANDARD_CONFORMING_STRINGS TO ON;\n");
@@ -1472,9 +1460,7 @@ ShpLoaderGenerateSQLRowStatement(SHPLOADERSTATE *state, int item, char **strreco
        char val[MAXVALUELEN];
        char *escval;
        char *geometry, *ret;
-#ifdef HAVE_ICONV
        char *utf8str;
-#endif
        int res, i;
 
        /* Clear the stringbuffers */
@@ -1582,7 +1568,6 @@ ShpLoaderGenerateSQLRowStatement(SHPLOADERSTATE *state, int item, char **strreco
                                        return SHPLOADERERR;
                        }
 
-#ifdef HAVE_ICONV
                        if (state->config->encoding)
                        {
                                /* If we are converting from another encoding to UTF8, convert the field value to UTF8 */
@@ -1596,7 +1581,6 @@ ShpLoaderGenerateSQLRowStatement(SHPLOADERSTATE *state, int item, char **strreco
                                strncpy(val, utf8str, MAXVALUELEN);
                                free(utf8str);
                        }
-#endif
 
                        /* Escape attribute correctly according to dump format */
                        if (state->config->dump_format)
index ce42c2b49c4c4b26a067ffde24f41eb1b658c5d5..7ee0383ce22fc9a83ec49fec0fbeea43d145e4fc 100644 (file)
 #include <errno.h>
 #include <sys/types.h>
 #include <sys/stat.h>
+#include <iconv.h>
 
 #include "shapefil.h"
 #include "getopt.h"
 
 #include "../liblwgeom/liblwgeom.h"
 
-#ifdef HAVE_ICONV
-#include <iconv.h>
-#endif
-
 #include "stringbuffer.h"
 
 #define RCSID "$Id$"