aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKristian Evers <kristianevers@gmail.com>2018-06-18 21:48:50 +0200
committerGitHub <noreply@github.com>2018-06-18 21:48:50 +0200
commitd52e3b9d36487a2c05c5cbee9d0a387440a91b0c (patch)
treec31dd8c9a543ee20de95bb2647bc2a65350de886
parentea61acb9fdb6c7f6c2084f36924d7860380320e2 (diff)
parent431099b1d5f8082bef64c86381ea4c27936d2d1b (diff)
downloadPROJ-d52e3b9d36487a2c05c5cbee9d0a387440a91b0c.tar.gz
PROJ-d52e3b9d36487a2c05c5cbee9d0a387440a91b0c.zip
Merge pull request #1044 from aaronpuchert/set-error-codes
Set error codes in proj_create and proj_create_argv
-rw-r--r--src/proj_4D_api.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/src/proj_4D_api.c b/src/proj_4D_api.c
index c21b6278..a6a8dc27 100644
--- a/src/proj_4D_api.c
+++ b/src/proj_4D_api.c
@@ -560,13 +560,16 @@ PJ *proj_create (PJ_CONTEXT *ctx, const char *definition) {
/* Make a copy that we can manipulate */
n = strlen (definition);
args = (char *) malloc (n + 1);
- if (0==args)
+ if (0==args) {
+ proj_context_errno_set(ctx, ENOMEM);
return 0;
+ }
strcpy (args, definition);
argc = pj_trim_argc (args);
if (argc==0) {
pj_dealloc (args);
+ proj_context_errno_set(ctx, PJD_ERR_NO_ARGS);
return 0;
}
@@ -600,15 +603,19 @@ indicator, as in {"+proj=utm", "+zone=32"}, or leave it out, as in {"proj=utm",
PJ *P;
const char *c;
- if (0==argv)
- return 0;
if (0==ctx)
ctx = pj_get_default_ctx ();
+ if (0==argv) {
+ proj_context_errno_set(ctx, PJD_ERR_NO_ARGS);
+ return 0;
+ }
/* We assume that free format is used, and build a full proj_create compatible string */
c = pj_make_args (argc, argv);
- if (0==c)
+ if (0==c) {
+ proj_context_errno_set(ctx, ENOMEM);
return 0;
+ }
P = proj_create (ctx, c);