1
0
mirror of https://github.com/gryf/wmaker.git synced 2025-12-19 20:38:08 +01:00

Fix uninitialized vars

Initialized variables that are conditionally set. In particular, this
construct is dangerous:
  void *p;
  if (something) p = couldReturnNull();
  if (!p) p = fallbackFunction();
This commit is contained in:
Brad Jorsch
2010-04-08 14:43:52 -04:00
committed by Carlos R. Mafra
parent bbf3635590
commit 12de2f319e
6 changed files with 13 additions and 7 deletions

View File

@@ -544,7 +544,7 @@ static Pixmap renderTexture(WMScreen * scr, WMPropList * texture, int width, int
int style;
RColor rcolor2;
int i;
RImage *grad, *timage;
RImage *grad, *timage = NULL;
char *path;
switch (toupper(type[1])) {

View File

@@ -22,6 +22,7 @@
#include "WPrefs.h"
#include <unistd.h>
#include <assert.h>
typedef struct _Panel {
WMBox *box;
@@ -131,6 +132,8 @@ static void browseForFile(WMWidget * w, void *data)
_Panel *panel = (_Panel *) data;
WMFilePanel *filePanel;
assert(w == panel->icoaB || w == panel->pixaB);
filePanel = WMGetOpenPanel(WMWidgetScreen(w));
WMSetFilePanelCanChooseFiles(filePanel, False);
@@ -147,7 +150,7 @@ static void browseForFile(WMWidget * w, void *data)
len--;
}
if (len > 0) {
WMList *lPtr;
WMList *lPtr = NULL;
int i;
if (w == panel->icoaB)

View File

@@ -404,7 +404,7 @@ char *ShrinkString(WMFont * font, char *string, int width)
char *FindImage(char *paths, char *file)
{
char *tmp, *path;
char *tmp, *path = NULL;
tmp = strrchr(file, ':');
if (tmp) {

View File

@@ -148,6 +148,7 @@ static int getMWMHints(Window window, MWMHints *mwmhints)
if (!data)
return 0;
mwmhints->flags = 0;
if (count >= 4) {
mwmhints->flags = data[0];
mwmhints->functions = data[1];

View File

@@ -181,7 +181,7 @@ static Bool isFontOption(char *option)
/* XXX: is almost like WINGs/wcolodpanel.c:fetchFile() */
void copyFile(char *dir, char *file)
{
FILE *src, *dst;
FILE *src = NULL, *dst = NULL;
size_t nread, nwritten, len;
char buf[4096];
struct stat st;
@@ -230,7 +230,9 @@ void copyFile(char *dir, char *file)
RETRY( fclose(dst) )
err:
if (src) {
RETRY( fclose(src) )
}
wfree(dstpath);
return;
}

View File

@@ -471,7 +471,7 @@ BackgroundTexture *parseTexture(RContext * rc, char *text)
XColor color;
Pixmap pixmap = None;
RImage *image = NULL;
int iwidth, iheight;
int iwidth = 0, iheight = 0;
RColor rcolor;
GETSTRORGOTO(val, tmp, 1, error);
@@ -879,7 +879,7 @@ void helperLoop(RContext * rc)
memset(textures, 0, WORKSPACE_COUNT * sizeof(BackgroundTexture *));
while (1) {
int workspace;
int workspace = -1;
/* get length of message */
if (readmsg(0, buffer, 4) < 0) {