nel-all
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Nel] 5 minor bug fixes + ~500 compilation warning fixes


From: Loic Dachary
Subject: [Nel] 5 minor bug fixes + ~500 compilation warning fixes
Date: Fri, 16 Aug 2002 11:30:08 +0200

        Hi,

        I've activated the -Wall gcc flag in the hope of spotting a
few subtle bugs. I was not disapointed, although it took me about 2
full days to fix all the warnings, most of them being harmless. The
useful warnings were hidden in the mass ;-) 

        This patch also includes the prototype change for setConstant
in driver.h introduced in a mail earlier this week.

Bugs
. include/nel/misc/bitmap.h: isGrayscaleAsAlpha() did not return any value
. src/net/login_client.cpp: connectToShard return statement returned the
  wrong string, missing the leading comment
. src/3d/camera.h: enableFovAnimation and enableTargetAnimation did not
  return any value and were supposed to return a bool. Change them to return
  true in all cases.
. src/3d/driver/opengl/unix_event_emitter.cpp: getKey did not return any
  value if the key was not recognized. Make it return NUMLOCK.
. src/ai/script/code_branche_run_debug.cpp: readCommandLine uses sscanf
  with %d instead of %hd on 16bits variables.

Potentially harmful
. Classes with virtual functions and no virtual destructors (~100 occurence)
. switch that handled only a portion of the possible values: added
  a "default: break;" line to each of them. Warnings are no longer
  there and grepping "defeault: break;" allows to spot them. (~100 occurence)
. Uninitialized variables being used in some cases. Fixed the initial
  value to 0 which may turn out useful for detecting uninitialized pointers
  usage (~100 occurence)
. Fix signed/unsigned comparisons, many of them involving comparison
  with -1 or 0xFFFFFFFF (~50 occurence)

Costmetic
. Unused variables (~100 occurences)
. Reordering of variables initializers in constructors (~100 occurence)
. Replaced a few commented out code portions surrounded by /* */
  with #if 0. The /* and */ were not very visible and I got confused
  by it (~5 occurences)
. Control reaches the end of non void functions. In a few cases the
  compiler was just confused and I just added a return statement at
  the end (~3 occurences)
. Add __GNUC__ only variable arguments macros to prevent null statement
  warnings for #define MACRO if(false) macros. (~5 occurence)
. Comment out all #pragma when __GNUC__ to prevent warnings about non
  working pragmas (~10 occurence)
. Surround with additional set of parenthesis the assignements located
  in while or if expressions to prominently state it is not a
   mistake. (~10 occurence)

Attachment: patch.21
Description: Binary data

-- 
Loic   Dachary         http://www.dachary.org/  address@hidden
12 bd  Magenta         http://www.senga.org/      address@hidden
75010    Paris         T: 33 1 42 45 07 97          address@hidden
        GPG Public Key: http://www.dachary.org/loic/gpg.txt

reply via email to

[Prev in Thread] Current Thread [Next in Thread]