From 3f6d3964bfcd2cdd83a0a7123981cf87d19ae105 Mon Sep 17 00:00:00 2001 From: drhaynes Date: Tue, 26 Jan 2016 11:09:39 +0000 Subject: Increase maximum path size for grid shift loading On systems with long paths (e.g. iOS, which uses UUIDs for bundle directories), the existing maximum path length of 128 resulted in path truncation, and caused the grid shift file loading to fail. This change increases the buffer size for the path to 1024 chars, enabling the nadgrids file to be loaded on such systems. --- src/pj_gridlist.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/pj_gridlist.c b/src/pj_gridlist.c index 0cfab76e..bc005d32 100644 --- a/src/pj_gridlist.c +++ b/src/pj_gridlist.c @@ -178,7 +178,8 @@ PJ_GRIDINFO **pj_gridlist_from_nadgrids( projCtx ctx, const char *nadgrids, { size_t end_char; int required = 1; - char name[128]; + int max_path_length = 1024; + char name[max_path_length]; if( *s == '@' ) { -- cgit v1.2.3 From 1ec3c21b2b3f953cf9a2b3e36c959ee732eac11d Mon Sep 17 00:00:00 2001 From: drhaynes Date: Tue, 26 Jan 2016 14:36:51 +0000 Subject: Use const int for array size --- src/pj_gridlist.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/pj_gridlist.c b/src/pj_gridlist.c index bc005d32..a49c8d51 100644 --- a/src/pj_gridlist.c +++ b/src/pj_gridlist.c @@ -177,9 +177,9 @@ PJ_GRIDINFO **pj_gridlist_from_nadgrids( projCtx ctx, const char *nadgrids, for( s = nadgrids; *s != '\0'; ) { size_t end_char; - int required = 1; - int max_path_length = 1024; - char name[max_path_length]; + int required = 1; + const int max_path_length = 1024; + char name[max_path_length]; if( *s == '@' ) { -- cgit v1.2.3 From ccde1c831660735db6e4fd5a473f1a5dbe28a97f Mon Sep 17 00:00:00 2001 From: drhaynes Date: Tue, 26 Jan 2016 15:02:23 +0000 Subject: Use #define for max path length --- src/pj_gridlist.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/pj_gridlist.c b/src/pj_gridlist.c index a49c8d51..a54dbe6f 100644 --- a/src/pj_gridlist.c +++ b/src/pj_gridlist.c @@ -43,6 +43,7 @@ #endif /* _WIN32_WCE */ static PJ_GRIDINFO *grid_list = NULL; +#define PJ_MAX_PATH_LENGTH 1024 /************************************************************************/ /* pj_deallocate_grids() */ @@ -177,9 +178,8 @@ PJ_GRIDINFO **pj_gridlist_from_nadgrids( projCtx ctx, const char *nadgrids, for( s = nadgrids; *s != '\0'; ) { size_t end_char; - int required = 1; - const int max_path_length = 1024; - char name[max_path_length]; + int required = 1; + char name[PJ_MAX_PATH_LENGTH]; if( *s == '@' ) { -- cgit v1.2.3