In this case I would not use strtol to skip digits, but a simple while loop 
instead:

    while (isdigit(*str & 255))
      str ++;

(the "& 255" part is necessary to avoid portability issues with UTF-8 strings)

On Oct 18, 2011, at 10:59 AM, Albrecht Schlosser wrote:

> On 18.10.2011 18:48, Michael Sweet wrote:
> 
>> ... an unused assignment is an unnecessary one.
> 
> Yep, that's why I was asking for better ideas.
> 
>> The unused return value warnings can be silenced with "(void)" in front of 
>> the call, if desired...
> 
> Thanks, but unfortunately this doesn't work (same warning). :-(
> 
> This is what I tried:
> 
> $ make
> Compiling Fl_Browser.cxx...
> Fl_Browser.cxx: In member function ‘virtual int 
> Fl_Browser::item_height(void*) const’:
> Fl_Browser.cxx:389: warning: ignoring return value of ‘long int 
> strtol(const char*, char**, int)’, declared with attribute 
> warn_unused_result
> /usr/bin/ar cr ../lib/libfltk.a ...
> $ gcc --version
> gcc (Ubuntu/Linaro 4.4.4-14ubuntu5) 4.4.5
> ...
> $ svn diff
> Index: Fl_Browser.cxx
> ===================================================================
> --- Fl_Browser.cxx      (revision 9133)
> +++ Fl_Browser.cxx      (working copy)
> @@ -372,7 +372,6 @@
>      if (hh > hmax) hmax = hh;
>    } else {
>      const int* i = column_widths();
> -    long int dummy;
>      // do each column separately as they may all set different fonts:
>      for (char* str = l->txt; str && *str; str++) {
>        Fl_Font font = textfont(); // default font
> @@ -387,7 +386,7 @@
>         case 'i': font = (Fl_Font)(font|FL_ITALIC); break;
>         case 'f': case 't': font = FL_COURIER; break;
>         case 'B':
> -       case 'C': dummy = strtol(str, &str, 10); break;// skip a color 
> number
> +       case 'C': (void)strtol(str, &str, 10); break;// skip a color number
>         case 'F': font = (Fl_Font)strtol(str,&str,10); break;
>         case 'S': tsize = strtol(str,&str,10); break;
>         case 0: case '@': str--;
> 
> 
> Better ideas, anybody?
> 
> (Note that this is a step back, trying to fix the previous warning
> to avoid adding the dummy variable).
> 
> 
>> FYI, the Clang-based static analyzer lives here:
>> 
>>      http://clang-analyzer.llvm.org/
>> 
>> Binaries are provided for Mac OS X, and it is actually pretty easy to build 
>> on Linux, too.
> 
> Thanks for the hint, I'll take a look at it...
> 
> Albrecht
> _______________________________________________
> fltk-dev mailing list
> [email protected]
> http://lists.easysw.com/mailman/listinfo/fltk-dev

_____________
Michael Sweet




_______________________________________________
fltk-dev mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk-dev

Reply via email to