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

 
 

You are not allowed to post comments on this tracker with your current authentication level.

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

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

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>
Group 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>
Group Member
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>
Group 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>
Group Member
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>
Group Member

 

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

 

Depends on the following items: None found

Items that depend on this one: None found

 

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

     

    Follow 8 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2016-12-13 bens Assigned toNone dolorous
    2016-12-13 bens Severity3 - Normal 2 - Minor
        StatusNone Fixed
        Open/ClosedOpen Closed
    2016-12-12 dolorous Attached File- Added 0001-Fix-line-number-display-to-properly-use-ssize_t-inst.patch, #39204
    2016-12-09 dolorous Attached File#39186 Removed
    2016-12-09 dolorous Attached File- Added 0001-Fix-line-number-display-and-variables-to-properly-us.patch, #39187
    2016-12-09 dolorous Attached File- Added 0001-Fix-line-number-display-to-properly-use-ssize_t-inst.patch, #39186

    Back to the top

    Powered by Savane 3.13-3230.
    Corresponding source code