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

 
 

bug #37264: longlong not working

Submitted by:  Simon Josefsson <jas>
Submitted on:  Mon 03 Sep 2012 01:24:17 PM UTC  
 
Category: NoneSeverity: 3 - Normal
Item Group: NoneStatus: Fixed
Privacy: PublicAssigned to: Lorenzo Bettini <bettini>
Originator Name: Open/Closed: Closed

Add a New Comment(Rich Markup)
   

You are not logged in

Please log in, so followups can be emailed to you.

 

Fri 02 Nov 2012 03:36:31 PM UTC, comment #1:

Fixed in

http://git.savannah.gnu.org/cgit/gengetopt.git/commit/?h=devel&id=ae8a5678d57acc2f223a3a0754005debd186e1b8

Lorenzo Bettini <bettini>
Project AdministratorIn charge of this item.
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 File(s):
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

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

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 3 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Fri 02 Nov 2012 03:36:46 PM UTCbettiniOpen/ClosedOpen=>Closed
    Fri 02 Nov 2012 03:36:31 PM UTCbettiniStatusNone=>Fixed
      Assigned toNone=>bettini

    Back to the top


    Powered by Savane 3.1-cleanup1