Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
98bda80
Add CMake support
rkanavath Jan 14, 2020
628e04b
Avoid use of bare-exception
rkanavath Jan 14, 2020
2d3d0ba
use python3
rkanavath Jan 14, 2020
6ea13bc
check for GRASS_CONFIG_DIR to load rc and env.sh from it
rkanavath Jan 15, 2020
6de92e6
Add cmake configure input files
rkanavath Jan 15, 2020
4c97b17
fix install commands
rkanavath Jan 15, 2020
7aed313
PROJ.4 -> PROJ
rkanavath Jan 15, 2020
cbbb42e
fix ctypesgen
rkanavath Feb 17, 2020
4a915f7
fix build gui/icons
rkanavath Feb 17, 2020
4f75c29
fix cmake deps of nviz, ogsf
rkanavath Feb 17, 2020
abea61c
Support for MSVC. Use _WIN32 instead of __MINGW32__
rkanavath Feb 14, 2020
4478942
MSVC: add unistd.h
rkanavath Feb 14, 2020
a24d946
MSVC: missing strings.h
rkanavath Feb 14, 2020
69d32cd
MSVC: missing dirent on MSVC
rkanavath Feb 14, 2020
2236aa6
MSVC: win32 gettimeofday replacement from postgresql
rkanavath Feb 14, 2020
fb134e0
MSVC: add __declspec attribute on windows
rkanavath Feb 15, 2020
d1caa3e
export static int initialized
rkanavath Feb 15, 2020
57a6ed1
MSVC: ostream header is avaiable in GCC and MSVC
rkanavath Feb 15, 2020
5696858
missing include
rkanavath Feb 15, 2020
bfb3f12
MSVC: disable warning for function without return type
rkanavath Feb 15, 2020
6357415
MSVC: chmod is unix only
rkanavath Feb 15, 2020
e0b7170
MSVC: fix struct complex
rkanavath Feb 15, 2020
af03bf1
MSVC does not support VLAs
rkanavath Feb 15, 2020
ceb1d12
MSVC: Fix pointer arithmetic
rkanavath Feb 15, 2020
f76f205
MSVC: fix nan/inf issues on msvc and gcc
rkanavath Feb 15, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion general/g.region/printwindow.c
Original file line number Diff line number Diff line change
Expand Up @@ -466,7 +466,10 @@ void print_window(struct Cell_head *window, int print_flag, int flat_flag)
double convergence;

if (G_projection() == PROJECTION_XY)
convergence = 0./0.;
// GCC 5.4.0 says 0./0. is -nan
// Clang 3.8.0 says 0./0. is nan
// I stick to -nan in msvc too. But this has to rechecked.
sscanf("-nan", "%lf", &convergence);
Comment on lines +469 to +472
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In #2681, the code was changed to use NAN, but there's a note that some of them won't work for MSVC (at that time), but it was not mentioned for the NAN change.

if (G_projection() == PROJECTION_XY)
            convergence = NAN;

else if (G_projection() == PROJECTION_LL)
convergence = 0.0;
else {
Expand Down
2 changes: 1 addition & 1 deletion lib/btree2/kdtree.c
Original file line number Diff line number Diff line change
Expand Up @@ -524,7 +524,7 @@ int kdtree_knn(struct kdtree *t, double *c, int *uid, double *d, int k, int *ski
if (skip)
sn.uid = *skip;

maxdist = 1.0 / 0.0;
sscanf("inf", "%lf", &maxdist);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In #2681, the code was changed to use INFINITY, but there's a note that it might not for MSVC (at that time)

found = 0;

/* go down */
Expand Down
12 changes: 9 additions & 3 deletions lib/vector/Vlib/box.c
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,9 @@ int Vect_get_line_box(const struct Map_info *Map, int line, struct bound_box *Bo

Line = Plus->Line[line];
if (Line == NULL) { /* dead */
Box->N = Box->S = Box->E = Box->W = Box->T = Box->B = 0. / 0.;
double nan_val;
sscanf("-nan", "%lf", &nan_val);
Box->N = Box->S = Box->E = Box->W = Box->T = Box->B = nan_val;
Comment on lines +255 to +257
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In #2681, the code was changed to use NAN:

    Line = Plus->Line[line];
    if (Line == NULL) { /* dead */
        Box->N = Box->S = Box->E = Box->W = Box->T = Box->B = NAN;
        return 0;
    }

return 0;
}

Expand Down Expand Up @@ -317,7 +319,9 @@ int Vect_get_area_box(const struct Map_info *Map, int area, struct bound_box *Bo
Area = Plus->Area[area];

if (Area == NULL) { /* dead */
Box->N = Box->S = Box->E = Box->W = Box->T = Box->B = 0. / 0.;
double nan_val;
sscanf("-nan", "%lf", &nan_val);
Box->N = Box->S = Box->E = Box->W = Box->T = Box->B = nan_val;
Comment on lines +322 to +324
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In #2681, the code was changed to use NAN:

    if (Area == NULL) { /* dead */
        Box->N = Box->S = Box->E = Box->W = Box->T = Box->B = NAN;
        return 0;
    }

return 0;
}

Expand Down Expand Up @@ -363,7 +367,9 @@ int Vect_get_isle_box(const struct Map_info *Map, int isle, struct bound_box *Bo
Isle = Plus->Isle[isle];

if (Isle == NULL) { /* dead */
Box->N = Box->S = Box->E = Box->W = Box->T = Box->B = 0. / 0.;
double nan_val;
sscanf("-nan", "%lf", &nan_val);
Box->N = Box->S = Box->E = Box->W = Box->T = Box->B = nan_val;
Comment on lines +370 to +372
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In #2681, the code was changed to use NAN:

    Isle = Plus->Isle[isle];

    if (Isle == NULL) { /* dead */
        Box->N = Box->S = Box->E = Box->W = Box->T = Box->B = NAN;
        return 0;
    }

return 0;
}

Expand Down
2 changes: 1 addition & 1 deletion raster/r.horizon/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -773,7 +773,7 @@ double horizon_height(void)
{
double height;

tanh0 = -1.0 / 0.0; /* -inf */
sscanf("-inf", "%lf", &tanh0); /* -inf */
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

r.horizon was significantly refactored, in #3346, #3565 and other PRs, and this code doesn't exist anymore in this shape.

length = 0;

height = searching();
Expand Down
3 changes: 2 additions & 1 deletion raster/r.in.bin/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,8 @@ int main(int argc, char *argv[])
const char *outpre;
char output[GNAME_MAX];
const char *title;
double null_val = 0.0/0.0;
double null_val;
sscanf("-nan", "%lf", &null_val);
Comment on lines +231 to +232
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In #2681, it has been changed to NAN.

int is_fp;
int is_signed;
int bytes, hbytes;
Expand Down
4 changes: 3 additions & 1 deletion raster/r.in.lidar/info.c
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,9 @@ int scan_bounds(LASReaderH LAS_reader, int shell_style, int extents, int update,
first = TRUE;

/* init to nan in case no points are found */
min_x = max_x = min_y = max_y = min_z = max_z = 0.0 / 0.0;
double nan_val;
sscanf("-nan", "%lf", &nan_val);
min_x = max_x = min_y = max_y = min_z = max_z = nan_val;
Comment on lines +106 to +108
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In #2681, it has been changed to use NAN like this:

    /* init to nan in case no points are found */
    min_x = max_x = min_y = max_y = min_z = max_z = NAN;


G_verbose_message(_("Scanning data ..."));

Expand Down
12 changes: 6 additions & 6 deletions raster/r.li/r.li.padrange/padrange.c
Original file line number Diff line number Diff line change
Expand Up @@ -315,8 +315,8 @@ int calculate(int fd, struct area_entry *ad, double *result)
(((NS_DIST1 + NS_DIST2) / 2) / hd.rows);

/* get min and max patch size */
min = 1.0 / 0.0; /* inf */
max = -1.0 / 0.0; /* -inf */
sscanf("inf", "%lf", &min); /* inf */
sscanf("-inf", "%lf", &max); /* -inf */
Comment on lines +318 to +319
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In #2681, the code was changed to use INFINITY and -INFINITY, but there's a note that it might not for MSVC (at that time):

        min = INFINITY;
        max = -INFINITY;

for (old_pid = 1; old_pid <= pid; old_pid++) {
if (pst[old_pid].count > 0) {
area_p = cell_size_m * pst[old_pid].count / 10000;
Expand Down Expand Up @@ -551,8 +551,8 @@ int calculateD(int fd, struct area_entry *ad, double *result)
(((NS_DIST1 + NS_DIST2) / 2) / hd.rows);

/* get min and max patch size */
min = 1.0 / 0.0; /* inf */
max = -1.0 / 0.0; /* -inf */
sscanf("inf", "%lf", &min); /* inf */
sscanf("-inf", "%lf", &max); /* -inf */
Comment on lines +554 to +555
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In #2681, the code was changed to use INFINITY and -INFINITY, but there's a note that it might not for MSVC (at that time):

        min = INFINITY;
        max = -INFINITY;

for (old_pid = 1; old_pid <= pid; old_pid++) {
if (pst[old_pid].count > 0) {
area_p = cell_size_m * pst[old_pid].count / 10000;
Expand Down Expand Up @@ -787,8 +787,8 @@ int calculateF(int fd, struct area_entry *ad, double *result)
(((NS_DIST1 + NS_DIST2) / 2) / hd.rows);

/* get min and max patch size */
min = 1.0 / 0.0; /* inf */
max = -1.0 / 0.0; /* -inf */
sscanf("inf", "%lf", &min); /* inf */
sscanf("-inf", "%lf", &max); /* -inf */
Comment on lines +790 to +791
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In #2681, the code was changed to use INFINITY and -INFINITY, but there's a note that it might not for MSVC (at that time):

        min = INFINITY;
        max = -INFINITY;

for (old_pid = 1; old_pid <= pid; old_pid++) {
if (pst[old_pid].count > 0) {
area_p = cell_size_m * pst[old_pid].count / 10000;
Expand Down
6 changes: 4 additions & 2 deletions raster/r.out.gdal/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -895,6 +895,8 @@ int nodataval_check(double nodataval, GDALDataType datatype)

double set_default_nodata_value(GDALDataType datatype, double min, double max)
{
double nan_val;
sscanf("-nan", "%lf", &nan_val);
Comment on lines +898 to +899
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In #2681, the returns have been changed to use NAN and doesn't use this

switch (datatype) {
case GDT_Byte:
if (max < TYPE_BYTE_MAX)
Expand Down Expand Up @@ -940,11 +942,11 @@ double set_default_nodata_value(GDALDataType datatype, double min, double max)

case GDT_Float32:
case GDT_CFloat32:
return 0.0 / 0.0;
return nan_val;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In #2681, it has been changed to use NAN like this:

    case GDT_Float32:
    case GDT_CFloat32:
        return NAN;


case GDT_Float64:
case GDT_CFloat64:
return 0.0 / 0.0;
return nan_val;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In #2681, it has been changed to use NAN like this:

    case GDT_Float64:
    case GDT_CFloat64:
        return NAN;


default:
return 0;
Expand Down
4 changes: 2 additions & 2 deletions raster/r.series.accumulate/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -169,8 +169,8 @@ int main(int argc, char *argv[])
if (G_parser(argc, argv))
exit(EXIT_FAILURE);

lo = -1.0 / 0.0; /* -inf */
hi = 1.0 / 0.0; /* inf */
sscanf("-inf", "%lf", &lo);
sscanf("inf", "%lf", &hi);
Comment on lines +172 to +173
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In #2681, the code was changed to use -INFINITY and INFINITY, but there's a note that it might not for MSVC (at that time):

    lo = -INFINITY;
    hi = INFINITY;


method = METHOD_GDD;
if (G_strncasecmp(parm.method->answer, "gdd", 3) == 0)
Expand Down
5 changes: 3 additions & 2 deletions raster/r.series/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -194,8 +194,9 @@ int main(int argc, char *argv[])
if (G_parser(argc, argv))
exit(EXIT_FAILURE);

lo = -1.0 / 0.0; /* -inf */
hi = 1.0 / 0.0; /* inf */
sscanf("-inf", "%lf", &lo);
sscanf("inf", "%lf", &hi);

Comment on lines +197 to +199
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In #2681, the code was changed to use -INFINITY and INFINITY, but there's a note that it might not for MSVC (at that time):

    lo = -INFINITY;
    hi = INFINITY;

if (parm.range->answer) {
lo = atof(parm.range->answers[0]);
hi = atof(parm.range->answers[1]);
Expand Down
7 changes: 4 additions & 3 deletions raster/r.univar/r.univar_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -132,9 +132,10 @@ int main(int argc, char *argv[])

/* table field separator */
zone_info.sep = G_option_to_separator(param.separator);

zone_info.min = 0.0 / 0.0; /* set to nan as default */
zone_info.max = 0.0 / 0.0; /* set to nan as default */
double nan_val;
sscanf("-nan", "%lf", &nan_val);
zone_info.min = nan_val; /* set to nan as default */
zone_info.max = nan_val; /* set to nan as default */
Comment on lines +135 to +138
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In #2681, the code was changed to use only 0:

    /* table field separator */
    zone_info.sep = G_option_to_separator(param.separator);

    zone_info.min = 0;
    zone_info.max = 0;
    zone_info.n_zones = 0;

zone_info.n_zones = 0;

fdz = -1;
Expand Down
8 changes: 4 additions & 4 deletions raster/r.univar/r3.univar_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -132,10 +132,10 @@ int main(int argc, char *argv[])
/* table field separator */
zone_info.sep = G_option_to_separator(param.separator);

dmin = 0.0 / 0.0; /* set to nan as default */
dmax = 0.0 / 0.0; /* set to nan as default */
zone_info.min = 0.0 / 0.0; /* set to nan as default */
zone_info.max = 0.0 / 0.0; /* set to nan as default */
sscanf("-nan", "%lf", &dmin); /* set to nan as default */
sscanf("-nan", "%lf", &dmax); /* set to nan as default */
sscanf("-nan", "%lf", &zone_info.min); /* set to nan as default */
sscanf("-nan", "%lf", &zone_info.max); /* set to nan as default */
Comment on lines +135 to +138
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In #2681, the code was changed to use NAN and 0:

    /* table field separator */
    zone_info.sep = G_option_to_separator(param.separator);

    dmin = NAN;
    dmax = NAN;
    zone_info.min = 0;
    zone_info.max = 0;
    zone_info.n_zones = 0;

zone_info.n_zones = 0;

/* open 3D zoning raster with default region */
Expand Down
28 changes: 16 additions & 12 deletions raster/r.univar/stats.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ univar_stat *create_univar_stat_struct(int map_type, int n_perc)
univar_stat *stats;
int i;
int n_zones = zone_info.n_zones;

double nan_val;
sscanf("-nan", "%lf", &nan_val);
Comment on lines +24 to +25
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In #2681, the returns have been changed to use NAN and doesn't use this

if (n_zones == 0)
n_zones = 1;

Expand All @@ -30,8 +31,8 @@ univar_stat *create_univar_stat_struct(int map_type, int n_perc)
for (i = 0; i < n_zones; i++) {
stats[i].sum = 0.0;
stats[i].sumsq = 0.0;
stats[i].min = 0.0 / 0.0; /* set to nan as default */
stats[i].max = 0.0 / 0.0; /* set to nan as default */
stats[i].min = nan_val; /* set to nan as default */
stats[i].max = nan_val; /* set to nan as default */
Comment on lines +34 to +35
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In #2681, the code was changed to use NAN:

    for (i = 0; i < n_zones; i++) {
        stats[i].sum = 0.0;
        stats[i].sumsq = 0.0;
        stats[i].min = NAN;
        stats[i].max = NAN;

stats[i].n_perc = n_perc;
if (n_perc > 0)
stats[i].perc = (double *)G_malloc(n_perc * sizeof(double));
Expand Down Expand Up @@ -105,7 +106,8 @@ void free_univar_stat_struct(univar_stat * stats)
int print_stats(univar_stat * stats)
{
int z, n_zones = zone_info.n_zones;

double nan_val;
sscanf("-nan", "%lf", &nan_val);
Comment on lines +109 to +110
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In #2681, the returns have been changed to use NAN and doesn't use this

if (n_zones == 0)
n_zones = 1;

Expand All @@ -127,8 +129,9 @@ int print_stats(univar_stat * stats)
stdev = sqrt(variance);
var_coef = (stdev / mean) * 100.; /* perhaps stdev/fabs(mean) ? */

if (stats[z].n == 0)
stats[z].sum = stats[z].sum_abs = 0.0 / 0.0;
if (stats[z].n == 0) {
stats[z].sum = stats[z].sum_abs = nan_val;
}
Comment on lines +132 to +134
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In #2681, the code was changed to use NAN:

        if (stats[z].n == 0)
            stats[z].sum = stats[z].sum_abs = NAN;

sprintf(sum_str, "%.15g", stats[z].sum);
G_trim_decimal(sum_str);

Expand Down Expand Up @@ -182,9 +185,9 @@ int print_stats(univar_stat * stats)
quartile_perc = (double *)G_calloc(stats[z].n_perc, sizeof(double));

if (stats[z].n == 0) {
quartile_25 = median = quartile_75 = 0.0 / 0.0;
quartile_25 = median = quartile_75 = nan_val;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In #2681, the code was changed to use NAN:

            if (stats[z].n == 0) {
                quartile_25 = median = quartile_75 = NAN;
                for (i = 0; i < stats[z].n_perc; i++)
                    quartile_perc[i] = NAN;
            }

for (i = 0; i < stats[z].n_perc; i++)
quartile_perc[i] = 0.0 / 0.0;
quartile_perc[i] = nan_val;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In #2681, the code was changed to use NAN:

            if (stats[z].n == 0) {
                quartile_25 = median = quartile_75 = NAN;
                for (i = 0; i < stats[z].n_perc; i++)
                    quartile_perc[i] = NAN;
            }

}
else {
for (i = 0; i < stats[z].n_perc; i++) {
Expand Down Expand Up @@ -308,7 +311,8 @@ int print_stats_table(univar_stat * stats)
{
unsigned int i;
int z, n_zones = zone_info.n_zones;

double nan_val;
sscanf("-nan", "%lf", &nan_val);
Comment on lines +314 to +315
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In #2681, the returns have been changed to use NAN and doesn't use this

if (n_zones == 0)
n_zones = 1;

Expand Down Expand Up @@ -378,7 +382,7 @@ int print_stats_table(univar_stat * stats)
var_coef = (stdev / mean) * 100.; /* perhaps stdev/fabs(mean) ? */

if (stats[z].n == 0)
stats[z].sum = stats[z].sum_abs = 0.0 / 0.0;
stats[z].sum = stats[z].sum_abs = nan_val;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In #2681, the code was changed to use NAN:

        if (stats[z].n == 0)
            stats[z].sum = stats[z].sum_abs = NAN;


if (zone_info.n_zones) {
int z_cat = z + zone_info.min;
Expand Down Expand Up @@ -424,9 +428,9 @@ int print_stats_table(univar_stat * stats)


if (stats[z].n == 0) {
quartile_25 = median = quartile_75 = 0.0 / 0.0;
quartile_25 = median = quartile_75 = nan_val;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In #2681, the code was changed to use NAN:

            if (stats[z].n == 0) {
                quartile_25 = median = quartile_75 = NAN;
                for (i = 0; i < stats[z].n_perc; i++)
                    quartile_perc[i] = NAN;
            }

for (i = 0; i < stats[z].n_perc; i++)
quartile_perc[i] = 0.0 / 0.0;
quartile_perc[i] = nan_val;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In #2681, the code was changed to use NAN:

            if (stats[z].n == 0) {
                quartile_25 = median = quartile_75 = NAN;
                for (i = 0; i < stats[z].n_perc; i++)
                    quartile_perc[i] = NAN;
            }

}
else {
for (i = 0; i < stats[z].n_perc; i++) {
Expand Down
4 changes: 3 additions & 1 deletion raster3d/r3.in.lidar/info.c
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,9 @@ int scan_bounds(LASReaderH LAS_reader, int shell_style, int extents, int update,
first = TRUE;

/* init to nan in case no points are found */
min_x = max_x = min_y = max_y = min_z = max_z = 0.0 / 0.0;
double nan_val;
sscanf("-nan", "%lf", &nan_val);
min_x = max_x = min_y = max_y = min_z = max_z = nan_val;
Comment on lines +107 to +109
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In #2681, the code was changed to use NAN:

    /* init to nan in case no points are found */
    min_x = max_x = min_y = max_y = min_z = max_z = NAN;


G_verbose_message(_("Scanning data ..."));

Expand Down
4 changes: 2 additions & 2 deletions vector/v.cluster/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ int main(int argc, char *argv[])
c[2] = 0.0;
n = 0;
sum = sumsq = 0;
min = 1.0 / 0.0;
sscanf("inf", "%lf", &min);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In #2681, the code was changed to use INFINITY, but there's a note that it might not for MSVC (at that time)

            min = INFINITY;

max = 0;
kd = G_malloc(minpnts * sizeof(double));
ki = G_malloc(minpnts * sizeof(int));
Expand Down Expand Up @@ -469,7 +469,7 @@ int main(int argc, char *argv[])
c[2] = 0.0;
n = 0;
sum = sumsq = 0;
min = 1.0 / 0.0;
sscanf("inf", "%lf", &min);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In #2681, the code was changed to use INFINITY, but there's a note that it might not for MSVC (at that time)

            min = INFINITY;

max = 0;
kd = G_malloc(minpnts * sizeof(double));
ki = G_malloc(minpnts * sizeof(int));
Expand Down
4 changes: 3 additions & 1 deletion vector/v.distance/distance.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@ int get_line_box(const struct line_pnts *Points,
int i;

if (Points->n_points == 0) {
box->E = box->W = box->N = box->S = box->T = box->B = 0.0 / 0.0;
double nan_val;
sscanf("-nan", "%lf", &nan_val);
box->E = box->W = box->N = box->S = box->T = box->B = nan_val;
Comment on lines +15 to +17
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In #2681, the code was changed to use NAN:

    if (Points->n_points == 0) {
        box->E = box->W = box->N = box->S = box->T = box->B = NAN;
        return 0;
    }

return 0;
}

Expand Down
2 changes: 1 addition & 1 deletion vector/v.voronoi/skeleton.c
Original file line number Diff line number Diff line change
Expand Up @@ -525,7 +525,7 @@ int tie_up(void)
IPoints[i]);
}

distmin = 1. / 0.; /* +inf */
sscanf("inf", "%lf", &distmin);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In #2681, the code was changed to use INFINITY, but there's a note that it might not for MSVC (at that time)

        distmin = INFINITY;

xmin = x;
ymin = y;

Expand Down