aboutsummaryrefslogtreecommitdiff
path: root/src/apps
diff options
context:
space:
mode:
authorKristian Evers <kristianevers@gmail.com>2020-11-26 20:58:01 +0100
committerGitHub <noreply@github.com>2020-11-26 20:58:01 +0100
commit3cb26a406a7e1a964f5f3b5caf3c624222664fb2 (patch)
tree414dad90bd94170f6e619197b9a47bfca096d322 /src/apps
parentf5b3616bb03f8e52a5e5a23704d645492a662393 (diff)
parentd9205b9245388f23b65917a21ec72d6bec15d035 (diff)
downloadPROJ-3cb26a406a7e1a964f5f3b5caf3c624222664fb2.tar.gz
PROJ-3cb26a406a7e1a964f5f3b5caf3c624222664fb2.zip
Merge pull request #2403 from kbevers/remove-proj_api.h
Remove proj_api.h
Diffstat (limited to 'src/apps')
-rw-r--r--src/apps/cct.cpp6
-rw-r--r--src/apps/cs2cs.cpp17
-rw-r--r--src/apps/emess.cpp6
-rw-r--r--src/apps/geod_set.cpp2
-rw-r--r--src/apps/gie.cpp8
-rw-r--r--src/apps/proj.cpp10
6 files changed, 28 insertions, 21 deletions
diff --git a/src/apps/cct.cpp b/src/apps/cct.cpp
index b0e15e62..ebfa6a23 100644
--- a/src/apps/cct.cpp
+++ b/src/apps/cct.cpp
@@ -360,7 +360,7 @@ int main(int argc, char **argv) {
if (nullptr==P) {
print (PJ_LOG_ERROR, "%s: Bad transformation arguments - (%s)\n '%s -h' for help",
- o->progname, pj_strerrno (proj_errno(P)), o->progname);
+ o->progname, proj_errno_string (proj_errno(P)), o->progname);
free (o);
if (stdout != fout)
fclose (fout);
@@ -387,7 +387,7 @@ int main(int argc, char **argv) {
buf = static_cast<char*>(calloc (1, 10000));
if (nullptr==buf) {
print (PJ_LOG_ERROR, "%s: Out of memory", o->progname);
- pj_free (P);
+ proj_destroy (P);
free (o);
if (stdout != fout)
fclose (fout);
@@ -435,7 +435,7 @@ int main(int argc, char **argv) {
if (HUGE_VAL==point.xyzt.x) {
/* transformation error */
print (PJ_LOG_NONE, "# Record %d TRANSFORMATION ERROR: %s (%s)",
- (int) o->record_index, buf, pj_strerrno (proj_errno(P)));
+ (int) o->record_index, buf, proj_errno_string (proj_errno(P)));
proj_errno_restore (P, err);
continue;
}
diff --git a/src/apps/cs2cs.cpp b/src/apps/cs2cs.cpp
index 1a33d444..12e045bb 100644
--- a/src/apps/cs2cs.cpp
+++ b/src/apps/cs2cs.cpp
@@ -468,10 +468,23 @@ int main(int argc, char **argv) {
reverseout = 1;
continue;
case 'D': /* set debug level */
+ {
if (--argc <= 0)
goto noargument;
- pj_ctx_set_debug(pj_get_default_ctx(), atoi(*++argv));
+ int log_level = atoi(*++argv);
+ if (log_level <= 0) {
+ proj_log_level(pj_get_default_ctx(), PJ_LOG_NONE);
+ } else if (log_level == 1) {
+ proj_log_level(pj_get_default_ctx(), PJ_LOG_ERROR);
+ } else if (log_level == 2) {
+ proj_log_level(pj_get_default_ctx(), PJ_LOG_DEBUG);
+ } else if (log_level == 3) {
+ proj_log_level(pj_get_default_ctx(), PJ_LOG_TRACE);
+ } else {
+ proj_log_level(pj_get_default_ctx(), PJ_LOG_TELL);
+ }
continue;
+ }
case 'd':
if (--argc <= 0)
goto noargument;
@@ -611,7 +624,7 @@ int main(int argc, char **argv) {
if (!transformation) {
emess(3, "cannot initialize transformation\ncause: %s",
- pj_strerrno(pj_errno));
+ proj_errno_string(proj_context_errno(nullptr)));
}
if (use_env_locale) {
diff --git a/src/apps/emess.cpp b/src/apps/emess.cpp
index 53018ba8..5a50cd25 100644
--- a/src/apps/emess.cpp
+++ b/src/apps/emess.cpp
@@ -9,17 +9,13 @@
# endif
#endif
-#ifndef ACCEPT_USE_OF_DEPRECATED_PROJ_API_H
-#define ACCEPT_USE_OF_DEPRECATED_PROJ_API_H
-#endif
-
#include <errno.h>
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
-#include "proj_api.h"
+#include "proj_internal.h"
#include "proj_config.h"
#define EMESS_ROUTINE
#include "emess.h"
diff --git a/src/apps/geod_set.cpp b/src/apps/geod_set.cpp
index 603f0d95..d6516f22 100644
--- a/src/apps/geod_set.cpp
+++ b/src/apps/geod_set.cpp
@@ -75,6 +75,6 @@ geod_set(int argc, char **argv) {
/* free up linked list */
for ( ; start; start = curr) {
curr = start->next;
- pj_dalloc(start);
+ free(start);
}
}
diff --git a/src/apps/gie.cpp b/src/apps/gie.cpp
index 2fe854fa..b504b922 100644
--- a/src/apps/gie.cpp
+++ b/src/apps/gie.cpp
@@ -880,8 +880,8 @@ static int expect_failure_with_errno_message (int expected, int got) {
banner (T.operation);
fprintf (T.fout, "%s", T.op_ko? " -----\n": delim);
fprintf (T.fout, " FAILURE in %s(%d):\n", opt_strip_path (T.curr_file), (int) F->lineno);
- fprintf (T.fout, " got errno %s (%d): %s\n", err_const_from_errno(got), got, pj_strerrno (got));
- fprintf (T.fout, " expected %s (%d): %s", err_const_from_errno(expected), expected, pj_strerrno (expected));
+ fprintf (T.fout, " got errno %s (%d): %s\n", err_const_from_errno(got), got, proj_errno_string (got));
+ fprintf (T.fout, " expected %s (%d): %s", err_const_from_errno(expected), expected, proj_errno_string (expected));
fprintf (T.fout, "\n");
return 1;
}
@@ -934,7 +934,7 @@ Tell GIE what to expect, when transforming the ACCEPTed input
/* Otherwise, it's a true failure */
banner (T.operation);
errmsg (3, "%sInvalid operation definition in line no. %d:\n %s (errno=%s/%d)\n",
- delim, (int) T.operation_lineno, pj_strerrno(proj_errno(T.P)),
+ delim, (int) T.operation_lineno, proj_errno_string (proj_errno(T.P)),
err_const_from_errno (proj_errno(T.P)), proj_errno(T.P)
);
return another_failing_failure ();
@@ -1186,7 +1186,7 @@ static int list_err_codes (void) {
if (9999==lookup[i].the_errno)
break;
fprintf (T.fout, "%25s (%2.2d): %s\n", lookup[i].the_err_const + 8,
- lookup[i].the_errno, pj_strerrno(lookup[i].the_errno));
+ lookup[i].the_errno, proj_errno_string (lookup[i].the_errno));
}
return 0;
}
diff --git a/src/apps/proj.cpp b/src/apps/proj.cpp
index c9bd8950..a5c917f6 100644
--- a/src/apps/proj.cpp
+++ b/src/apps/proj.cpp
@@ -250,10 +250,8 @@ static void vprocess(FILE *fid) {
if (postscale) { dat_xy.x *= fscale; dat_xy.y *= fscale; }
}
- /* For some reason pj_errno does not work as expected in some */
- /* versions of Visual Studio, so using pj_get_errno_ref instead */
- if (*pj_get_errno_ref()) {
- emess(-1, pj_strerrno(*pj_get_errno_ref()));
+ if (proj_context_errno(nullptr)) {
+ emess(-1, proj_errno_string(proj_context_errno(nullptr)));
continue;
}
@@ -477,7 +475,7 @@ int main(int argc, char **argv) {
}
if (!(Proj = pj_init(pargc, pargv)))
emess(3,"projection initialization failure\ncause: %s",
- pj_strerrno(pj_errno));
+ proj_errno_string(proj_context_errno(nullptr)));
if (!proj_angular_input(Proj, PJ_FWD)) {
emess(3, "can't initialize operations that take non-angular input coordinates");
@@ -562,7 +560,7 @@ int main(int argc, char **argv) {
}
if( Proj )
- pj_free(Proj);
+ proj_destroy(Proj);
exit(0); /* normal completion */
}