]> git.ozlabs.org Git - yaboot.git/commitdiff
warnings: Add explict casts to silence many compiler warnings about sign comparisions.
authorTony Breeds <tony@bakeyournoodle.com>
Tue, 18 Oct 2011 00:50:55 +0000 (11:50 +1100)
committerTony Breeds <tony@bakeyournoodle.com>
Tue, 18 Oct 2011 04:11:10 +0000 (15:11 +1100)
Signed-off-by: Tony Breeds <tony@bakeyournoodle.com>
include/ext2fs/bitops.h
include/md5.h
second/fs_ext2.c
second/fs_swap.c
second/fs_xfs.c
second/md5.c
second/partition.c
second/yaboot.c
util/addnote.c

index ae6ec34a4a5e4939ca25bbec7ea5e9f15acfceed..72c8945c18039a12e970705bc46b4cc5df106caa 100644 (file)
@@ -415,7 +415,7 @@ extern int ffs(unsigned int);
 
 _INLINE_ int ext2fs_find_first_bit_set(void * addr, unsigned size)
 {
-       char    *cp = (unsigned char *) addr;
+       unsigned char   *cp = (unsigned char *) addr;
        int     res = 0, d0;
 
        if (!size)
index c1dbd060740b444f8d203dc9d2648dee37b278e8..82cc91e55a9ce8527457e88e85bd8452090813e2 100644 (file)
@@ -23,7 +23,7 @@
    to strcmp.
    If CHECK is false, crypt KEY and save the result in CRYPTED.
    CRYPTED must have a salt.  */
-extern int md5_password (const char *key, char *crypted, int check);
+extern int md5_password (const unsigned char *key, unsigned char *crypted, int check);
 
 /* For convenience.  */
 #define check_md5_password(key,crypted)        md5_password((key), (crypted), 1)
index a8bdf6bdf6d8de71a3bdf11275317eb9d6f234b5..a85958f0323f54e4d73c00ce158d8bc70208f8d1 100644 (file)
@@ -109,7 +109,7 @@ static unsigned long read_total;
 static unsigned long read_max;
 static struct boot_file_t* read_cur_file;
 static errcode_t read_result;
-static char* read_buffer;
+static unsigned char* read_buffer;
 
 static int read_dump_range(void);
 static int read_iterator(ext2_filsys fs, blk_t *blocknr, int lg_block, void *private);
index cfa57094567550d3f8aff78a31722d9da016cb85..87da8775f85c8db55e7101261e88a4ac56f713e6 100644 (file)
@@ -54,7 +54,7 @@ swap_open(struct boot_file_t* file, struct partition_t* part,
      int i;
      unsigned char *buffer;
      /* Make static to move into the BSS rather then the stack */
-     static unsigned char device_name[1024];
+     static char device_name[1024];
 
      DEBUG_ENTER;
      DEBUG_OPEN;
index e27d857a7d23b87ada047d7376cc8fc614b6ad36..789106871aa388d246a784e87e1eeb38def8314f 100644 (file)
@@ -490,7 +490,7 @@ next_dentry (xfs_ino_t *ino)
        int toread;
        static char *usual[2] = {".", ".."};
        static xfs_dir2_sf_entry_t *sfe;
-       char *name = usual[0];
+       unsigned char *name = (unsigned char *)usual[0];
 
        if (xfs.dirpos >= xfs.dirmax) {
                if (xfs.forw == 0)
@@ -552,14 +552,14 @@ next_dentry (xfs_ino_t *ino)
 #undef dau
                toread = roundup8 (namelen + 11) - 9;
                xfs_read_data (dirbuf, toread);
-               name = (char *)dirbuf;
+               name = (unsigned char *)dirbuf;
                xfs.blkoff += toread + 5;
                break;
        }
        ++xfs.dirpos;
        name[namelen] = 0;
 
-       return name;
+       return (char *)name;
 }
 
 static char *
index 853696cea0fc9bacf0363de93727c258c86cafa3..91164938dbb29b33acaa7365d2462f3178fd414f 100644 (file)
@@ -156,7 +156,7 @@ md5_init(void)
 }
 
 static void
-md5_update (const char *input, int inputlen)
+md5_update (const unsigned char *input, int inputlen)
 {
   int buflen = length & 63;
   length += inputlen;
@@ -211,21 +211,21 @@ md5_final()
    If CHECK is false, crypt KEY and save the result in CRYPTED.
    CRYPTED must have a salt.  */
 int
-md5_password (const char *key, char *crypted, int check)
+md5_password (const unsigned char *key, unsigned char *crypted, int check)
 {
-  int keylen = strlen (key);
-  char *salt = crypted + 3; /* skip $1$ header */
-  char *p;
+  int keylen = strlen ((char *)key);
+  unsigned char *salt = crypted + 3; /* skip $1$ header */
+  unsigned char *p;
   int saltlen;
   int i, n;
   unsigned char alt_result[16];
   unsigned char *digest;
 
   if (check)
-    saltlen = strstr (salt, "$") - salt;
+    saltlen = strstr ((char *)salt, "$") - (char* )salt;
   else
     {
-      char *end = strstr (salt, "$");
+      unsigned char *end = (unsigned char*)strstr ((char *)salt, "$");
       if (end && end - salt < 8)
        saltlen = end - salt;
       else
index 4381770fcca5facc0171fc52308b273478235608..eb383bcde281f71f198be480dc6e19df4b4ebfb3 100644 (file)
@@ -337,12 +337,12 @@ partitions_lookup(const char *device)
      struct partition_t* list = NULL;
      unsigned int prom_blksize, iso_root_block;
 
-     strncpy(block_buffer, device, 2040);
+     strncpy((char *)block_buffer, device, 2040);
      if (_machine != _MACH_bplan)
-         strcat(block_buffer, ":0");
+         strcat((char *)block_buffer, ":0");
 
      /* Open device */
-     disk = prom_open(block_buffer);
+     disk = prom_open((char *)block_buffer);
      if (disk == NULL) {
          prom_printf("Can't open device <%s>\n", block_buffer);
          goto bail;
index 1f3f1518845aa67b0a81847f226a775a2ea9c34d..0fd26a106af36d2599019ebb9289aa1ba150bc5b 100644 (file)
@@ -603,7 +603,7 @@ void check_password(char *str)
          prom_printf ("\n");
 #ifdef USE_MD5_PASSWORDS
          if (!strncmp (password, "$1$", 3)) {
-              if (!check_md5_password(passwdbuff, password))
+              if (!check_md5_password((unsigned char*)passwdbuff, (unsigned char*)password))
                    return;
          }
          else if (!strcmp (password, passwdbuff))
index 56de0c75e40058e6b665da8f9c9b68e13b813dd1..ec15c5972a6c132024d57b0c4b48aa42cc594865 100644 (file)
@@ -165,7 +165,7 @@ main(int ac, char **av)
      PUT_32BE(ns, strlen(arch) + 1);
      PUT_32BE(ns + 4, N_DESCR * 4);
      PUT_32BE(ns + 8, 0x1275);
-     strcpy(&buf[ns + 12], arch);
+     strcpy((char *)&buf[ns + 12], arch);
      ns += 12 + strlen(arch) + 1;
      for (i = 0; i < N_DESCR; ++i, ns += 4)
          PUT_32BE(ns, descr[i]);
@@ -180,7 +180,7 @@ main(int ac, char **av)
      PUT_32BE(ns, strlen(rpaname) + 1);
      PUT_32BE(ns + 4, sizeof(rpanote));
      PUT_32BE(ns + 8, 0x12759999);
-     strcpy(&buf[ns + 12], rpaname);
+     strcpy((char *)&buf[ns + 12], rpaname);
      ns += 12 + ROUNDUP(strlen(rpaname) + 1);
      for (i = 0; i < N_RPA_DESCR; ++i, ns += 4)
          PUT_32BE(ns, rpanote[i]);