[Pkg-wmaker-commits] [wmcdplay] 50/79: wmcdplay: Fix -Wwrite-string compiler warnings.

Doug Torrance dtorrance-guest at moszumanska.debian.org
Thu Aug 20 11:04:33 UTC 2015


This is an automated email from the git hooks/post-receive script.

dtorrance-guest pushed a commit to branch master
in repository wmcdplay.

commit 434f8e5ccc82596cd5da760162935fac607a77f3
Author: Doug Torrance <dtorrance at monmouthcollege.edu>
Date:   Thu Dec 18 12:30:49 2014 -0600

    wmcdplay: Fix -Wwrite-string compiler warnings.
    
    Previously, compiling wmcdplay caused a large number of warnings of the form
    "deprecated conversion from string constant to ‘char*’".  This was fixed by
    changing "char *" declarations to "const char *", especially in the .xpm files,
    and using "const_cast" as needed when an external library expected a non-const.
---
 ARTWORK                   | 10 +++++-----
 XPM/bluered/cdplayer.xpm  |  2 +-
 XPM/bluered/led.xpm       |  2 +-
 XPM/bluered/ledsym.xpm    |  2 +-
 XPM/bluered/ledtsel.xpm   |  2 +-
 XPM/bluered/symbols.xpm   |  2 +-
 XPM/grey/cdplayer.xpm     |  2 +-
 XPM/grey/led.xpm          |  2 +-
 XPM/grey/ledsym.xpm       |  2 +-
 XPM/grey/ledtsel.xpm      |  2 +-
 XPM/grey/symbols.xpm      |  2 +-
 XPM/newstyle/cdplayer.xpm |  2 +-
 XPM/newstyle/led.xpm      |  2 +-
 XPM/newstyle/ledsym.xpm   |  2 +-
 XPM/newstyle/ledtsel.xpm  |  2 +-
 XPM/newstyle/symbols.xpm  |  2 +-
 XPM/tile.xpm              |  2 +-
 XPM/wmcd/cdplayer.xpm     |  2 +-
 XPM/wmcd/led.xpm          |  2 +-
 XPM/wmcd/ledsym.xpm       |  2 +-
 XPM/wmcd/ledtsel.xpm      |  2 +-
 XPM/wmcd/symbols.xpm      |  2 +-
 wmcdplay.cc               | 32 +++++++++++++++++---------------
 23 files changed, 43 insertions(+), 41 deletions(-)

diff --git a/ARTWORK b/ARTWORK
index ece3395..120a78f 100644
--- a/ARTWORK
+++ b/ARTWORK
@@ -73,7 +73,7 @@ led.xpm
    This file must begin with these 2 lines (character perfect):
 
 /* XPM */
-static char * led_xpm[] = {
+static const char * led_xpm[] = {
 
 ledsym.xpm
 ----------
@@ -86,7 +86,7 @@ ledsym.xpm
    This file must begin with these 2 lines (character perfect):
 
 /* XPM */
-static char * ledsym_xpm[] = {
+static const char * ledsym_xpm[] = {
 
 ledtsel.xpm
 -----------
@@ -100,7 +100,7 @@ ledtsel.xpm
    This file must begin with these 2 lines (character perfect):
 
 /* XPM */
-static char * ledtsel_xpm[] = {
+static const char * ledtsel_xpm[] = {
 
 symbols.xpm
 -----------
@@ -113,7 +113,7 @@ symbols.xpm
    This file must begin with these 2 lines (character perfect):
 
 /* XPM */
-static char * symbols_xpm[] = {
+static const char * symbols_xpm[] = {
    
 cdplayer.xpm
 ------------
@@ -129,7 +129,7 @@ cdplayer.xpm
    This file must begin with these 2 lines (character perfect):
 
 /* XPM */
-static char * cdplayer_xpm[] = {
+static const char * cdplayer_xpm[] = {
 
 
 THE DATA FILE - artwork.dat
diff --git a/XPM/bluered/cdplayer.xpm b/XPM/bluered/cdplayer.xpm
index 54ce780..3d439cf 100644
--- a/XPM/bluered/cdplayer.xpm
+++ b/XPM/bluered/cdplayer.xpm
@@ -1,5 +1,5 @@
 /* XPM */
-static char * cdplayer_xpm[] = {
+static const char * cdplayer_xpm[] = {
 "64 64 64 1",
 " 	c None",
 ".	c #FFFF00000000",
diff --git a/XPM/bluered/led.xpm b/XPM/bluered/led.xpm
index f4b5d53..e80580c 100644
--- a/XPM/bluered/led.xpm
+++ b/XPM/bluered/led.xpm
@@ -1,5 +1,5 @@
 /* XPM */
-static char * led_xpm[] = {
+static const char * led_xpm[] = {
 "171 11 4 1",
 " 	c #000000",
 "0	c #00ff00 s led_color_high",
diff --git a/XPM/bluered/ledsym.xpm b/XPM/bluered/ledsym.xpm
index 01be3df..8814b31 100644
--- a/XPM/bluered/ledsym.xpm
+++ b/XPM/bluered/ledsym.xpm
@@ -1,5 +1,5 @@
 /* XPM */
-static char * ledsym_xpm[] = {
+static const char * ledsym_xpm[] = {
 "35 5 2 1",
 "       c #000000",
 "0      c #00ff00 s led_color_high",
diff --git a/XPM/bluered/ledtsel.xpm b/XPM/bluered/ledtsel.xpm
index 51a7cce..bf1914b 100644
--- a/XPM/bluered/ledtsel.xpm
+++ b/XPM/bluered/ledtsel.xpm
@@ -1,5 +1,5 @@
 /* XPM */
-static char * ledtsel_xpm[]={
+static const char * ledtsel_xpm[]={
 "29 11 2 1",
 "      c #000000",
 "0     c #00ff00 s led_color_high",
diff --git a/XPM/bluered/symbols.xpm b/XPM/bluered/symbols.xpm
index 62a2609..6560f02 100644
--- a/XPM/bluered/symbols.xpm
+++ b/XPM/bluered/symbols.xpm
@@ -1,5 +1,5 @@
 /* XPM */
-static char * symbols_xpm[] = {
+static const char * symbols_xpm[] = {
 "131 11 18 1",
 " 	c None",
 ".	c #DF7DDF7DDF7D",
diff --git a/XPM/grey/cdplayer.xpm b/XPM/grey/cdplayer.xpm
index 5f6e73e..0f0a686 100644
--- a/XPM/grey/cdplayer.xpm
+++ b/XPM/grey/cdplayer.xpm
@@ -1,5 +1,5 @@
 /* XPM */
-static char * cdplayer_xpm[] = {
+static const char * cdplayer_xpm[] = {
 "64 64 5 1",
 " 	c None",
 "0	c #414141",
diff --git a/XPM/grey/led.xpm b/XPM/grey/led.xpm
index f4b5d53..e80580c 100644
--- a/XPM/grey/led.xpm
+++ b/XPM/grey/led.xpm
@@ -1,5 +1,5 @@
 /* XPM */
-static char * led_xpm[] = {
+static const char * led_xpm[] = {
 "171 11 4 1",
 " 	c #000000",
 "0	c #00ff00 s led_color_high",
diff --git a/XPM/grey/ledsym.xpm b/XPM/grey/ledsym.xpm
index 01be3df..8814b31 100644
--- a/XPM/grey/ledsym.xpm
+++ b/XPM/grey/ledsym.xpm
@@ -1,5 +1,5 @@
 /* XPM */
-static char * ledsym_xpm[] = {
+static const char * ledsym_xpm[] = {
 "35 5 2 1",
 "       c #000000",
 "0      c #00ff00 s led_color_high",
diff --git a/XPM/grey/ledtsel.xpm b/XPM/grey/ledtsel.xpm
index 51a7cce..bf1914b 100644
--- a/XPM/grey/ledtsel.xpm
+++ b/XPM/grey/ledtsel.xpm
@@ -1,5 +1,5 @@
 /* XPM */
-static char * ledtsel_xpm[]={
+static const char * ledtsel_xpm[]={
 "29 11 2 1",
 "      c #000000",
 "0     c #00ff00 s led_color_high",
diff --git a/XPM/grey/symbols.xpm b/XPM/grey/symbols.xpm
index b1c6c12..6091a8d 100644
--- a/XPM/grey/symbols.xpm
+++ b/XPM/grey/symbols.xpm
@@ -1,5 +1,5 @@
 /* XPM */
-static char * symbols_xpm[] = {
+static const char * symbols_xpm[] = {
 "65 5 2 1",
 " 	c None",
 "0	c #000000",
diff --git a/XPM/newstyle/cdplayer.xpm b/XPM/newstyle/cdplayer.xpm
index 8261d6d..d6a9cec 100644
--- a/XPM/newstyle/cdplayer.xpm
+++ b/XPM/newstyle/cdplayer.xpm
@@ -1,5 +1,5 @@
 /* XPM */
-static char * cdplayer_xpm[] = {
+static const char * cdplayer_xpm[] = {
 "64 64 8 1",
 " 	c None",
 ".	c #000000",
diff --git a/XPM/newstyle/led.xpm b/XPM/newstyle/led.xpm
index a55568f..3d1d7e1 100644
--- a/XPM/newstyle/led.xpm
+++ b/XPM/newstyle/led.xpm
@@ -1,5 +1,5 @@
 /* XPM */
-static char * led_xpm[] = {
+static const char * led_xpm[] = {
 "128 9 3 1",
 " 	c #282828 s color_back",
 "1	c #006200 s led_color_low",
diff --git a/XPM/newstyle/ledsym.xpm b/XPM/newstyle/ledsym.xpm
index f9469dc..dc30e84 100644
--- a/XPM/newstyle/ledsym.xpm
+++ b/XPM/newstyle/ledsym.xpm
@@ -1,5 +1,5 @@
 /* XPM */
-static char * ledsym_xpm[] = {
+static const char * ledsym_xpm[] = {
 "59 9 3 1",
 " 	c #282828 s color_back",
 "0      c #00ff00 s led_color_high",
diff --git a/XPM/newstyle/ledtsel.xpm b/XPM/newstyle/ledtsel.xpm
index fbfafaf..3755b8e 100644
--- a/XPM/newstyle/ledtsel.xpm
+++ b/XPM/newstyle/ledtsel.xpm
@@ -1,5 +1,5 @@
 /* XPM */
-static char * ledtsel_xpm[] = {
+static const char * ledtsel_xpm[] = {
 "69 7 2 1",
 " 	c #282828 s color_back",
 "0	c #00ff00 s led_color_high",
diff --git a/XPM/newstyle/symbols.xpm b/XPM/newstyle/symbols.xpm
index 3e716c7..524a669 100644
--- a/XPM/newstyle/symbols.xpm
+++ b/XPM/newstyle/symbols.xpm
@@ -1,5 +1,5 @@
 /* XPM */
-static char * symbols_xpm[] = {
+static const char * symbols_xpm[] = {
 "65 5 2 1",
 " 	c None",
 "0	c #000000",
diff --git a/XPM/tile.xpm b/XPM/tile.xpm
index e65c234..a0d6fdb 100644
--- a/XPM/tile.xpm
+++ b/XPM/tile.xpm
@@ -1,5 +1,5 @@
 /* XPM */
-static char *tile_xpm[] = {
+static const char *tile_xpm[] = {
 "64 64 54 1",
 " 	c #F3CEF3CEF3CE",
 ".	c #000000000000",
diff --git a/XPM/wmcd/cdplayer.xpm b/XPM/wmcd/cdplayer.xpm
index 8796f2f..ed23b5c 100644
--- a/XPM/wmcd/cdplayer.xpm
+++ b/XPM/wmcd/cdplayer.xpm
@@ -1,5 +1,5 @@
 /* XPM */
-static char * cdplayer_xpm[] = {
+static const char * cdplayer_xpm[] = {
 "64 64 6 1",
 " 	c None",
 ".	c #410341034103",
diff --git a/XPM/wmcd/led.xpm b/XPM/wmcd/led.xpm
index f4b5d53..e80580c 100644
--- a/XPM/wmcd/led.xpm
+++ b/XPM/wmcd/led.xpm
@@ -1,5 +1,5 @@
 /* XPM */
-static char * led_xpm[] = {
+static const char * led_xpm[] = {
 "171 11 4 1",
 " 	c #000000",
 "0	c #00ff00 s led_color_high",
diff --git a/XPM/wmcd/ledsym.xpm b/XPM/wmcd/ledsym.xpm
index 01be3df..8814b31 100644
--- a/XPM/wmcd/ledsym.xpm
+++ b/XPM/wmcd/ledsym.xpm
@@ -1,5 +1,5 @@
 /* XPM */
-static char * ledsym_xpm[] = {
+static const char * ledsym_xpm[] = {
 "35 5 2 1",
 "       c #000000",
 "0      c #00ff00 s led_color_high",
diff --git a/XPM/wmcd/ledtsel.xpm b/XPM/wmcd/ledtsel.xpm
index 51a7cce..bf1914b 100644
--- a/XPM/wmcd/ledtsel.xpm
+++ b/XPM/wmcd/ledtsel.xpm
@@ -1,5 +1,5 @@
 /* XPM */
-static char * ledtsel_xpm[]={
+static const char * ledtsel_xpm[]={
 "29 11 2 1",
 "      c #000000",
 "0     c #00ff00 s led_color_high",
diff --git a/XPM/wmcd/symbols.xpm b/XPM/wmcd/symbols.xpm
index 6c759ad..8b19f2a 100644
--- a/XPM/wmcd/symbols.xpm
+++ b/XPM/wmcd/symbols.xpm
@@ -1,5 +1,5 @@
 /* XPM */
-static char * symbols_xpm[] = {
+static const char * symbols_xpm[] = {
 "87 7 26 1",
 " 	c None",
 ".	c #CF3CCF3CCF3C",
diff --git a/wmcdplay.cc b/wmcdplay.cc
index 78c544b..0108b89 100644
--- a/wmcdplay.cc
+++ b/wmcdplay.cc
@@ -146,7 +146,7 @@ void readArrayInt(char *buf, int *array, int n);
 void readArrayBool(char *buf, bool *array, int n);
 
 // Procedures and functions - artwork specials
-void createPixmap(char **data, char *buf, Pixmap *image, Pixmap *mask, int *width, int *height);
+void createPixmap(const char **data, char *buf, Pixmap *image, Pixmap *mask, int *width, int *height);
 void setBtnList(int *bset);
 bool inPolygon(int *points, int px, int py);
 
@@ -320,8 +320,8 @@ void freeXWin(){
 void createWin(Window *win, int x, int y){
    XClassHint classHint;
    *win=XCreateSimpleWindow(d_display, w_root, x, y, winsize, winsize, 0, 0, 0);
-   classHint.res_name=NAME;
-   classHint.res_class=CLASS;
+   classHint.res_name=const_cast<char *>(NAME);
+   classHint.res_class=const_cast<char *>(CLASS);
    XSetClassHint(d_display, *win, &classHint);
 }
 
@@ -649,7 +649,7 @@ bool readArtwork(char *artfilen){
       if(!done){
 
          int keynum=0;
-         char *keystr[]={ "int art_nbtns=",
+         const char *keystr[]={ "int art_nbtns=",
                           "bool art_hidebtns=",
                           "bool art_showled[4]=",
                           "int art_ledpos[4][2]=",
@@ -697,24 +697,24 @@ bool readArtwork(char *artfilen){
                *strchr(buf, '\n')='\0';
 
                int w,h;
-               if(strncmp(buf, "static char * cdplayer_xpm", strlen("static char * cdplayer_xpm"))==0)
+               if(strncmp(buf, "static const char * cdplayer_xpm", strlen("static const char * cdplayer_xpm"))==0)
                   createPixmap(NULL, block, &pm_cd, &pm_cdmask, NULL, NULL);
-               if(strncmp(buf, "static char * symbols_xpm", strlen("static char * symbols_xpm"))==0){
+               if(strncmp(buf, "static const char * symbols_xpm", strlen("static const char * symbols_xpm"))==0){
                   createPixmap(NULL, block, &pm_sym, &pm_symmask, &w, &h);
                   art_symsize[0]=(w+1)/11-1;
                   art_symsize[1]=h;
                }
-               if(strncmp(buf, "static char * led_xpm", strlen("static char * led_xpm"))==0){
+               if(strncmp(buf, "static const char * led_xpm", strlen("static const char * led_xpm"))==0){
                   createPixmap(NULL, block, &pm_led, NULL, &w, &h);
                   art_ledsize[0]=(w+1)/strlen(chrset)-1;
                   art_ledsize[1]=h;
                }
-               if(strncmp(buf, "static char * ledsym_xpm", strlen("static char * ledsym_xpm"))==0){
+               if(strncmp(buf, "static const char * ledsym_xpm", strlen("static const char * ledsym_xpm"))==0){
                   createPixmap(NULL, block, &pm_sled, NULL, &w, &h);
                   art_ledsize[2]=(w+1)/6-1;
                   art_ledsize[3]=h;
                }
-               if(strncmp(buf, "static char * ledtsel_xpm", strlen("static char * ledtsel_xpm"))==0){
+               if(strncmp(buf, "static const char * ledtsel_xpm", strlen("static const char * ledtsel_xpm"))==0){
                   createPixmap(NULL, block, &pm_tled, NULL, &w, &h);
                   art_ledsize[4]=(w+1)/5-1;
                   art_ledsize[5]=h;
@@ -771,19 +771,21 @@ void readArrayBool(char *buf, bool *array, int n){
    }
 }
 
-void createPixmap(char **data, char *buf, Pixmap *image, Pixmap *mask, int *width, int *height){
+void createPixmap(const char **data, char *buf, Pixmap *image, Pixmap *mask, int *width, int *height){
    XpmAttributes xpmattr;
-   XpmColorSymbol xpmcsym[4]={{"back_color",     NULL, color[0]},
-                              {"led_color_high", NULL, color[1]},
-                              {"led_color_med",  NULL, color[2]},
-                              {"led_color_low",  NULL, color[3]}};
+   XpmColorSymbol xpmcsym[4]={
+      {const_cast<char *>("back_color"),     NULL, color[0]},
+      {const_cast<char *>("led_color_high"), NULL, color[1]},
+      {const_cast<char *>("led_color_med"),  NULL, color[2]},
+      {const_cast<char *>("led_color_low"),  NULL, color[3]}};
    xpmattr.numsymbols=4;
    xpmattr.colorsymbols=xpmcsym;
    xpmattr.exactColors=false;
    xpmattr.closeness=40000;
    xpmattr.valuemask=XpmColorSymbols | XpmExactColors | XpmCloseness | XpmSize;
    if(data!=NULL)
-      XpmCreatePixmapFromData(d_display, w_root, data, image, mask, &xpmattr);
+      XpmCreatePixmapFromData(d_display, w_root, const_cast<char **>(data),
+                              image, mask, &xpmattr);
    else
       XpmCreatePixmapFromBuffer(d_display, w_root, buf, image, mask, &xpmattr);
    if(width!=NULL)

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-wmaker/wmcdplay.git



More information about the Pkg-wmaker-commits mailing list