(svn r8722) [cpp_gui] -Fix: g++ warnings 'variable might be used uninitialised'
--- a/src/station_gui.cpp Tue Feb 13 23:49:01 2007 +0000
+++ b/src/station_gui.cpp Wed Feb 14 00:57:15 2007 +0000
@@ -171,7 +171,7 @@
void RebuildStationLists(void)
{
- Window *w;
+ Window *w = NULL;
FOR_ALL_WINDOWS(w) {
if (w->window_class == WC_STATION_LIST) {
@@ -183,7 +183,7 @@
void ResortStationLists(void)
{
- Window *w;
+ Window *w = NULL;
FOR_ALL_WINDOWS(w) {
if (w->window_class == WC_STATION_LIST) {
--- a/src/vehicle_gui.cpp Tue Feb 13 23:49:01 2007 +0000
+++ b/src/vehicle_gui.cpp Wed Feb 14 00:57:15 2007 +0000
@@ -91,7 +91,7 @@
void RebuildVehicleLists(void)
{
- Window *w;
+ Window *w = NULL;
FOR_ALL_WINDOWS(w) {
switch (w->window_class) {
@@ -110,7 +110,7 @@
void ResortVehicleLists(void)
{
- Window *w;
+ Window *w = NULL;
FOR_ALL_WINDOWS(w) {
--- a/src/window.cpp Tue Feb 13 23:49:01 2007 +0000
+++ b/src/window.cpp Wed Feb 14 00:57:15 2007 +0000
@@ -764,7 +764,7 @@
DrawPixelInfo bk;
_cur_dpi = &bk;
- const Window *w;
+ const Window *w = NULL;
FOR_ALL_WINDOWS(w) {
if (right > w->left &&
bottom > w->top &&
@@ -822,7 +822,7 @@
/* When we find the window to delete, we need to restart the search
* as deleting this window could cascade in deleting (many) others
* anywhere in the z-array */
- Window *w;
+ Window *w = NULL;
FOR_ALL_WINDOWS(w) {
if (w->window_class == cls) {
w->Close();
@@ -861,7 +861,7 @@
* @param new_player PlayerID of the new owner of the window */
void ChangeWindowOwner(PlayerID old_player, PlayerID new_player)
{
- Window *w;
+ Window *w = NULL;
FOR_ALL_WINDOWS(w) {
@@ -1035,13 +1035,13 @@
static Point GetAutoPlacePosition(int width, int height)
{
Point pt;
+ Window *w = NULL;
_awap_r.width = width;
_awap_r.height = height;
if (IsGoodAutoPlace1(0, 24)) goto ok_pos;
- Window *w;
FOR_ALL_WINDOWS(w) {
if (w->window_class == WC_MAIN_WINDOW) continue;
@@ -1579,7 +1579,7 @@
*/
void SendWindowMessageClass(WindowClass wnd_class, int msg, int wparam, int lparam)
{
- Window *w;
+ Window *w = NULL;
FOR_ALL_WINDOWS(w) {
if (w->window_class == wnd_class) SendWindowMessageW(w, msg, wparam, lparam);
@@ -1854,7 +1854,7 @@
void InvalidateWindow(WindowClass cls, WindowNumber number)
{
- Window *w;
+ Window *w = NULL;
FOR_ALL_WINDOWS(w) {
if (w->window_class == cls && w->window_number == number) w->SetDirty();
@@ -1873,7 +1873,7 @@
void InvalidateWindowWidget(WindowClass cls, WindowNumber number, byte widget_index)
{
- Window *w;
+ Window *w = NULL;
FOR_ALL_WINDOWS(w) {
if (w->window_class == cls && w->window_number == number) {
w->InvalidateWidget(widget_index);
@@ -1883,7 +1883,7 @@
void InvalidateWindowClasses(WindowClass cls)
{
- Window *w;
+ Window *w = NULL;
FOR_ALL_WINDOWS(w) {
if (w->window_class == cls) w->SetDirty();
}
@@ -1897,7 +1897,7 @@
void InvalidateWindowData(WindowClass cls, WindowNumber number)
{
- Window *w;
+ Window *w = NULL;
FOR_ALL_WINDOWS(w) {
if (w->window_class == cls && w->window_number == number) w->InvalidateData();
}
@@ -1905,7 +1905,7 @@
void InvalidateWindowClassesData(WindowClass cls)
{
- Window *w;
+ Window *w = NULL;
FOR_ALL_WINDOWS(w) {
if (w->window_class == cls) w->InvalidateData();
}
@@ -1913,7 +1913,7 @@
void CallWindowTickEvent(void)
{
- Window *w;
+ Window *w = NULL;
REVERSED_FOR_ALL_WINDOWS(w) {
w->CallEventNP(WE_TICK);
}
@@ -1926,7 +1926,7 @@
/* When we find the window to delete, we need to restart the search
* as deleting this window could cascade in deleting (many) others
* anywhere in the z-array */
- Window *w;
+ Window *w = NULL;
FOR_ALL_WINDOWS(w) {
if (w->window_class != WC_MAIN_WINDOW &&
w->window_class != WC_SELECT_GAME &&
@@ -1956,7 +1956,7 @@
/* When we find the window to delete, we need to restart the search
* as deleting this window could cascade in deleting (many) others
* anywhere in the z-array */
- Window *w;
+ Window *w = NULL;
FOR_ALL_WINDOWS(w) {
if (w->flags4 & WF_STICKY) {
w->Close();
@@ -1992,7 +1992,7 @@
void RelocateAllWindows(int neww, int newh)
{
- Window *w;
+ Window *w = NULL;
FOR_ALL_WINDOWS(w) {
int left, top;