Fix:Core:MSVC fixes
authormartin-s <martin-s@ffa7fe5e-494d-0410-b361-a75ebd5db220>
Tue, 25 Jan 2011 16:02:24 +0000 (16:02 +0000)
committermartin-s <martin-s@ffa7fe5e-494d-0410-b361-a75ebd5db220>
Tue, 25 Jan 2011 16:02:24 +0000 (16:02 +0000)
git-svn-id: https://navit.svn.sourceforge.net/svnroot/navit/trunk@4027 ffa7fe5e-494d-0410-b361-a75ebd5db220

navit/navit/map/shapefile/shpopen.c
navit/navit/osd/core/osd_core.c
navit/navit/support/ezxml/ezxml.c

index ba0ae84..a0bda0d 100644 (file)
 #include <stdlib.h>
 #include <string.h>
 #include <stdio.h>
+#include <glib.h>
 
 SHP_CVSID("$Id: shpopen.c,v 1.59 2008/03/14 05:25:31 fwarmerdam Exp $")
 
@@ -1566,7 +1567,7 @@ SHPReadObject( SHPHandle psSHP, int hEntity )
 
     if ( 8 + 4 > nEntitySize )
     {
-        snprintf(pszErrorMsg, 128, "Corrupted .shp file : shape %d : nEntitySize = %d",
+        g_snprintf(pszErrorMsg, 128, "Corrupted .shp file : shape %d : nEntitySize = %d",
                     hEntity, nEntitySize); 
         psSHP->sHooks.Error( pszErrorMsg );
         SHPDestroyObject(psShape);
@@ -1591,7 +1592,7 @@ SHPReadObject( SHPHandle psSHP, int hEntity )
 
         if ( 40 + 8 + 4 > nEntitySize )
         {
-            snprintf(pszErrorMsg, 128, "Corrupted .shp file : shape %d : nEntitySize = %d",
+            g_snprintf(pszErrorMsg, 128, "Corrupted .shp file : shape %d : nEntitySize = %d",
                      hEntity, nEntitySize); 
             psSHP->sHooks.Error( pszErrorMsg );
             SHPDestroyObject(psShape);
@@ -1623,7 +1624,7 @@ SHPReadObject( SHPHandle psSHP, int hEntity )
         if (nPoints < 0 || nParts < 0 ||
             nPoints > 50 * 1000 * 1000 || nParts > 10 * 1000 * 1000)
         {
-            snprintf(pszErrorMsg, 128, "Corrupted .shp file : shape %d, nPoints=%d, nParts=%d.",
+            g_snprintf(pszErrorMsg, 128, "Corrupted .shp file : shape %d, nPoints=%d, nParts=%d.",
                         hEntity, nPoints, nParts);
             psSHP->sHooks.Error( pszErrorMsg );
             SHPDestroyObject(psShape);
@@ -1646,7 +1647,7 @@ SHPReadObject( SHPHandle psSHP, int hEntity )
         }
         if (nRequiredSize > nEntitySize)
         {
-            snprintf(pszErrorMsg, 128, "Corrupted .shp file : shape %d, nPoints=%d, nParts=%d, nEntitySize=%d.",
+            g_snprintf(pszErrorMsg, 128, "Corrupted .shp file : shape %d, nPoints=%d, nParts=%d, nEntitySize=%d.",
                         hEntity, nPoints, nParts, nEntitySize);
             psSHP->sHooks.Error( pszErrorMsg );
             SHPDestroyObject(psShape);
@@ -1670,7 +1671,7 @@ SHPReadObject( SHPHandle psSHP, int hEntity )
             psShape->panPartStart == NULL ||
             psShape->panPartType == NULL)
         {
-            snprintf(pszErrorMsg, 128,
+            g_snprintf(pszErrorMsg, 128,
                      "Not enough memory to allocate requested memory (nPoints=%d, nParts=%d) for shape %d. "
                      "Probably broken SHP file", hEntity, nPoints, nParts );
             psSHP->sHooks.Error( pszErrorMsg );
@@ -1693,7 +1694,7 @@ SHPReadObject( SHPHandle psSHP, int hEntity )
             if (psShape->panPartStart[i] < 0 ||
                 psShape->panPartStart[i] >= psShape->nVertices)
             {
-                snprintf(pszErrorMsg, 128, "Corrupted .shp file : shape %d : panPartStart[%d] = %d, nVertices = %d",
+                g_snprintf(pszErrorMsg, 128, "Corrupted .shp file : shape %d : panPartStart[%d] = %d, nVertices = %d",
                          hEntity, i, psShape->panPartStart[i], psShape->nVertices); 
                 psSHP->sHooks.Error( pszErrorMsg );
                 SHPDestroyObject(psShape);
@@ -1701,7 +1702,7 @@ SHPReadObject( SHPHandle psSHP, int hEntity )
             }
             if (i > 0 && psShape->panPartStart[i] <= psShape->panPartStart[i-1])
             {
-                snprintf(pszErrorMsg, 128, "Corrupted .shp file : shape %d : panPartStart[%d] = %d, panPartStart[%d] = %d",
+                g_snprintf(pszErrorMsg, 128, "Corrupted .shp file : shape %d : panPartStart[%d] = %d, panPartStart[%d] = %d",
                          hEntity, i, psShape->panPartStart[i], i - 1, psShape->panPartStart[i - 1]); 
                 psSHP->sHooks.Error( pszErrorMsg );
                 SHPDestroyObject(psShape);
@@ -1803,7 +1804,7 @@ SHPReadObject( SHPHandle psSHP, int hEntity )
 
         if ( 44 + 4 > nEntitySize )
         {
-            snprintf(pszErrorMsg, 128, "Corrupted .shp file : shape %d : nEntitySize = %d",
+            g_snprintf(pszErrorMsg, 128, "Corrupted .shp file : shape %d : nEntitySize = %d",
                      hEntity, nEntitySize); 
             psSHP->sHooks.Error( pszErrorMsg );
             SHPDestroyObject(psShape);
@@ -1815,7 +1816,7 @@ SHPReadObject( SHPHandle psSHP, int hEntity )
 
         if (nPoints < 0 || nPoints > 50 * 1000 * 1000)
         {
-            snprintf(pszErrorMsg, 128, "Corrupted .shp file : shape %d : nPoints = %d",
+            g_snprintf(pszErrorMsg, 128, "Corrupted .shp file : shape %d : nPoints = %d",
                      hEntity, nPoints); 
             psSHP->sHooks.Error( pszErrorMsg );
             SHPDestroyObject(psShape);
@@ -1829,7 +1830,7 @@ SHPReadObject( SHPHandle psSHP, int hEntity )
         }
         if (nRequiredSize > nEntitySize)
         {
-            snprintf(pszErrorMsg, 128, "Corrupted .shp file : shape %d : nPoints = %d, nEntitySize = %d",
+            g_snprintf(pszErrorMsg, 128, "Corrupted .shp file : shape %d : nPoints = %d, nEntitySize = %d",
                      hEntity, nPoints, nEntitySize); 
             psSHP->sHooks.Error( pszErrorMsg );
             SHPDestroyObject(psShape);
@@ -1847,7 +1848,7 @@ SHPReadObject( SHPHandle psSHP, int hEntity )
             psShape->padfZ == NULL ||
             psShape->padfM == NULL)
         {
-            snprintf(pszErrorMsg, 128,
+            g_snprintf(pszErrorMsg, 128,
                      "Not enough memory to allocate requested memory (nPoints=%d) for shape %d. "
                      "Probably broken SHP file", hEntity, nPoints );
             psSHP->sHooks.Error( pszErrorMsg );
@@ -1941,7 +1942,7 @@ SHPReadObject( SHPHandle psSHP, int hEntity )
 
         if (20 + 8 + (( psShape->nSHPType == SHPT_POINTZ ) ? 8 : 0)> nEntitySize)
         {
-            snprintf(pszErrorMsg, 128, "Corrupted .shp file : shape %d : nEntitySize = %d",
+            g_snprintf(pszErrorMsg, 128, "Corrupted .shp file : shape %d : nEntitySize = %d",
                      hEntity, nEntitySize); 
             psSHP->sHooks.Error( pszErrorMsg );
             SHPDestroyObject(psShape);
index a31a85f..ff58568 100644 (file)
@@ -640,9 +640,9 @@ osd_stopwatch_draw(struct stopwatch *this, struct navit *nav,
        total_days = total_hours/24;
 
        if (total_days==0) {
-               snprintf(buffer,32,"%02d:%02d:%02d", (int)total_hours%24, (int)total_min%60, (int)total_sec%60);
+               g_snprintf(buffer,32,"%02d:%02d:%02d", (int)total_hours%24, (int)total_min%60, (int)total_sec%60);
        } else {
-               snprintf(buffer,32,"%02dd %02d:%02d:%02d",
+               g_snprintf(buffer,32,"%02dd %02d:%02d:%02d",
                (int)total_days, (int)total_hours%24, (int)total_min%60, (int)total_sec%60); 
        }
 
@@ -1605,7 +1605,7 @@ osd_speed_warner_draw(struct osd_speed_warner *this, struct navit *navit, struct
         tracking_get_attr(tracking, attr_position_speed, &speed_attr, NULL);
         tracking_speed = *speed_attr.u.numd;
         if( -1 != tracking_speed && -1 != routespeed ) {
-            snprintf(text,16,"%s%.0lf",osm_data ? "" : "~",routespeed);
+            g_snprintf(text,16,"%s%.0lf",osm_data ? "" : "~",routespeed);
             if( this->speed_exceed_limit_offset+routespeed<tracking_speed &&
                 (100.0+this->speed_exceed_limit_percent)/100.0*routespeed<tracking_speed ) {
                 if(this->announce_state==eNoWarn && this->announce_on) {
index 14754f1..216afdd 100644 (file)
 #include <stdarg.h>
 #include <string.h>
 #include <ctype.h>
-#ifndef _MSC_VER
+#include <glib.h>
+#include "config.h"
+#ifdef HAVE_UNISTD_H
 #include <unistd.h>
-#endif /* _MSC_VER */
+#endif
 #include <sys/types.h>
 #ifndef EZXML_NOMMAP
 #include <sys/mman.h>
@@ -142,7 +144,7 @@ ezxml_t ezxml_err(ezxml_root_t root, char *s, const char *err, ...)
     char *t, fmt[EZXML_ERRL];
     
     for (t = root->s; t < s; t++) if (*t == '\n') line++;
-    snprintf(fmt, EZXML_ERRL, "[error near line %d]: %s", line, err);
+    g_snprintf(fmt, EZXML_ERRL, "[error near line %d]: %s", line, err);
 
     va_start(ap, err);
     vsnprintf(root->err, EZXML_ERRL, fmt, ap);