Complete.Org: Mailing Lists: Archives: freeciv-dev: February 2006:
[Freeciv-Dev] (PR#15586) srv_main.c gcc warning in debug mode
Home

[Freeciv-Dev] (PR#15586) srv_main.c gcc warning in debug mode

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
Subject: [Freeciv-Dev] (PR#15586) srv_main.c gcc warning in debug mode
From: "Egor Vyscrebentsov" <evyscr@xxxxxxxxx>
Date: Thu, 16 Feb 2006 04:07:03 -0800
Reply-to: bugs@xxxxxxxxxxx

<URL: http://bugs.freeciv.org/Ticket/Display.html?id=15586 >

Good daytime!

svn trunk rev. 11597

$ ./configure --enable-debug=yes
$ make

/home/freeciv/server/srv_main.c: In function `handle_packet_input':
/home/freeciv/server/srv_main.c:959: warning: `pplayer' might be used 
uninitialized in this function
make[3]: *** [srv_main.o] Error 1

It is easy to just add ' = NULL' to pplayer's declaration, but I'm not
sure that this is right fix.

From line #1029:
  /* valid packets from established connections but non-players */
  if (type == PACKET_CHAT_MSG_REQ
      || type == PACKET_SINGLE_WANT_HACK_REQ
      || type == PACKET_EDIT_MODE
      || type == PACKET_EDIT_TILE
      || type == PACKET_EDIT_UNIT
      || type == PACKET_EDIT_CITY
      || type == PACKET_EDIT_PLAYER) {
    if (!server_handle_packet(type, packet, pplayer, pconn)) {
      freelog(LOG_ERROR, "Received unknown packet %d from %s",
              type, conn_description(pconn));
    }
    return TRUE;
  }

  pplayer = pconn->player;

So is it right to use pplayer before its initialization instead of NULL?

-- 
Thanks, evyscr





[Prev in Thread] Current Thread [Next in Thread]
  • [Freeciv-Dev] (PR#15586) srv_main.c gcc warning in debug mode, Egor Vyscrebentsov <=