]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
change some listing.c variables to unsigned.
authorAlan Modra <amodra@gmail.com>
Mon, 9 Jun 2025 03:24:42 +0000 (12:54 +0930)
committerAlan Modra <amodra@gmail.com>
Mon, 9 Jun 2025 03:24:42 +0000 (12:54 +0930)
The values are unsigned, and changing the types allows some casts to
be removed.

gas/as.c
gas/listing.c
gas/listing.h

index 7edac577d16c3400acc3e92d8ecea1e1a782e400..a37d59d4649eedb49ee473a69718dd2983a1e2ff 100644 (file)
--- a/gas/as.c
+++ b/gas/as.c
@@ -930,7 +930,7 @@ This program has absolutely no warranty.\n"));
          break;
        case OPTION_LISTING_LHS_WIDTH2:
          {
-           int tmp = atoi (optarg);
+           unsigned int tmp = atoi (optarg);
 
            if (tmp > listing_lhs_width)
              listing_lhs_width_second = tmp;
index 0d1f4e8066a3448e1809bc5574e7c7ea6acf1418..d611179309008e339f9b1928b85333232f12e3d4 100644 (file)
@@ -190,10 +190,10 @@ struct list_info_struct
 
 typedef struct list_info_struct list_info_type;
 
-int listing_lhs_width        = LISTING_LHS_WIDTH;
-int listing_lhs_width_second = LISTING_LHS_WIDTH_SECOND;
-int listing_lhs_cont_lines   = LISTING_LHS_CONT_LINES;
-int listing_rhs_width        = LISTING_RHS_WIDTH;
+unsigned int listing_lhs_width        = LISTING_LHS_WIDTH;
+unsigned int listing_lhs_width_second = LISTING_LHS_WIDTH_SECOND;
+unsigned int listing_lhs_cont_lines   = LISTING_LHS_CONT_LINES;
+unsigned int listing_rhs_width        = LISTING_RHS_WIDTH;
 
 struct list_info_struct *        listing_tail;
 
@@ -201,8 +201,8 @@ static file_info_type *          file_info_head;
 static file_info_type *          last_open_file_info;
 static FILE *                    last_open_file;
 static struct list_info_struct * head;
-static int                       paper_width = 200;
-static int                       paper_height = 60;
+static unsigned int              paper_width = 200;
+static unsigned int              paper_height = 60;
 
 extern int                       listing;
 
@@ -735,7 +735,7 @@ listing_page (list_info_type *list)
 {
   /* Grope around, see if we can see a title or subtitle edict coming up
      soon.  (we look down 10 lines of the page and see if it's there)  */
-  if ((eject || (on_page >= (unsigned int) paper_height))
+  if ((eject || (on_page >= paper_height))
       && paper_height != 0)
     {
       unsigned int c = 10;
@@ -793,7 +793,7 @@ emit_line (list_info_type * list, const char * format, ...)
 static unsigned int
 calc_hex (list_info_type *list)
 {
-  int data_buffer_size;
+  size_t data_buffer_size;
   list_info_type *first = list;
   unsigned int address = ~(unsigned int) 0;
   fragS *frag;
@@ -920,7 +920,7 @@ print_lines (list_info_type *list, unsigned int lineno,
     emit_line (list, "****  %s\n", msg->message);
 
   for (lines = 0;
-       lines < (unsigned int) listing_lhs_cont_lines
+       lines < listing_lhs_cont_lines
         && src[cur];
        lines++)
     {
@@ -1356,7 +1356,7 @@ print_timestamp (void)
 static void
 print_single_option (char * opt, int *pos)
 {
-  int opt_len = strlen (opt);
+  size_t opt_len = strlen (opt);
 
    if ((*pos + opt_len) < paper_width)
      {
@@ -1525,7 +1525,7 @@ listing_psize (int width_only)
     {
       paper_height = get_absolute_expression ();
 
-      if (paper_height < 0 || paper_height > 1000)
+      if (paper_height > 1000)
        {
          paper_height = 0;
          as_warn (_("strange paper height, set to no form"));
index a9822c3ae8a8bca6df6a0f6025bc7d832851273b..2abc70c32fc7d141418feaaba8343fa5c862b3c7 100644 (file)
@@ -70,10 +70,10 @@ void listing_width (unsigned int x);
 #define listing_source_line(line) ((void)(line))
 #endif
 
-extern int listing_lhs_width;
-extern int listing_lhs_width_second;
-extern int listing_lhs_cont_lines;
-extern int listing_rhs_width;
+extern unsigned int listing_lhs_width;
+extern unsigned int listing_lhs_width_second;
+extern unsigned int listing_lhs_cont_lines;
+extern unsigned int listing_rhs_width;
 
 extern struct list_info_struct *listing_tail;