Skip to content

Commit

Permalink
Merge pull request #1013 from schwehr/proj_strtod_header
Browse files Browse the repository at this point in the history
Use proj_strtod.h for proj_strtod and proj_atof
  • Loading branch information
kbevers committed May 24, 2018
2 parents 343bb74 + 1d2d1ee commit 5d105cb
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 20 deletions.
4 changes: 2 additions & 2 deletions src/Makefile.am
Expand Up @@ -18,11 +18,11 @@ EXTRA_DIST = makefile.vc proj.def bin_cct.cmake bin_gie.cmake bin_cs2cs.cmake \

proj_SOURCES = proj.c gen_cheb.c p_series.c
cs2cs_SOURCES = cs2cs.c gen_cheb.c p_series.c
cct_SOURCES = cct.c proj_strtod.c optargpm.h
cct_SOURCES = cct.c proj_strtod.c proj_strtod.h optargpm.h
nad2bin_SOURCES = nad2bin.c
geod_SOURCES = geod.c geod_set.c geod_interface.c geod_interface.h

gie_SOURCES = gie.c proj_strtod.c optargpm.h
gie_SOURCES = gie.c proj_strtod.c proj_strtod.h optargpm.h
multistresstest_SOURCES = multistresstest.c
test228_SOURCES = test228.c
geodtest_SOURCES = geodtest.c
Expand Down
6 changes: 3 additions & 3 deletions src/bin_cct.cmake
@@ -1,9 +1,9 @@
set(CCT_SRC cct.c proj_strtod.c)
set(CCT_SRC cct.c proj_strtod.c proj_strtod.h)
set(CCT_INCLUDE optargpm.h)

source_group("Source Files\\Bin" FILES ${CCT_SRC})

add_executable(cct ${CCT_SRC} ${CCT_INCLUDE})
target_link_libraries(cct ${PROJ_LIBRARIES})
install(TARGETS cct
RUNTIME DESTINATION ${BINDIR})
install(TARGETS cct
RUNTIME DESTINATION ${BINDIR})
6 changes: 3 additions & 3 deletions src/bin_gie.cmake
@@ -1,9 +1,9 @@
set(GIE_SRC gie.c proj_strtod.c)
set(GIE_SRC gie.c proj_strtod.c proj_strtod.h)
set(GIE_INCLUDE optargpm.h)

source_group("Source Files\\Bin" FILES ${GIE_SRC})

add_executable(gie ${GIE_SRC} ${GIE_INCLUDE})
target_link_libraries(gie ${PROJ_LIBRARIES})
install(TARGETS gie
RUNTIME DESTINATION ${BINDIR})
install(TARGETS gie
RUNTIME DESTINATION ${BINDIR})
4 changes: 1 addition & 3 deletions src/cct.c
Expand Up @@ -80,13 +80,11 @@ Thomas Knudsen, thokn@sdfe.dk, 2016-05-25/2017-10-26

#include "proj.h"
#include "proj_internal.h"
#include "proj_strtod.h"
#include "projects.h"
#include "optargpm.h"


/* Prototypes for functions in proj_strtod.c */
double proj_strtod(const char *str, char **endptr);
double proj_atof(const char *str);
static void logger(void *data, int level, const char *msg);
static void print(PJ_LOG_LEVEL log_level, const char *fmt, ...);

Expand Down
5 changes: 1 addition & 4 deletions src/gie.c
Expand Up @@ -116,6 +116,7 @@ Thomas Knudsen, thokn@sdfe.dk, 2017-10-01/2017-10-08
#include "proj.h"
#include "proj_internal.h"
#include "proj_math.h"
#include "proj_strtod.h"
#include "projects.h"

#include "optargpm.h"
Expand Down Expand Up @@ -154,10 +155,6 @@ static const char *gie_tags[] = {
static const size_t n_gie_tags = sizeof gie_tags / sizeof gie_tags[0];


/* from proj_strtod.c */
double proj_strtod(const char *str, char **endptr);
double proj_atof(const char *str);

int main(int argc, char **argv);

static int dispatch (const char *cmnd, const char *args);
Expand Down
6 changes: 1 addition & 5 deletions src/proj_strtod.c
Expand Up @@ -85,6 +85,7 @@ Thomas Knudsen, thokn@sdfe.dk, 2017-01-17/2017-09-18
***********************************************************************/

#include "proj_strtod.h"

#include <stdlib.h> /* for abs */
#include <string.h> /* for strchr */
Expand All @@ -93,9 +94,6 @@ Thomas Knudsen, thokn@sdfe.dk, 2017-01-17/2017-09-18
#include <float.h> /* for HUGE_VAL */
#include <math.h> /* for pow() */

double proj_strtod(const char *str, char **endptr);
double proj_atof(const char *str);


double proj_strtod(const char *str, char **endptr) {
double number = 0, integral_part = 0;
Expand Down Expand Up @@ -321,8 +319,6 @@ double proj_atof(const char *str) {
/* compile/run: gcc -DTEST -o proj_strtod_test proj_strtod.c && proj_strtod_test */

#include <stdio.h>
#include <stdlib.h>
#include <string.h>

char *un_underscore (char *s) {
static char u[1024];
Expand Down
4 changes: 4 additions & 0 deletions src/proj_strtod.h
@@ -0,0 +1,4 @@
/* Internal header for proj_strtod.c */

double proj_strtod(const char *str, char **endptr);
double proj_atof(const char *str);

0 comments on commit 5d105cb

Please sign in to comment.