[GRASS-dev] [GRASS GIS] #2919: Use SFD above this threshold - infinity doesn't work in r.stream.extract

GRASS GIS trac at osgeo.org
Sun Oct 29 08:53:13 PDT 2017


#2919: Use SFD above this threshold - infinity doesn't work in r.stream.extract
----------------------+---------------------------------
  Reporter:  PitStop  |      Owner:  grass-dev@…
      Type:  defect   |     Status:  new
  Priority:  normal   |  Milestone:  7.2.3
 Component:  Raster   |    Version:  svn-releasebranch72
Resolution:           |   Keywords:  r.stream.extract
       CPU:  x86-64   |   Platform:  MSWindows 8
----------------------+---------------------------------

Comment (by mmetz):

 Replying to [comment:11 marisn]:
 > Replying to [comment:10 hellik]:
 > > > Seems that "infinity" is not understood by the parser?
 > > >
 > > >
 https://trac.osgeo.org/grass/browser/grass/branches/releasebranch_7_0/raster/r.stream.extract/main.c#L195
 > >
 > > yes, it seems to be a parser issue. but why it works then in linux?
 > My guess - input.d8cut->answer contains extra chars (CR/LF issue?)

 there can't be CR/LF, answers are terminated by '\0'

 > and thus changing line to read:
 > {{{
 > if (strncmp(input.d8cut->answer, "infinity", 8) == 0) {
 > }}}
 > would solve the issue.

 The d8cut option is not required, therefore I removed the problematic
 default answer "infinity" and changed

 {{{
 -    if (strcmp(input.d8cut->answer, "infinity") == 0) {
 +    if (!input.d8cut->answer) {
 }}}

 in trunk and relbr72 with r71607,8.

 > Still, if it is so, then it is worth to digg deeper to see why it is
 failing as strcmp is used in many modules.

 I guess that the MS Windows version of sscanf does not recognize infinity
 as a floating point number, while the Linux version does.

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/2919#comment:12>
GRASS GIS <https://grass.osgeo.org>



More information about the grass-dev mailing list