]> granicus.if.org Git - postgis/commitdiff
Improve readability in the loader by fixing various whitespace issues.
authorMark Cave-Ayland <mark.cave-ayland@siriusit.co.uk>
Mon, 26 Mar 2012 16:23:38 +0000 (16:23 +0000)
committerMark Cave-Ayland <mark.cave-ayland@siriusit.co.uk>
Mon, 26 Mar 2012 16:23:38 +0000 (16:23 +0000)
git-svn-id: http://svn.osgeo.org/postgis/trunk@9546 b70326c6-7e19-0410-871a-916f4a2858ee

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

index 592bd5d14d7977e996bba62fed432fb73d1d0714..52ab9b59acdd798acb32dca7e6ba7c1af17704fd 100644 (file)
@@ -796,6 +796,7 @@ ShpLoaderCreate(SHPLOADERCONFIG *config)
 
        state->from_srid = config->shp_sr_id;
        state->to_srid = config->sr_id;
+
        /* If only one has a valid SRID, use it for both. */
        if (state->to_srid == SRID_UNKNOWN)
        {
@@ -808,6 +809,7 @@ ShpLoaderCreate(SHPLOADERCONFIG *config)
                        state->to_srid = state->from_srid;
                }
        }
+
        if (state->from_srid == SRID_UNKNOWN)
        {
                state->from_srid = state->to_srid;
@@ -815,6 +817,7 @@ ShpLoaderCreate(SHPLOADERCONFIG *config)
 
        /* If the geo col name is not set, use one of the defaults. */
        state->geo_col = config->geo_col;
+
        if (!state->geo_col)
        {
                state->geo_col = strdup(config->geography ? GEOGRAPHY_DEFAULT : GEOMETRY_DEFAULT);
@@ -1311,10 +1314,12 @@ ShpLoaderGetSQLHeader(SHPLOADERSTATE *state, char **strheader)
                if (state->config->readshape == 1 && state->config->geography)
                {
                        char *dimschar;
-                       if ( state->pgdims == 4 )
+
+                       if (state->pgdims == 4)
                                dimschar = "ZM";
                        else
                                dimschar = "";
+
                        if (state->to_srid != SRID_UNKNOWN && state->to_srid != 4326)
                        {
                                snprintf(state->message, SHPLOADERMSGLEN, _("Invalid SRID for geography type: %d"), state->to_srid);
@@ -1323,8 +1328,8 @@ ShpLoaderGetSQLHeader(SHPLOADERSTATE *state, char **strheader)
                        }
                        stringbuffer_aprintf(sb, ",\n\"%s\" geography(%s%s,%d)", state->geo_col, state->pgtype, dimschar, 4326);
                }
-
                stringbuffer_aprintf(sb, ")");
+
                /* Tablespace is optional. */
                if (state->config->tablespace != NULL)
                {
@@ -1344,12 +1349,14 @@ ShpLoaderGetSQLHeader(SHPLOADERSTATE *state, char **strheader)
                 *       A patch has apparently been submitted to PostgreSQL to enable this syntax, see this thread:
                 *           http://archives.postgresql.org/pgsql-hackers/2011-01/msg01405.php */
                stringbuffer_aprintf(sb, "ALTER TABLE ");
+
                /* Schema is optional, include if present. */
                if (state->config->schema)
                {
                        stringbuffer_aprintf(sb, "\"%s\".",state->config->schema);
                }
                stringbuffer_aprintf(sb, "\"%s\" ADD PRIMARY KEY (gid);\n", state->config->table);
+
                /* Tablespace is optional for the index. */
                if (state->config->idxtablespace != NULL)
                {
@@ -1358,6 +1365,7 @@ ShpLoaderGetSQLHeader(SHPLOADERSTATE *state, char **strheader)
                        {
                                stringbuffer_aprintf(sb, "\"%s\".",state->config->schema);
                        }
+
                        /* WARNING: We're assuming the default "table_pkey" name for the primary
                         *          key index.  PostgreSQL may use "table_pkey1" or similar in the
                         *          case of a name conflict, so you may need to edit the produced
index c2cf008cfcc90d27e7c39510df5c768ee516f71a..73051d3f38ec910940fd39056cbe3cbae8d1eab3 100644 (file)
@@ -190,6 +190,7 @@ typedef struct shp_loader_state
 
        /* Flag for whether the geometry has Z coordinates or not. */
        int has_z;
+
        /* Flag for whether the geometry has M coordinates or not. */
        int has_m;