bugGNU roff - Bugs: bug #59583, [PATCH] addftinfo.cpp: fix...

 
 

bug #59583: [PATCH] addftinfo.cpp: fix different declarations of "i" and "len"

Submitter:  Bjarni Ingi Gislason <bjarniig>
Submitted:  Tue 01 Dec 2020 01:28:14 AM UTC
   
 
Category:  Utilities Severity:  2 - Minor
Item Group:  Warning/Suspicious behaviour Status:  Fixed
Privacy:  Public Assigned to:  gbranden
Open/Closed:  Closed Planned Release:  1.23.0
* Mandatory Fields

Add a New Comment Rich Markup
   

Tue 22 Dec 2020 04:09:49 AM UTC, comment #3: 


commit c6273d4f655a44771eb74ee8f75ddeb9f185b021
Author: Bjarni Ingi Gislason <bjarniig@rhi.hi.is>
Date:   Tue Dec 1 01:28:14 2020 +0000

    src/utils/addftinfo/addftinfo.cpp: Fix data type.

    * src/utils/addftinfo/addftinfo.cpp (usage): Use size_t for loop
      index when iterating over a count of size_t items.  Quiets signedness
      mismatch compiler warning.

    Fixes <https://savannah.gnu.org/bugs/?59583>.


G. Branden Robinson <gbranden>
Group administrator
Thu 03 Dec 2020 12:09:05 AM UTC, comment #2: 

comment #1:

> The report was sent by the program althouch I did not push the "Submit Changes" button, but was in the Subject input box, trying to add the subject line.


This has bitten me as well.  I opened http://savannah.nongnu.org/support/?110299 to report it, but it has gotten some resistance.  Consider adding a comment there if you think this should be fixed.

Dave <barx>
Group Member
Tue 01 Dec 2020 01:35:19 AM UTC, comment #1: 

The report was sent by the program althouch I did not push the "Submit Changes" button, but was in the Subject input box, trying to add the subject line.

The subject line is in the body.


Bjarni Ingi Gislason <bjarniig>
Tue 01 Dec 2020 01:28:14 AM UTC, original submission:  

Subject: addftinfo.cpp: fix different declarations of "i" and "len"

  A warning from the compiler:

  CXX      src/utils/addftinfo/addftinfo.o
../src/utils/addftinfo/addftinfo.cpp: In function 'void usage(FILE*)':
../src/utils/addftinfo/addftinfo.cpp:139:21: warning: comparison of integer expressions of different signedness: 'int' and 'size_t' {aka 'long unsigned int'} [-Wsign-compare]
  139 |   for (int i = 0; i < len; i++)
      |                   ~~^~~~~


  I use the following patch:

--- /tmp/addftinfo.cpp 2020-12-01 01:08:50.000000000 +0000
+++ addftinfo.cpp 2020-12-01 01:09:26.000000000 +0000
@@ -136,7 +136,7 @@ static void usage(FILE *stream)
 {
   fprintf(stream, "usage: %s", program_name);
   size_t len = sizeof(param_table)/sizeof(param_table[0]);
-  for (int i = 0; i < len; i++)
+  for (size_t i = 0; i < len; i++)
     fprintf(stream, " [-%s N]", param_table[i].name);
   fprintf(stream, " RESOLUTION UNIT-WIDTH FONT\n");
   fprintf(stream, "usage: %s -v\n", program_name);


Bjarni Ingi Gislason <bjarniig>

 

(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 gbranden (Updated the item)
  • -email is unavailable- added by barx (Updated the item)
  • -email is unavailable- added by bjarniig (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 9 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2022-03-05 gbranden CategoryNone Utilities
    2020-12-22 gbranden StatusIn Progress Fixed
        Open/ClosedOpen Closed
        Planned ReleaseNone 1.23.0
    2020-12-21 gbranden Severity3 - Normal 2 - Minor
        Item GroupNone Warning/Suspicious behaviour
        StatusNone In Progress
        Assigned toNone gbranden
    2020-12-02 barx Summary[PATCH] [PATCH] addftinfo.cpp: fix different declarations of "i" and "len"

    Back to the top

    Powered by Savane 3.13-caa5.
    Corresponding source code