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.
This commit is contained in:
parent
1b1afe2d37
commit
7959aa4cda
|
@ -73,7 +73,7 @@ led.xpm
|
||||||
This file must begin with these 2 lines (character perfect):
|
This file must begin with these 2 lines (character perfect):
|
||||||
|
|
||||||
/* XPM */
|
/* XPM */
|
||||||
static char * led_xpm[] = {
|
static const char * led_xpm[] = {
|
||||||
|
|
||||||
ledsym.xpm
|
ledsym.xpm
|
||||||
----------
|
----------
|
||||||
|
@ -86,7 +86,7 @@ ledsym.xpm
|
||||||
This file must begin with these 2 lines (character perfect):
|
This file must begin with these 2 lines (character perfect):
|
||||||
|
|
||||||
/* XPM */
|
/* XPM */
|
||||||
static char * ledsym_xpm[] = {
|
static const char * ledsym_xpm[] = {
|
||||||
|
|
||||||
ledtsel.xpm
|
ledtsel.xpm
|
||||||
-----------
|
-----------
|
||||||
|
@ -100,7 +100,7 @@ ledtsel.xpm
|
||||||
This file must begin with these 2 lines (character perfect):
|
This file must begin with these 2 lines (character perfect):
|
||||||
|
|
||||||
/* XPM */
|
/* XPM */
|
||||||
static char * ledtsel_xpm[] = {
|
static const char * ledtsel_xpm[] = {
|
||||||
|
|
||||||
symbols.xpm
|
symbols.xpm
|
||||||
-----------
|
-----------
|
||||||
|
@ -113,7 +113,7 @@ symbols.xpm
|
||||||
This file must begin with these 2 lines (character perfect):
|
This file must begin with these 2 lines (character perfect):
|
||||||
|
|
||||||
/* XPM */
|
/* XPM */
|
||||||
static char * symbols_xpm[] = {
|
static const char * symbols_xpm[] = {
|
||||||
|
|
||||||
cdplayer.xpm
|
cdplayer.xpm
|
||||||
------------
|
------------
|
||||||
|
@ -129,7 +129,7 @@ cdplayer.xpm
|
||||||
This file must begin with these 2 lines (character perfect):
|
This file must begin with these 2 lines (character perfect):
|
||||||
|
|
||||||
/* XPM */
|
/* XPM */
|
||||||
static char * cdplayer_xpm[] = {
|
static const char * cdplayer_xpm[] = {
|
||||||
|
|
||||||
|
|
||||||
THE DATA FILE - artwork.dat
|
THE DATA FILE - artwork.dat
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/* XPM */
|
/* XPM */
|
||||||
static char * cdplayer_xpm[] = {
|
static const char * cdplayer_xpm[] = {
|
||||||
"64 64 64 1",
|
"64 64 64 1",
|
||||||
" c None",
|
" c None",
|
||||||
". c #FFFF00000000",
|
". c #FFFF00000000",
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/* XPM */
|
/* XPM */
|
||||||
static char * led_xpm[] = {
|
static const char * led_xpm[] = {
|
||||||
"171 11 4 1",
|
"171 11 4 1",
|
||||||
" c #000000",
|
" c #000000",
|
||||||
"0 c #00ff00 s led_color_high",
|
"0 c #00ff00 s led_color_high",
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/* XPM */
|
/* XPM */
|
||||||
static char * ledsym_xpm[] = {
|
static const char * ledsym_xpm[] = {
|
||||||
"35 5 2 1",
|
"35 5 2 1",
|
||||||
" c #000000",
|
" c #000000",
|
||||||
"0 c #00ff00 s led_color_high",
|
"0 c #00ff00 s led_color_high",
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/* XPM */
|
/* XPM */
|
||||||
static char * ledtsel_xpm[]={
|
static const char * ledtsel_xpm[]={
|
||||||
"29 11 2 1",
|
"29 11 2 1",
|
||||||
" c #000000",
|
" c #000000",
|
||||||
"0 c #00ff00 s led_color_high",
|
"0 c #00ff00 s led_color_high",
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/* XPM */
|
/* XPM */
|
||||||
static char * symbols_xpm[] = {
|
static const char * symbols_xpm[] = {
|
||||||
"131 11 18 1",
|
"131 11 18 1",
|
||||||
" c None",
|
" c None",
|
||||||
". c #DF7DDF7DDF7D",
|
". c #DF7DDF7DDF7D",
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/* XPM */
|
/* XPM */
|
||||||
static char * cdplayer_xpm[] = {
|
static const char * cdplayer_xpm[] = {
|
||||||
"64 64 5 1",
|
"64 64 5 1",
|
||||||
" c None",
|
" c None",
|
||||||
"0 c #414141",
|
"0 c #414141",
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/* XPM */
|
/* XPM */
|
||||||
static char * led_xpm[] = {
|
static const char * led_xpm[] = {
|
||||||
"171 11 4 1",
|
"171 11 4 1",
|
||||||
" c #000000",
|
" c #000000",
|
||||||
"0 c #00ff00 s led_color_high",
|
"0 c #00ff00 s led_color_high",
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/* XPM */
|
/* XPM */
|
||||||
static char * ledsym_xpm[] = {
|
static const char * ledsym_xpm[] = {
|
||||||
"35 5 2 1",
|
"35 5 2 1",
|
||||||
" c #000000",
|
" c #000000",
|
||||||
"0 c #00ff00 s led_color_high",
|
"0 c #00ff00 s led_color_high",
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/* XPM */
|
/* XPM */
|
||||||
static char * ledtsel_xpm[]={
|
static const char * ledtsel_xpm[]={
|
||||||
"29 11 2 1",
|
"29 11 2 1",
|
||||||
" c #000000",
|
" c #000000",
|
||||||
"0 c #00ff00 s led_color_high",
|
"0 c #00ff00 s led_color_high",
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/* XPM */
|
/* XPM */
|
||||||
static char * symbols_xpm[] = {
|
static const char * symbols_xpm[] = {
|
||||||
"65 5 2 1",
|
"65 5 2 1",
|
||||||
" c None",
|
" c None",
|
||||||
"0 c #000000",
|
"0 c #000000",
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/* XPM */
|
/* XPM */
|
||||||
static char * cdplayer_xpm[] = {
|
static const char * cdplayer_xpm[] = {
|
||||||
"64 64 8 1",
|
"64 64 8 1",
|
||||||
" c None",
|
" c None",
|
||||||
". c #000000",
|
". c #000000",
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/* XPM */
|
/* XPM */
|
||||||
static char * led_xpm[] = {
|
static const char * led_xpm[] = {
|
||||||
"128 9 3 1",
|
"128 9 3 1",
|
||||||
" c #282828 s color_back",
|
" c #282828 s color_back",
|
||||||
"1 c #006200 s led_color_low",
|
"1 c #006200 s led_color_low",
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/* XPM */
|
/* XPM */
|
||||||
static char * ledsym_xpm[] = {
|
static const char * ledsym_xpm[] = {
|
||||||
"59 9 3 1",
|
"59 9 3 1",
|
||||||
" c #282828 s color_back",
|
" c #282828 s color_back",
|
||||||
"0 c #00ff00 s led_color_high",
|
"0 c #00ff00 s led_color_high",
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/* XPM */
|
/* XPM */
|
||||||
static char * ledtsel_xpm[] = {
|
static const char * ledtsel_xpm[] = {
|
||||||
"69 7 2 1",
|
"69 7 2 1",
|
||||||
" c #282828 s color_back",
|
" c #282828 s color_back",
|
||||||
"0 c #00ff00 s led_color_high",
|
"0 c #00ff00 s led_color_high",
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/* XPM */
|
/* XPM */
|
||||||
static char * symbols_xpm[] = {
|
static const char * symbols_xpm[] = {
|
||||||
"65 5 2 1",
|
"65 5 2 1",
|
||||||
" c None",
|
" c None",
|
||||||
"0 c #000000",
|
"0 c #000000",
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/* XPM */
|
/* XPM */
|
||||||
static char *tile_xpm[] = {
|
static const char *tile_xpm[] = {
|
||||||
"64 64 54 1",
|
"64 64 54 1",
|
||||||
" c #F3CEF3CEF3CE",
|
" c #F3CEF3CEF3CE",
|
||||||
". c #000000000000",
|
". c #000000000000",
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/* XPM */
|
/* XPM */
|
||||||
static char * cdplayer_xpm[] = {
|
static const char * cdplayer_xpm[] = {
|
||||||
"64 64 6 1",
|
"64 64 6 1",
|
||||||
" c None",
|
" c None",
|
||||||
". c #410341034103",
|
". c #410341034103",
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/* XPM */
|
/* XPM */
|
||||||
static char * led_xpm[] = {
|
static const char * led_xpm[] = {
|
||||||
"171 11 4 1",
|
"171 11 4 1",
|
||||||
" c #000000",
|
" c #000000",
|
||||||
"0 c #00ff00 s led_color_high",
|
"0 c #00ff00 s led_color_high",
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/* XPM */
|
/* XPM */
|
||||||
static char * ledsym_xpm[] = {
|
static const char * ledsym_xpm[] = {
|
||||||
"35 5 2 1",
|
"35 5 2 1",
|
||||||
" c #000000",
|
" c #000000",
|
||||||
"0 c #00ff00 s led_color_high",
|
"0 c #00ff00 s led_color_high",
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/* XPM */
|
/* XPM */
|
||||||
static char * ledtsel_xpm[]={
|
static const char * ledtsel_xpm[]={
|
||||||
"29 11 2 1",
|
"29 11 2 1",
|
||||||
" c #000000",
|
" c #000000",
|
||||||
"0 c #00ff00 s led_color_high",
|
"0 c #00ff00 s led_color_high",
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/* XPM */
|
/* XPM */
|
||||||
static char * symbols_xpm[] = {
|
static const char * symbols_xpm[] = {
|
||||||
"87 7 26 1",
|
"87 7 26 1",
|
||||||
" c None",
|
" c None",
|
||||||
". c #CF3CCF3CCF3C",
|
". c #CF3CCF3CCF3C",
|
||||||
|
|
|
@ -146,7 +146,7 @@ void readArrayInt(char *buf, int *array, int n);
|
||||||
void readArrayBool(char *buf, bool *array, int n);
|
void readArrayBool(char *buf, bool *array, int n);
|
||||||
|
|
||||||
// Procedures and functions - artwork specials
|
// 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);
|
void setBtnList(int *bset);
|
||||||
bool inPolygon(int *points, int px, int py);
|
bool inPolygon(int *points, int px, int py);
|
||||||
|
|
||||||
|
@ -320,8 +320,8 @@ void freeXWin(){
|
||||||
void createWin(Window *win, int x, int y){
|
void createWin(Window *win, int x, int y){
|
||||||
XClassHint classHint;
|
XClassHint classHint;
|
||||||
*win=XCreateSimpleWindow(d_display, w_root, x, y, winsize, winsize, 0, 0, 0);
|
*win=XCreateSimpleWindow(d_display, w_root, x, y, winsize, winsize, 0, 0, 0);
|
||||||
classHint.res_name=NAME;
|
classHint.res_name=const_cast<char *>(NAME);
|
||||||
classHint.res_class=CLASS;
|
classHint.res_class=const_cast<char *>(CLASS);
|
||||||
XSetClassHint(d_display, *win, &classHint);
|
XSetClassHint(d_display, *win, &classHint);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -649,7 +649,7 @@ bool readArtwork(char *artfilen){
|
||||||
if(!done){
|
if(!done){
|
||||||
|
|
||||||
int keynum=0;
|
int keynum=0;
|
||||||
char *keystr[]={ "int art_nbtns=",
|
const char *keystr[]={ "int art_nbtns=",
|
||||||
"bool art_hidebtns=",
|
"bool art_hidebtns=",
|
||||||
"bool art_showled[4]=",
|
"bool art_showled[4]=",
|
||||||
"int art_ledpos[4][2]=",
|
"int art_ledpos[4][2]=",
|
||||||
|
@ -697,24 +697,24 @@ bool readArtwork(char *artfilen){
|
||||||
*strchr(buf, '\n')='\0';
|
*strchr(buf, '\n')='\0';
|
||||||
|
|
||||||
int w,h;
|
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);
|
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);
|
createPixmap(NULL, block, &pm_sym, &pm_symmask, &w, &h);
|
||||||
art_symsize[0]=(w+1)/11-1;
|
art_symsize[0]=(w+1)/11-1;
|
||||||
art_symsize[1]=h;
|
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);
|
createPixmap(NULL, block, &pm_led, NULL, &w, &h);
|
||||||
art_ledsize[0]=(w+1)/strlen(chrset)-1;
|
art_ledsize[0]=(w+1)/strlen(chrset)-1;
|
||||||
art_ledsize[1]=h;
|
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);
|
createPixmap(NULL, block, &pm_sled, NULL, &w, &h);
|
||||||
art_ledsize[2]=(w+1)/6-1;
|
art_ledsize[2]=(w+1)/6-1;
|
||||||
art_ledsize[3]=h;
|
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);
|
createPixmap(NULL, block, &pm_tled, NULL, &w, &h);
|
||||||
art_ledsize[4]=(w+1)/5-1;
|
art_ledsize[4]=(w+1)/5-1;
|
||||||
art_ledsize[5]=h;
|
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;
|
XpmAttributes xpmattr;
|
||||||
XpmColorSymbol xpmcsym[4]={{"back_color", NULL, color[0]},
|
XpmColorSymbol xpmcsym[4]={
|
||||||
{"led_color_high", NULL, color[1]},
|
{const_cast<char *>("back_color"), NULL, color[0]},
|
||||||
{"led_color_med", NULL, color[2]},
|
{const_cast<char *>("led_color_high"), NULL, color[1]},
|
||||||
{"led_color_low", NULL, color[3]}};
|
{const_cast<char *>("led_color_med"), NULL, color[2]},
|
||||||
|
{const_cast<char *>("led_color_low"), NULL, color[3]}};
|
||||||
xpmattr.numsymbols=4;
|
xpmattr.numsymbols=4;
|
||||||
xpmattr.colorsymbols=xpmcsym;
|
xpmattr.colorsymbols=xpmcsym;
|
||||||
xpmattr.exactColors=false;
|
xpmattr.exactColors=false;
|
||||||
xpmattr.closeness=40000;
|
xpmattr.closeness=40000;
|
||||||
xpmattr.valuemask=XpmColorSymbols | XpmExactColors | XpmCloseness | XpmSize;
|
xpmattr.valuemask=XpmColorSymbols | XpmExactColors | XpmCloseness | XpmSize;
|
||||||
if(data!=NULL)
|
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
|
else
|
||||||
XpmCreatePixmapFromBuffer(d_display, w_root, buf, image, mask, &xpmattr);
|
XpmCreatePixmapFromBuffer(d_display, w_root, buf, image, mask, &xpmattr);
|
||||||
if(width!=NULL)
|
if(width!=NULL)
|
||||||
|
|
Loading…
Reference in a new issue