bugGNU nano - Bugs: bug #49816, Fix mismatched variable type,...

 
 

bug #49816: Fix mismatched variable type, missing #ifdef in line number display

Submitted by:  David Lawrence Ramsey <dolorous>
Submitted on:  Fri 09 Dec 2016 05:46:38 PM UTC  
 
Severity: 2 - MinorStatus: Fixed
Assigned to: David Lawrence Ramsey <dolorous>Open/Closed: Closed

Add a New Comment(Rich Markup)
   

You are not logged in

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

 

Tue 13 Dec 2016 12:11:33 PM UTC, comment #4:

Applied to git, with some adjustment of the commit message. Thanks for the patch.

(Closing, because it doesn't fix any real bug.)

Benno Schulenberg <bens>
Project Administrator
Mon 12 Dec 2016 07:35:24 PM UTC, comment #3:

Oops, I got the types backwards on digits(). It was supposed to take a ssize_t and return an int. And you have a point on the soon-to-be-elided variables, so I removed those changes.

The attached new version should fix these.

David Lawrence Ramsey <dolorous>
Project AdministratorIn charge of this item.
Sun 11 Dec 2016 10:36:38 AM UTC, comment #2:

Hm. You write: "Convert digits() to take a ssize_t instead of int, since it's used on ssize_t line numbers", but then you convert the type of the /result/ of digits() instead of the type of the /argument/. For me, "take" refers to the argument, "produce" to the return value.

The type of the result of digits() as an int seems fine to me, no need to change that. And the two last_* variables will be elided anyway, so I don't want to fiddle with those either.

Benno Schulenberg <bens>
Project Administrator
Fri 09 Dec 2016 06:02:15 PM UTC, comment #1:

Oops: the variables last_drawn_line and last_line_y need to be ssize_t as well. New patch against current git attached.

(file #39187)

David Lawrence Ramsey <dolorous>
Project AdministratorIn charge of this item.
Fri 09 Dec 2016 05:46:38 PM UTC, original submission:

The line number display routine and the parameter passed into digits() both improperly assume that the current line number is an int instead of a ssize_t. Also, the prototype for digits() is included even when the function isn't, since the former is missing #ifdef ENABLE_LINENUMBERS.

The attached patch against current git fixes these issues.

David Lawrence Ramsey <dolorous>
Project AdministratorIn charge of this item.

 

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

Attach File(s):
   
   
Comment:
   

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by bens (Posted a comment)
  • -unavailable- added by dolorous (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 8 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Tue 13 Dec 2016 12:12:33 PM UTCbensAssigned toNone=>dolorous
    Tue 13 Dec 2016 12:11:33 PM UTCbensSeverity3 - Normal=>2 - Minor
      StatusNone=>Fixed
      Open/ClosedOpen=>Closed
    Mon 12 Dec 2016 07:35:59 PM UTCdolorousAttached File-=>Added 0001-Fix-line-number-display-to-properly-use-ssize_t-inst.patch, #39204
    Fri 09 Dec 2016 06:02:23 PM UTCdolorousAttached File#39186=>Removed
    Fri 09 Dec 2016 06:02:15 PM UTCdolorousAttached File-=>Added 0001-Fix-line-number-display-and-variables-to-properly-us.patch, #39187
    Fri 09 Dec 2016 05:46:39 PM UTCdolorousAttached File-=>Added 0001-Fix-line-number-display-to-properly-use-ssize_t-inst.patch, #39186

    Back to the top


    Powered by Savane 3.1-cleanup1