| 1 |
Description: Patch initializes all variables for which GCC gave warnings |
| 2 |
about unitialized or maybe unitialized variables. |
| 3 |
Author: Sergei Golovan |
| 4 |
Last-Modified: Wed, 09 Jul 2014 19:17:02 +0400 |
| 5 |
|
| 6 |
--- a/generic/bltArrayObj.c |
| 7 |
+++ b/generic/bltArrayObj.c |
| 8 |
@@ -69,6 +69,7 @@ |
| 9 |
} |
| 10 |
if (nElem%2) { |
| 11 |
if (interp != NULL) { |
| 12 |
+ string = Tcl_GetString(objPtr); |
| 13 |
Tcl_AppendResult(interp, "odd length: ", string, 0); |
| 14 |
} |
| 15 |
return TCL_ERROR; |
| 16 |
--- a/generic/bltBgexec.c |
| 17 |
+++ b/generic/bltBgexec.c |
| 18 |
@@ -559,6 +559,7 @@ |
| 19 |
*lengthPtr = length; |
| 20 |
return string; |
| 21 |
} |
| 22 |
+ *lengthPtr = length; |
| 23 |
return NULL; |
| 24 |
} |
| 25 |
|
| 26 |
@@ -603,6 +604,7 @@ |
| 27 |
return string; |
| 28 |
} |
| 29 |
} |
| 30 |
+ *lengthPtr = 0; |
| 31 |
return NULL; |
| 32 |
} |
| 33 |
/* |
| 34 |
--- a/generic/bltTreeCmd.c |
| 35 |
+++ b/generic/bltTreeCmd.c |
| 36 |
@@ -8086,7 +8086,7 @@ |
| 37 |
Blt_TreeKeySearch keyIter; |
| 38 |
int vobjc, kobjc, i, result = TCL_OK, len, cnt = 0, isar; |
| 39 |
int nobreak = 0, noupdate = 0, unset = 0, init = 0, aLen; |
| 40 |
|
| 41 |
+ char *var, *string, *aName = NULL, *aPat = NULL; |
| 42 |
int klen, kl, j; |
| 43 |
int *keySet = NULL; |
| 44 |
unsigned int inode; |
| 45 |
--- a/generic/bltVector.c |
| 46 |
+++ b/generic/bltVector.c |
| 47 |
@@ -1896,7 +1896,7 @@ |
| 48 |
return TCL_OK; |
| 49 |
} |
| 50 |
for (i=2; i<objc; i+=2) { |
| 51 |
|
| 52 |
+ int option, *ovar = NULL; |
| 53 |
if (Tcl_GetIndexFromObj(interp, objv[i], optionArr, "option", |
| 54 |
0, &option) != TCL_OK) { |
| 55 |
return TCL_OK; |
| 56 |
--- a/generic/bltGrAxis.c |
| 57 |
+++ b/generic/bltGrAxis.c |
| 58 |
@@ -1426,7 +1426,15 @@ |
| 59 |
|
| 60 |
nMajor = nMinor = 0; |
| 61 |
majorStep = minorStep = 0.0; |
| 62 |
|
| 63 |
+ if (min > max) { |
| 64 |
+ double m; |
| 65 |
+ m = min; |
| 66 |
+ min = max; |
| 67 |
+ max = m; |
| 68 |
+ } else if (min == max) { |
| 69 |
+ max = min + 1.0; |
| 70 |
+ } |
| 71 |
+ /* if (min < max) { */ |
| 72 |
min = (min != 0.0) ? log10(FABS(min)) : 0.0; |
| 73 |
max = (max != 0.0) ? log10(FABS(max)) : 1.0; |
| 74 |
|
| 75 |
@@ -1474,7 +1482,7 @@ |
| 76 |
(DEFINED(axisPtr->reqMax)))) { |
| 77 |
tickMax = max; |
| 78 |
} |
| 79 |
|
| 80 |
+ /* } */ |
| 81 |
axisPtr->majorSweep.step = majorStep; |
| 82 |
axisPtr->majorSweep.initial = floor(tickMin); |
| 83 |
axisPtr->majorSweep.nSteps = nMajor; |
| 84 |
@@ -1556,7 +1564,15 @@ |
| 85 |
|
| 86 |
nTicks = 0; |
| 87 |
tickMin = tickMax = 0.0; |
| 88 |
|
| 89 |
+ if (min > max) { |
| 90 |
+ double m; |
| 91 |
+ m = min; |
| 92 |
+ min = max; |
| 93 |
+ max = m; |
| 94 |
+ } else if (min == max) { |
| 95 |
+ max = min + 1.0; |
| 96 |
+ } |
| 97 |
+ /* if (min < max) { */ |
| 98 |
range = max - min; |
| 99 |
|
| 100 |
/* Calculate the major tick stepping. */ |
| 101 |
@@ -1578,7 +1594,7 @@ |
| 102 |
axisMax = tickMax = ceil(max / step) * step + 0.0; |
| 103 |
|
| 104 |
nTicks = Round((tickMax - tickMin) / step) + 1; |
| 105 |
|
| 106 |
+ /* } */ |
| 107 |
axisPtr->majorSweep.step = step; |
| 108 |
axisPtr->majorSweep.initial = tickMin; |
| 109 |
axisPtr->majorSweep.nSteps = nTicks; |
| 110 |
--- a/generic/bltGrLine.c |
| 111 |
+++ b/generic/bltGrLine.c |
| 112 |
@@ -3085,8 +3085,9 @@ |
| 113 |
register Point2D *pointPtr, *endPtr; |
| 114 |
int i; |
| 115 |
|
| 116 |
|
| 117 |
+ i = searchPtr->index; |
| 118 |
minDist = searchPtr->dist; |
| 119 |
+ closest = searchPtr->point; |
| 120 |
for (linkPtr = Blt_ChainFirstLink(linePtr->traces); linkPtr != NULL; |
| 121 |
linkPtr = Blt_ChainNextLink(linkPtr)) { |
| 122 |
tracePtr = Blt_ChainGetValue(linkPtr); |
| 123 |
@@ -3140,8 +3141,9 @@ |
| 124 |
int i; |
| 125 |
register Segment2D *s; |
| 126 |
|
| 127 |
|
| 128 |
+ i = searchPtr->index; |
| 129 |
minDist = searchPtr->dist; |
| 130 |
+ closest = searchPtr->point; |
| 131 |
s = linePtr->strips; |
| 132 |
for (count = 0; count < linePtr->nStrips; count++, s++) { |
| 133 |
dist = (*distProc)(searchPtr->x, searchPtr->y, &(s->p), &(s->q), &b); |
| 134 |
--- a/generic/bltBeep.c |
| 135 |
+++ b/generic/bltBeep.c |
| 136 |
@@ -58,9 +58,7 @@ |
| 137 |
argv[0], " ?volumePercent?\"", (char *)NULL); |
| 138 |
return TCL_ERROR; |
| 139 |
} |
| 140 |
|
| 141 |
|
| 142 |
|
| 143 |
+ if (argc == 2) { |
| 144 |
if (Tcl_GetInt(interp, argv[1], &percent) != TCL_OK) { |
| 145 |
return TCL_ERROR; |
| 146 |
} |
| 147 |
@@ -69,6 +67,8 @@ |
| 148 |
argv[1], "\"", (char *)NULL); |
| 149 |
return TCL_ERROR; |
| 150 |
} |
| 151 |
+ } else { |
| 152 |
+ percent = 50; /* Default setting */ |
| 153 |
} |
| 154 |
XBell(Tk_Display(Tk_MainWindow(interp)), percent); |
| 155 |
return TCL_OK; |
| 156 |
--- a/generic/bltConfig.c |
| 157 |
+++ b/generic/bltConfig.c |
| 158 |
@@ -977,6 +977,7 @@ |
| 159 |
int dropOffset; |
| 160 |
|
| 161 |
colorPtr = NULL; |
| 162 |
+ color2Ptr = NULL; |
| 163 |
dropOffset = 0; |
| 164 |
if ((string != NULL) && (string[0] != '\0')) { |
| 165 |
int nElem; |
| 166 |
--- a/generic/bltHtext.c |
| 167 |
+++ b/generic/bltHtext.c |
| 168 |
@@ -3100,6 +3100,8 @@ |
| 169 |
forceCopy = 0; |
| 170 |
} else { |
| 171 |
htPtr->last = htPtr->first - 1; |
| 172 |
+ lineNum = htPtr->first; |
| 173 |
+ lastY = 0; |
| 174 |
} |
| 175 |
|
| 176 |
/* Draw each line */ |
| 177 |
--- a/generic/bltImage.c |
| 178 |
+++ b/generic/bltImage.c |
| 179 |
@@ -2738,7 +2738,7 @@ |
| 180 |
if (opacity2<0.0) { |
| 181 |
a1 = (1.0 - a2); |
| 182 |
} else { |
| 183 |
|
| 184 |
+ a1 = (opacity2<0.0 ? 0.0 : (opacity2>1.0?1.0:opacity2)); |
| 185 |
} |
| 186 |
|
| 187 |
for (endPtr = destPtr + count; destPtr < endPtr; srcPtr++, src2Ptr++, destPtr++) { |
| 188 |
--- a/generic/bltTabnotebook.c |
| 189 |
+++ b/generic/bltTabnotebook.c |
| 190 |
@@ -2430,7 +2430,7 @@ |
| 191 |
int cavityWidth, cavityHeight; |
| 192 |
int width, height; |
| 193 |
int dx, dy; |
| 194 |
|
| 195 |
+ int x = 0, y = 0; |
| 196 |
|
| 197 |
nbPtr = tabPtr->nbPtr; |
| 198 |
pad = nbPtr->inset + nbPtr->inset2; |
| 199 |
--- a/generic/bltTabset.c |
| 200 |
+++ b/generic/bltTabset.c |
| 201 |
@@ -5771,14 +5771,6 @@ |
| 202 |
* side when correcting for left/right slants. |
| 203 |
*/ |
| 204 |
switch (setPtr->side) { |
| 205 |
|
| 206 |
|
| 207 |
|
| 208 |
|
| 209 |
|
| 210 |
|
| 211 |
|
| 212 |
|
| 213 |
case SIDE_LEFT: |
| 214 |
case SIDE_RIGHT: |
| 215 |
if (setPtr->slant == SLANT_LEFT) { |
| 216 |
@@ -5787,6 +5779,15 @@ |
| 217 |
y -= setPtr->overlap; |
| 218 |
} |
| 219 |
break; |
| 220 |
+ case SIDE_TOP: |
| 221 |
+ case SIDE_BOTTOM: |
| 222 |
+ default: |
| 223 |
+ if (setPtr->slant == SLANT_LEFT) { |
| 224 |
+ x += setPtr->overlap; |
| 225 |
+ } else if (setPtr->slant == SLANT_RIGHT) { |
| 226 |
+ x -= setPtr->overlap; |
| 227 |
+ } |
| 228 |
+ break; |
| 229 |
} |
| 230 |
|
| 231 |
/* |
| 232 |
@@ -5817,7 +5818,7 @@ |
| 233 |
iw = imgWidth = ImageWidth(image); |
| 234 |
ih = imgHeight = ImageHeight(image); |
| 235 |
} |
| 236 |
|
| 237 |
+ iw2 = ih2 = img2Width = img2Height = 0; |
| 238 |
if (image2 != NULL) { |
| 239 |
iw2 = img2Width = ImageWidth(image2); |
| 240 |
ih2 = img2Height = ImageHeight(image2); |
| 241 |
@@ -5847,6 +5848,7 @@ |
| 242 |
tx = x + (tabPtr->screenWidth - tabPtr->textWidth) / 2; |
| 243 |
break; |
| 244 |
case SIDE_TOP: |
| 245 |
+ default: |
| 246 |
tx = x + (tabPtr->screenWidth - tabPtr->textWidth) / 2; |
| 247 |
ty = y + dy + tabPtr->iPadY.side1 + IMAGE_PAD; |
| 248 |
ix = x + (tabPtr->screenWidth - iw) / 2; |
| 249 |
@@ -5915,6 +5917,7 @@ |
| 250 |
i2x = x + (tabPtr->screenWidth - iw2) / 2; |
| 251 |
break; |
| 252 |
case SIDE_TOP: |
| 253 |
+ default: |
| 254 |
i2y = iy + imgHeight + IMAGE_PAD + setPtr->gapLeft; |
| 255 |
i2x = x + (tabPtr->screenWidth - iw2) / 2; |
| 256 |
break; |
| 257 |
--- a/generic/tkButton.c |
| 258 |
+++ b/generic/tkButton.c |
| 259 |
@@ -1701,7 +1701,7 @@ |
| 260 |
GC newGC; |
| 261 |
unsigned long mask; |
| 262 |
Tk_Image image; |
| 263 |
|
| 264 |
+ char *oldTextVar = NULL, *oldSelVar = NULL; |
| 265 |
Blt_Tree oldTree; |
| 266 |
int oldNode, result = TCL_OK; |
| 267 |
char * oldABdStr = butPtr->activeBdImageString; |
| 268 |
@@ -1721,8 +1721,8 @@ |
| 269 |
|
| 270 |
if (Blt_ConfigureWidget(interp, butPtr->tkwin, configSpecs, |
| 271 |
argc, argv, (char *)butPtr, flags) != TCL_OK) { |
| 272 |
|
| 273 |
|
| 274 |
+ if (oldTextVar != NULL) ckfree(oldTextVar); |
| 275 |
+ if (oldSelVar != NULL) ckfree(oldSelVar); |
| 276 |
return TCL_ERROR; |
| 277 |
} |
| 278 |
/* |