Skip to content

Commit

Permalink
Fix gettext write to read only string; fix warnings.
Browse files Browse the repository at this point in the history
	* modules/FvwmConsole/getline.c (get_line): Fix warnings.
	* fvwm/session.c (set_sm_properties, SessionInit): Fix warnings.
	* fvwm/frame.c (frame_prepare_animation_shape)
	(frame_setup_shape): Fix warnings.
	* fvwm/icons.c (CreateIconWindow): Fix warnings.
	* fvwm/add_window.c (setup_style_and_decor): Fix warnings.
	* fvwm/events.c (_handle_cr_on_shaped): Fix warnings.
	* fvwm/menus.c (size_menu_vertically): Fix write access to read-only
	location with gettext.

libs:
	* fsm.c (SaveYourselfPhase2ReqProc, SaveYourselfDoneProc)
	(NewConnectionMsg): Fix warnings.
	* FGettext.c (FGettextInit): Fix warnings.
	* FImage.c (FGetFImage): Fix warnings.
	* Fft.c (FftGetFont): Fix warnings.
	* Ficonv.c (is_translit_supported, convert_charsets): Fix warnings.
	* FRender.c (FRenderCreateShadePicture, FRenderVisualInit)
	(FRenderTintRectangle, FRenderTintPicture, FRenderRender): Fix
	warnings.
	* FScreen.c (FScreenInit): Fix warnings.
  • Loading branch information
domivogt committed Oct 22, 2016
1 parent 6afa5b3 commit 5b32505
Show file tree
Hide file tree
Showing 14 changed files with 48 additions and 18 deletions.
6 changes: 3 additions & 3 deletions fvwm/add_window.c
Expand Up @@ -1941,9 +1941,9 @@ void setup_style_and_decor(
int boundingShaped;

/* suppress compiler warnings w/o shape extension */
i = 0;
u = 0;
b = False;
(void)i;
(void)u;
(void)b;

FShapeSelectInput(dpy, FW_W(fw), FShapeNotifyMask);
if (FShapeQueryExtents(
Expand Down
9 changes: 6 additions & 3 deletions fvwm/events.c
Expand Up @@ -493,11 +493,14 @@ static inline void _handle_cr_on_icon(XEvent *e, FvwmWindow *fw)
static inline void _handle_cr_on_shaped(FvwmWindow *fw)
{
/* suppress compiler warnings w/o shape extension */
int i = 0;
unsigned int u = 0;
Bool b = False;
int i;
unsigned int u;
Bool b;
int boundingShaped;

(void)i;
(void)u;
(void)b;
if (FShapeQueryExtents(
dpy, FW_W(fw), &boundingShaped, &i, &i, &u, &u, &b,
&i, &i, &u, &u))
Expand Down
2 changes: 2 additions & 0 deletions fvwm/frame.c
Expand Up @@ -749,6 +749,7 @@ static void frame_prepare_animation_shape(
rectangle tb_g;
XRectangle rect;

(void)rect;
frame_get_titlebar_dimensions_only(
fw, &mra->next_g, &mra->b_no_title_g, &tb_g);
/* windows w/ titles */
Expand Down Expand Up @@ -2105,6 +2106,7 @@ void frame_setup_shape(FvwmWindow *fw, int w, int h, int shape_mode)
{
return;
}
(void)rect;
if (fw->wShaped != shape_mode)
{
fw->wShaped = shape_mode;
Expand Down
4 changes: 3 additions & 1 deletion fvwm/icons.c
Expand Up @@ -754,8 +754,9 @@ void CreateIconWindow(FvwmWindow *fw, int def_x, int def_y)
/* when fvwm is using the non-default visual client
* supplied icon pixmaps are drawn in a window with no
* relief */
int off = 0;
int off ;

(void)off;
if (Pdefault || fw->iconDepth == 1 ||
fw->iconDepth == Pdepth || IS_PIXMAP_OURS(fw))
{
Expand All @@ -772,6 +773,7 @@ void CreateIconWindow(FvwmWindow *fw, int def_x, int def_y)
/* remove the shape */
XRectangle r;

(void)r;
r.x = 0;
r.y = 0;
r.width = fw->icon_g.picture_w_g.width;
Expand Down
7 changes: 6 additions & 1 deletion fvwm/menus.c
Expand Up @@ -1726,6 +1726,8 @@ static Bool size_menu_vertically(MenuSizingParameters *msp)
/* Item does not fit on screen anymore. */
char *t;
char *tempname;
const char *gt_name;
char *name;
MenuRoot *menuContinuation;
int more_item_height;

Expand Down Expand Up @@ -1802,9 +1804,12 @@ static Bool size_menu_vertically(MenuSizingParameters *msp)
/* don't propagate sidepic, sidecolor, popup and
* popdown actions */
/* And add the entry pointing to the new menu */
gt_name = gettext("More&...");
name = safestrdup(gt_name);
AddToMenu(
msp->menu, gettext("More&..."), tempname,
msp->menu, name, tempname,
False /* no pixmap scan */, False, True);
free(name);
free(tempname);
has_continuation_menu = True;
}
Expand Down
2 changes: 2 additions & 0 deletions fvwm/session.c
Expand Up @@ -765,6 +765,7 @@ set_sm_properties(FSmcConn sm_conn, char *filename, char hint)
{
return;
}
(void)props;

#ifdef FVWM_SM_DEBUG_PROTO
fprintf(stderr, "[FVWM_SMDEBUG][set_sm_properties] state filename: %s%s\n",
Expand Down Expand Up @@ -1708,6 +1709,7 @@ SessionInit(void)
callback_save_yourself2(NULL, NULL);
return;
}
(void)context;

context = NULL;
InstallIOErrorHandler();
Expand Down
3 changes: 2 additions & 1 deletion libs/FGettext.c
Expand Up @@ -126,7 +126,8 @@ static void fgettext_free_fgpath_list(void)

void FGettextInit(const char *domain, const char *dir, const char *module)
{
char *btd, *td;
const char *btd;
const char *td;

if (!HaveNLSSupport)
{
Expand Down
2 changes: 1 addition & 1 deletion libs/FImage.c
Expand Up @@ -213,7 +213,7 @@ FImage *FGetFImage(
dpy, fim, visual, depth, format, width, height);
if (fim->im)
{
FShmGetImage(
(void)FShmGetImage(
dpy, d, fim->im, x, y, plane_mask);
}
}
Expand Down
11 changes: 9 additions & 2 deletions libs/FRender.c
Expand Up @@ -67,6 +67,7 @@ void FRenderVisualInit(Display *dpy)
{
return;
}
(void)pf;

PFrenderVisualFormat = FRenderFindVisualFormat (dpy, Pvisual);
if (!PFrenderVisualFormat)
Expand Down Expand Up @@ -181,6 +182,7 @@ Bool FRenderCreateShadePicture(
{
FRenderPictureAttributes pa;

(void)pa;
if (!shade_pixmap)
{
shade_pixmap = XCreatePixmap(dpy, win, 1, 1, 8);
Expand Down Expand Up @@ -219,7 +221,6 @@ Bool FRenderTintPicture(
static Pixmap tint_pixmap = None;
static FRenderPicture tint_picture = None;
FRenderPicture shade_picture = None;
FRenderColor frc_tint;
Bool force_update = False;
FRenderPictureAttributes pa;
int rv = 0;
Expand All @@ -228,6 +229,7 @@ Bool FRenderTintPicture(
{
return 0;
}
(void)pa;

if (!tint_pixmap || !tint_picture)
{
Expand Down Expand Up @@ -259,7 +261,9 @@ Bool FRenderTintPicture(
{
XColor color;
float alpha_factor = (float)tint_percent/100;
FRenderColor frc_tint;

(void)frc_tint;
force_update = False;
color.pixel = tint;
XQueryColor(dpy, Pcmap, &color);
Expand Down Expand Up @@ -298,11 +302,12 @@ Bool FRenderTintRectangle(
unsigned int val = 0;
Bool rv = True;


if (!XRenderSupport || !FRenderGetExtensionSupported())
{
return 0;
}
(void)val;
(void)pa;

if (!FRenderVisualInitialized)
{
Expand Down Expand Up @@ -361,6 +366,8 @@ int FRenderRender(
{
return 0;
}
(void)pa;
(void)pam;

if (!FRenderVisualInitialized)
{
Expand Down
2 changes: 1 addition & 1 deletion libs/FScreen.c
Expand Up @@ -348,11 +348,11 @@ void FScreenInit(Display *dpy)
static Bool is_initialised = False;
int dummy_rc;

(void)dummy_rc;
if (is_initialised)
{
return;
}
dummy_rc = 0;
is_initialised = True;
disp = dpy;
if (FScreenXineramaEmulation)
Expand Down
4 changes: 3 additions & 1 deletion libs/Fft.c
Expand Up @@ -277,7 +277,7 @@ FftFontType *FftGetFont(Display *dpy, char *fontname, char *module)
FlocaleCharset *fc;
FftPattern *src_pat = NULL, *load_pat = NULL;
FftMatrix *a = NULL;
FftResult result = 0;
FftResult result;

if (!FftSupport || !(FRenderGetExtensionSupported() || 1))
{
Expand All @@ -287,6 +287,8 @@ FftFontType *FftGetFont(Display *dpy, char *fontname, char *module)
{
return NULL;
}
(void)result;
(void)fn;
if (!fft_initialized)
{
init_fft(dpy);
Expand Down
9 changes: 6 additions & 3 deletions libs/Ficonv.c
Expand Up @@ -104,13 +104,13 @@ int is_translit_supported(char *c1, char *c2)
{
return 0;
}
Ficonv_close(cd);
(void)Ficonv_close(cd);
cd = Ficonv_open(translit_csname(c2),c1);
if (cd == (Ficonv_t) -1)
{
return 0;
}
Ficonv_close(cd);
(void)Ficonv_close(cd);

return 1;
}
Expand Down Expand Up @@ -219,8 +219,11 @@ char *convert_charsets(const char *in_charset, const char *out_charset,
char *dest;
char *outp;

if (in == NULL || !FiconvSupport)
if (!FiconvSupport || in == NULL)
return NULL;
(void)inptr;
(void)insize;
(void)outbytes_remaining;

cd = Ficonv_open(out_charset, in_charset);
if (cd == (Ficonv_t) -1)
Expand Down
4 changes: 3 additions & 1 deletion libs/fsm.c
Expand Up @@ -522,6 +522,7 @@ void SaveYourselfPhase2ReqProc(FSmsConn smsConn, FSmPointer managerData)
return;
}
client = (fsm_client_t *)managerData;
(void)client;
FSmsSaveYourselfPhase2(client->smsConn);
}

Expand All @@ -535,6 +536,7 @@ SaveYourselfDoneProc(FSmsConn smsConn, FSmPointer managerData, Bool success)
return;
}
client = (fsm_client_t *) managerData;
(void)client;
FSmsSaveComplete(client->smsConn);
}

Expand Down Expand Up @@ -776,9 +778,9 @@ void NewConnectionMsg(int i)

if (!SessionSupport)
{
status = 0;
return;
}
(void)status;

ice_conn = FIceAcceptConnection(listenObjs[i], &status);
#ifdef FVWM_DEBUG_FSM
Expand Down
1 change: 1 addition & 0 deletions modules/FvwmConsole/getline.c
Expand Up @@ -71,6 +71,7 @@ char *get_line(void)

return cmd;
}
(void)prompt;
/* If initialization hasn't been done, do it now:
* - We don't want TAB completion
*/
Expand Down

0 comments on commit 5b32505

Please sign in to comment.