Skip to content

Commit

Permalink
Add proj_errno_string function
Browse files Browse the repository at this point in the history
Equivalent to pj_strerrno.
  • Loading branch information
kbevers committed Mar 9, 2018
1 parent 7d9a545 commit 6faab2a
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 2 deletions.
8 changes: 8 additions & 0 deletions docs/source/development/reference/functions.rst
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,15 @@ Change the error-state of :c:data:`P` to `err`.
:param PJ* P: Transformation object.
:param int err: Error code.
.. c:function:: const char* proj_errno_string(int err)
Get a text representation of an error number.
:param int err: Error number.
:returns: :c:type:`const char*` String with description of error.
.. note:: Available from version 5.1.0.
Info functions
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Expand Down
9 changes: 7 additions & 2 deletions src/pj_strerrno.c
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
/* list of projection system pj_errno values */
#include "projects.h"
#include <stdio.h>
#include <errno.h>
#include <string.h>
#include "proj.h"
#include "projects.h"

static const char * const
static const char * const
pj_err_list[] = {
"no arguments in initialization list", /* -1 */
"no options found in 'init' file", /* -2 */
Expand Down Expand Up @@ -96,3 +97,7 @@ char *pj_strerrno(int err) {
sprintf( note, "invalid projection system error (%d)", (err > -9999)? err: -9999);
return note;
}

const char* proj_errno_string(int err) {
return pj_strerrno(err);
}
1 change: 1 addition & 0 deletions src/proj.h
Original file line number Diff line number Diff line change
Expand Up @@ -349,6 +349,7 @@ int proj_errno (const PJ *P);
int proj_errno_set (const PJ *P, int err);
int proj_errno_reset (const PJ *P);
int proj_errno_restore (const PJ *P, int err);
const char* proj_errno_string (int err);

/* Scaling and angular distortion factors */
PJ_FACTORS proj_factors(PJ *P, PJ_COORD lp);
Expand Down

0 comments on commit 6faab2a

Please sign in to comment.