Initial gcc4 warning cleanup (and some minor policing)


git-svn-id: svn://svn.rockbox.org/rockbox/trunk@8063 a1c6a512-1295-4272-9138-f99709370657
diff --git a/firmware/bidi.c b/firmware/bidi.c
index 765d3da..dcb4499 100644
--- a/firmware/bidi.c
+++ b/firmware/bidi.c
@@ -38,7 +38,7 @@
 
 bool bidi_support_enabled = false;
 
-unsigned char *bidi_l2v(const unsigned char *str, int orientation)
+unsigned char *bidi_l2v(const char *str, int orientation)
 {
     static unsigned char buf_heb_str[_HEB_BUFFER_LENGTH];
     static unsigned char  buf_broken_str[_HEB_BUFFER_LENGTH];
@@ -50,9 +50,9 @@
     int begin, end, char_count, orig_begin;
 
     if (!str || !*str)
-        return "";
+        return (unsigned char *)"";
 
-    tmp = str;
+    tmp = (unsigned char *)str;
     block_start=block_end=0;
     block_ended=0;
 
diff --git a/firmware/common/memcmp.c b/firmware/common/memcmp.c
index ac7a194..4a871fa 100644
--- a/firmware/common/memcmp.c
+++ b/firmware/common/memcmp.c
@@ -95,8 +95,8 @@
 
       /* check m mod LBLOCKSIZE remaining characters */
 
-      s1 = (char*)a1;
-      s2 = (char*)a2;
+      s1 = (unsigned char*)a1;
+      s2 = (unsigned char*)a2;
     }
 
   while (n--)
diff --git a/firmware/common/memcpy.c b/firmware/common/memcpy.c
index 5b23eba..e9b8e82 100644
--- a/firmware/common/memcpy.c
+++ b/firmware/common/memcpy.c
@@ -95,7 +95,7 @@
           *aligned_dst++ = *aligned_src++;
           *aligned_dst++ = *aligned_src++;
           *aligned_dst++ = *aligned_src++;
-          len -= BIGBLOCKSIZE;
+          len -= (unsigned int)BIGBLOCKSIZE;
         }
 
       /* Copy one long word at a time if possible.  */
diff --git a/firmware/common/sprintf.c b/firmware/common/sprintf.c
index 0b42f66..d1c55d5 100644
--- a/firmware/common/sprintf.c
+++ b/firmware/common/sprintf.c
@@ -181,7 +181,7 @@
     va_list ap;
     struct for_snprintf pr;
 
-    pr.ptr = buf;
+    pr.ptr = (unsigned char *)buf;
     pr.bytes = 0;
     pr.max = size;
 
@@ -200,7 +200,7 @@
     bool ok;
     struct for_snprintf pr;
 
-    pr.ptr = buf;
+    pr.ptr = (unsigned char *)buf;
     pr.bytes = 0;
     pr.max = size;
 
diff --git a/firmware/drivers/lcd-h100-remote.c b/firmware/drivers/lcd-h100-remote.c
index 05e7791..33a8b37 100644
--- a/firmware/drivers/lcd-h100-remote.c
+++ b/firmware/drivers/lcd-h100-remote.c
@@ -1153,7 +1153,7 @@
         return;
 
     lcd_remote_getstringsize(str, &w, &h);
-    xpos = xmargin + x*w / strlen(str);
+    xpos = xmargin + x*w / strlen((char *)str);
     ypos = ymargin + y*h;
     lcd_remote_putsxy(xpos, ypos, str);
     drawmode = (DRMODE_SOLID|DRMODE_INVERSEVID);
@@ -1233,10 +1233,10 @@
         char *end;
 
         memset(s->line, 0, sizeof s->line);
-        strcpy(s->line, string);
+        strcpy(s->line, (char *)string);
 
         /* get width */
-        s->width = lcd_remote_getstringsize(s->line, &w, &h);
+        s->width = lcd_remote_getstringsize((unsigned char *)s->line, &w, &h);
 
         /* scroll bidirectional or forward only depending on the string
            width */
@@ -1250,13 +1250,13 @@
         if (!s->bidir) { /* add spaces if scrolling in the round */
             strcat(s->line, "   ");
             /* get new width incl. spaces */
-            s->width = lcd_remote_getstringsize(s->line, &w, &h);
+            s->width = lcd_remote_getstringsize((unsigned char *)s->line, &w, &h);
         }
 
         end = strchr(s->line, '\0');
-        strncpy(end, string, LCD_REMOTE_WIDTH/2);
+        strncpy(end, (char *)string, LCD_REMOTE_WIDTH/2);
 
-        s->len = strlen(string);
+        s->len = strlen((char *)string);
         s->offset = 0;
         s->startx = x;
         s->backward = false;
@@ -1332,7 +1332,7 @@
             drawmode = (DRMODE_SOLID|DRMODE_INVERSEVID);
             lcd_remote_fillrect(xpos, ypos, LCD_REMOTE_WIDTH - xpos, pf->height);
             drawmode = DRMODE_SOLID;
-            lcd_remote_putsxyofs(xpos, ypos, s->offset, s->line);
+            lcd_remote_putsxyofs(xpos, ypos, s->offset, (unsigned char *)s->line);
             if (s->invert)
             {
                 drawmode = DRMODE_COMPLEMENT;
diff --git a/firmware/drivers/lcd-h100.c b/firmware/drivers/lcd-h100.c
index 1005cf6..ba959d2 100644
--- a/firmware/drivers/lcd-h100.c
+++ b/firmware/drivers/lcd-h100.c
@@ -1069,7 +1069,7 @@
         return;
 
     lcd_getstringsize(str, &w, &h);
-    xpos = xmargin + x*w / strlen(str);
+    xpos = xmargin + x*w / strlen((char *)str);
     ypos = ymargin + y*h;
     lcd_putsxy(xpos, ypos, str);
     drawmode = (DRMODE_SOLID|DRMODE_INVERSEVID);
@@ -1155,10 +1155,10 @@
         char *end;
 
         memset(s->line, 0, sizeof s->line);
-        strcpy(s->line, string);
+        strcpy(s->line, (char *)string);
 
         /* get width */
-        s->width = lcd_getstringsize(s->line, &w, &h);
+        s->width = lcd_getstringsize((unsigned char *)s->line, &w, &h);
 
         /* scroll bidirectional or forward only depending on the string
            width */
@@ -1172,13 +1172,13 @@
         if (!s->bidir) { /* add spaces if scrolling in the round */
             strcat(s->line, "   ");
             /* get new width incl. spaces */
-            s->width = lcd_getstringsize(s->line, &w, &h);
+            s->width = lcd_getstringsize((unsigned char *)s->line, &w, &h);
         }
 
         end = strchr(s->line, '\0');
-        strncpy(end, string, LCD_WIDTH/2);
+        strncpy(end, (char *)string, LCD_WIDTH/2);
 
-        s->len = strlen(string);
+        s->len = strlen((char *)string);
         s->offset = 0;
         s->startx = x;
         s->backward = false;
@@ -1245,7 +1245,7 @@
             drawmode = (DRMODE_SOLID|DRMODE_INVERSEVID);
             lcd_fillrect(xpos, ypos, LCD_WIDTH - xpos, pf->height);
             drawmode = DRMODE_SOLID;
-            lcd_putsxyofs(xpos, ypos, s->offset, s->line);
+            lcd_putsxyofs(xpos, ypos, s->offset, (unsigned char *)s->line);
             if (s->invert)
             {
                 drawmode = DRMODE_COMPLEMENT;
diff --git a/firmware/id3.c b/firmware/id3.c
index 4087930..a673f2e 100644
--- a/firmware/id3.c
+++ b/firmware/id3.c
@@ -192,7 +192,7 @@
     unsigned char c;
     unsigned char *rp, *wp;
 
-    wp = rp = tag;
+    wp = rp = (unsigned char *)tag;
     
     rp = (unsigned char *)tag;
     for(i = 0;i < len;i++) {
@@ -475,14 +475,14 @@
     if (read(fd, buffer, sizeof buffer) != sizeof buffer)
         return false;
 
-    if (strncmp(buffer, "TAG", 3))
+    if (strncmp((char *)buffer, "TAG", 3))
         return false;
 
     entry->id3v1len = 128;
     entry->id3version = ID3_VER_1_0;
 
     for (i=0; i < (int)sizeof offsets; i++) {
-        char* ptr = buffer + offsets[i];
+        char* ptr = (char *)buffer + offsets[i];
         
         if (i<3) {
             /* kill trailing space in strings */
diff --git a/firmware/panic.c b/firmware/panic.c
index 9226146..07b7a5f 100644
--- a/firmware/panic.c
+++ b/firmware/panic.c
@@ -57,19 +57,19 @@
 
 #ifdef HAVE_LCD_CHARCELLS
     lcd_double_height(false);
-    lcd_puts(0,0,"*PANIC*");
-    lcd_puts(0,1,panic_buf);
+    lcd_puts(0, 0, "*PANIC*");
+    lcd_puts(0, 1, panic_buf);
 #elif defined(HAVE_LCD_BITMAP)
     lcd_clear_display();
     lcd_setfont(FONT_SYSFIXED);
-    lcd_puts(0,0,"*PANIC*");
+    lcd_puts(0, 0, (unsigned char *)"*PANIC*");
     {
         /* wrap panic line */
         int i, y=1, len = strlen(panic_buf);
         for (i=0; i<len; i+=18) {
             unsigned char c = panic_buf[i+18];
             panic_buf[i+18] = 0;
-            lcd_puts(0,y++,panic_buf+i);
+            lcd_puts(0, y++, (unsigned char *)panic_buf+i);
             panic_buf[i+18] = c;
         }
     }