aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCharles Karney <charles@karney.com>2017-12-07 11:11:16 -0500
committerCharles Karney <charles@karney.com>2017-12-07 11:11:16 -0500
commit5975ff8f0920b1f4b4353f59f45e9033ea784c5f (patch)
tree2a017dceaeb2cc8625e13100369664584583a0f9
parentcbb497636ec29f5350864b128e7d09d603f6a15d (diff)
downloadPROJ-5975ff8f0920b1f4b4353f59f45e9033ea784c5f.tar.gz
PROJ-5975ff8f0920b1f4b4353f59f45e9033ea784c5f.zip
Squelch Visual Studio's obnoxious warnings about sprintf being unsafe.
Also set policy CMP0054 to stop a cmake warning.
-rw-r--r--CMakeLists.txt3
-rw-r--r--src/PJ_chamb.c5
-rw-r--r--src/PJ_horner.c5
-rw-r--r--src/cct.c4
-rw-r--r--src/gie.c5
-rw-r--r--src/nad2bin.c5
-rw-r--r--src/optargpm.h10
-rw-r--r--src/pj_apply_gridshift.c5
-rw-r--r--src/pj_apply_vgridshift.c5
-rw-r--r--src/pj_datum_set.c5
-rw-r--r--src/pj_fileapi.c5
-rw-r--r--src/pj_gridinfo.c5
-rw-r--r--src/pj_gridlist.c5
-rw-r--r--src/pj_init.c5
-rw-r--r--src/pj_log.c5
-rw-r--r--src/pj_open_lib.c5
-rw-r--r--src/proj_4D_api.c4
17 files changed, 85 insertions, 1 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index a9c9cdbf..33547190 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -15,6 +15,9 @@ cmake_minimum_required(VERSION 2.6.0 FATAL_ERROR)
project(PROJ4 C)
set(PROJECT_INTERN_NAME PROJ)
+if (NOT CMAKE_VERSION VERSION_LESS 3.1)
+ cmake_policy(SET CMP0054 NEW)
+endif ()
# Set warnings
if("${CMAKE_C_COMPILER_ID}" STREQUAL "MSVC")
set(CMAKE_C_FLAGS "/WX ${CMAKE_C_FLAGS}")
diff --git a/src/PJ_chamb.c b/src/PJ_chamb.c
index d0b9250e..0a18ecf0 100644
--- a/src/PJ_chamb.c
+++ b/src/PJ_chamb.c
@@ -3,6 +3,11 @@
#include <proj.h>
#include "projects.h"
+#if defined(_MSC_VER)
+// Squelch warnings about unsafe use of sprintf, etc
+# pragma warning (disable: 4996)
+#endif
+
typedef struct { double r, Az; } VECT;
struct pj_opaque {
struct { /* control point data */
diff --git a/src/PJ_horner.c b/src/PJ_horner.c
index fe0452d6..2f564edf 100644
--- a/src/PJ_horner.c
+++ b/src/PJ_horner.c
@@ -82,6 +82,11 @@
#include <math.h>
#include <errno.h>
+#if defined(_MSC_VER)
+// Squelch warnings about unsafe use of sprintf, etc
+# pragma warning (disable: 4996)
+#endif
+
PROJ_HEAD(horner, "Horner polynomial evaluation");
/* make horner.h interface with proj's memory management */
diff --git a/src/cct.c b/src/cct.c
index a1c275b5..ae294190 100644
--- a/src/cct.c
+++ b/src/cct.c
@@ -81,6 +81,10 @@ Thomas Knudsen, thokn@sdfe.dk, 2016-05-25/2017-10-26
#include <string.h>
#include <math.h>
+#if defined(_MSC_VER)
+// Squelch warnings about unsafe use of sprintf, etc
+# pragma warning (disable: 4996)
+#endif
double proj_strtod(const char *str, char **endptr);
double proj_atof(const char *str);
diff --git a/src/gie.c b/src/gie.c
index 9e377648..fcf78a71 100644
--- a/src/gie.c
+++ b/src/gie.c
@@ -119,7 +119,10 @@ Thomas Knudsen, thokn@sdfe.dk, 2017-10-01/2017-10-08
#include <math.h>
#include <errno.h>
-
+#if defined(_MSC_VER)
+// Squelch warnings about unsafe use of sprintf, etc
+# pragma warning (disable: 4996)
+#endif
/* from proj_strtod.c */
double proj_strtod(const char *str, char **endptr);
diff --git a/src/nad2bin.c b/src/nad2bin.c
index 8401df79..92ceab09 100644
--- a/src/nad2bin.c
+++ b/src/nad2bin.c
@@ -2,6 +2,11 @@
#include <stdio.h>
#include <stdlib.h>
+#if defined(_MSC_VER)
+// Squelch warnings about unsafe use of sprintf, etc
+# pragma warning (disable: 4996)
+#endif
+
#define PJ_LIB__
#include "proj_internal.h"
#include "projects.h"
diff --git a/src/optargpm.h b/src/optargpm.h
index acb96583..c2b23466 100644
--- a/src/optargpm.h
+++ b/src/optargpm.h
@@ -193,6 +193,12 @@ Thomas Knudsen, thokn@sdfe.dk, 2016-05-25/2017-09-10
#include <math.h>
#include <errno.h>
+#if defined(_MSC_VER)
+// Squelch warnings about unsafe use of sprintf, etc
+# pragma warning (push)
+# pragma warning (disable: 4996)
+#endif
+
/**************************************************************************************************/
struct OPTARGS;
typedef struct OPTARGS OPTARGS;
@@ -599,3 +605,7 @@ OPTARGS *opt_parse (int argc, char **argv, const char *flags, const char *keys,
return o;
}
+
+#if defined(_MSC_VER)
+# pragma warning (pop)
+#endif
diff --git a/src/pj_apply_gridshift.c b/src/pj_apply_gridshift.c
index a2267cbd..d8bd8b43 100644
--- a/src/pj_apply_gridshift.c
+++ b/src/pj_apply_gridshift.c
@@ -35,6 +35,11 @@
#include "proj_internal.h"
#include "projects.h"
+#if defined(_MSC_VER)
+// Squelch warnings about unsafe use of sprintf, etc
+# pragma warning (disable: 4996)
+#endif
+
/************************************************************************/
/* pj_apply_gridshift() */
/* */
diff --git a/src/pj_apply_vgridshift.c b/src/pj_apply_vgridshift.c
index 6435b954..d5baf9e8 100644
--- a/src/pj_apply_vgridshift.c
+++ b/src/pj_apply_vgridshift.c
@@ -33,6 +33,11 @@
#include "proj_internal.h"
#include "projects.h"
+#if defined(_MSC_VER)
+// Squelch warnings about unsafe use of sprintf, etc
+# pragma warning (disable: 4996)
+#endif
+
static double pj_read_vgrid_value( PJ *defn, LP input, int *gridlist_count_p, PJ_GRIDINFO **tables, struct CTABLE *ct) {
int itable = 0;
double value = HUGE_VAL;
diff --git a/src/pj_datum_set.c b/src/pj_datum_set.c
index c2fb1608..1622364c 100644
--- a/src/pj_datum_set.c
+++ b/src/pj_datum_set.c
@@ -29,6 +29,11 @@
#include <projects.h>
#include <string.h>
+#if defined(_MSC_VER)
+// Squelch warnings about unsafe use of sprintf, etc
+# pragma warning (disable: 4996)
+#endif
+
/* SEC_TO_RAD = Pi/180/3600 */
#define SEC_TO_RAD 4.84813681109535993589914102357e-6
diff --git a/src/pj_fileapi.c b/src/pj_fileapi.c
index e223993e..9fd6a2b4 100644
--- a/src/pj_fileapi.c
+++ b/src/pj_fileapi.c
@@ -30,6 +30,11 @@
#include <projects.h>
#include <string.h>
+#if defined(_MSC_VER)
+// Squelch warnings about unsafe use of sprintf, etc
+# pragma warning (disable: 4996)
+#endif
+
static PAFile pj_stdio_fopen(projCtx ctx, const char *filename,
const char *access);
static size_t pj_stdio_fread(void *buffer, size_t size, size_t nmemb,
diff --git a/src/pj_gridinfo.c b/src/pj_gridinfo.c
index 9b9a8d82..9d69876e 100644
--- a/src/pj_gridinfo.c
+++ b/src/pj_gridinfo.c
@@ -34,6 +34,11 @@
#include <math.h>
#include <errno.h>
+#if defined(_MSC_VER)
+// Squelch warnings about unsafe use of sprintf, etc
+# pragma warning (disable: 4996)
+#endif
+
/************************************************************************/
/* swap_words() */
/* */
diff --git a/src/pj_gridlist.c b/src/pj_gridlist.c
index fbefdcea..5bc608d7 100644
--- a/src/pj_gridlist.c
+++ b/src/pj_gridlist.c
@@ -33,6 +33,11 @@
#include <string.h>
#include <math.h>
+#if defined(_MSC_VER)
+// Squelch warnings about unsafe use of sprintf, etc
+# pragma warning (disable: 4996)
+#endif
+
static PJ_GRIDINFO *grid_list = NULL;
#define PJ_MAX_PATH_LENGTH 1024
diff --git a/src/pj_init.c b/src/pj_init.c
index 2d588ee4..a72dbec1 100644
--- a/src/pj_init.c
+++ b/src/pj_init.c
@@ -36,6 +36,11 @@
#include "proj_internal.h"
#include "projects.h"
+#if defined(_MSC_VER)
+// Squelch warnings about unsafe use of sprintf, etc
+# pragma warning (disable: 4996)
+#endif
+
/* Maximum size of files using the "escape carriage return" feature */
#define MAX_CR_ESCAPE 65537
typedef struct {
diff --git a/src/pj_log.c b/src/pj_log.c
index bab5f078..3c4b7213 100644
--- a/src/pj_log.c
+++ b/src/pj_log.c
@@ -30,6 +30,11 @@
#include <string.h>
#include <stdarg.h>
+#if defined(_MSC_VER)
+// Squelch warnings about unsafe use of sprintf, etc
+# pragma warning (disable: 4996)
+#endif
+
/************************************************************************/
/* pj_stderr_logger() */
/************************************************************************/
diff --git a/src/pj_open_lib.c b/src/pj_open_lib.c
index 08532beb..35d0341f 100644
--- a/src/pj_open_lib.c
+++ b/src/pj_open_lib.c
@@ -35,6 +35,11 @@
#include <string.h>
#include <errno.h>
+#if defined(_MSC_VER)
+// Squelch warnings about unsafe use of sprintf, etc
+# pragma warning (disable: 4996)
+#endif
+
static const char *(*pj_finder)(const char *) = NULL;
static int path_count = 0;
static char **search_path = NULL;
diff --git a/src/proj_4D_api.c b/src/proj_4D_api.c
index 5f4bf334..34c03db2 100644
--- a/src/proj_4D_api.c
+++ b/src/proj_4D_api.c
@@ -34,6 +34,10 @@
#include "projects.h"
#include "geodesic.h"
+#if defined(_MSC_VER)
+// Squelch warnings about unsafe use of sprintf, etc
+# pragma warning (disable: 4996)
+#endif
/* Initialize PJ_COORD struct */
PJ_COORD proj_coord (double x, double y, double z, double t) {