bugGNU Gengetopt - Bugs: bug #37264, longlong not working

 
 

bug #37264: longlong not working

Submitter:  Simon Josefsson <jas>
Submitted:  Mon 03 Sep 2012 01:24:17 PM UTC
   
 
Category:  None Severity:  3 - Normal
Item Group:  None Status:  Fixed
Privacy:  Public Assigned to:  bettini
Originator Name:  Open/Closed:  Closed
* Mandatory Fields

Add a New Comment Rich Markup
   

Fri 02 Nov 2012 03:36:31 PM UTC, comment #1: 
Lorenzo Bettini <bettini>
Group administrator
Mon 03 Sep 2012 01:24:17 PM UTC, original submission:  

Hi.  In OATH Toolkit I started to use the 'longlong' feature recently, to be able to specify 64-bit integers.  However I noticed that it doesn't really work well.  There are two reasons for this:

1) The generated code use the HAVE_LONG_LONG pre-processor symbol to check whether 'long long' is available.  I didn't have that symbol defined, I did have HAVE_LONG_LONG_INT defined via gnulib.  This issue could be resolved with improved documentation, stating that you need to make sure HAVE_LONG_LONG is defined when building.

2) The generated code uses 'strtol' to convert values.  This function does not handle larger values.  The code looks like this:

#ifdef HAVE_LONG_LONG
    if (val) ((long long int)field) = (long long int) strtol (val,
&stop_char, 0);
#else
    if (val) ((long )field) = (long)strtol (val, &stop_char, 0);
#endif

Changing 'strtol' to 'strtoll' works.  I'm guessing platforms with 'long long' have 'strtoll' as well, but I can't guarantee it.

/Simon

Simon Josefsson <jas>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by bettini (Posted a comment)
  • -email is unavailable- added by jas (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only logged-in users can vote.

     

    Follow 3 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2012-11-02 bettini Open/ClosedOpen Closed
    2012-11-02 bettini StatusNone Fixed
        Assigned toNone bettini

    Back to the top

    Powered by Savane 3.13-02a9.
    Corresponding source code