From 1e49552dda3be262790b02755867905b03be17d2 Mon Sep 17 00:00:00 2001 From: kaetemi Date: Fri, 27 Sep 2013 01:32:01 +0200 Subject: [PATCH] Fix warnings --- .../src/3d/driver/opengl/unix_event_emitter.cpp | 3 ++- code/ryzom/server/src/ai_share/world_map.h | 17 +++++++++++++---- .../mission_compiler_lib/mission_compiler.cpp | 4 ++-- .../mission_compiler_lib/variables.cpp | 2 +- 4 files changed, 18 insertions(+), 8 deletions(-) diff --git a/code/nel/src/3d/driver/opengl/unix_event_emitter.cpp b/code/nel/src/3d/driver/opengl/unix_event_emitter.cpp index c59167183..c3a8552ac 100644 --- a/code/nel/src/3d/driver/opengl/unix_event_emitter.cpp +++ b/code/nel/src/3d/driver/opengl/unix_event_emitter.cpp @@ -23,6 +23,7 @@ #include #include #include +#include #include "nel/misc/debug.h" @@ -566,7 +567,7 @@ bool CUnixEventEmitter::processMessage (XEvent &event, CEventServer *server) } else { - k = XKeycodeToKeysym(_dpy, keyCode, 0); + k = XkbKeycodeToKeysym(_dpy, keyCode, 0, 0); } // send CEventKeyDown event only if keyCode is defined diff --git a/code/ryzom/server/src/ai_share/world_map.h b/code/ryzom/server/src/ai_share/world_map.h index 48dcfee77..f9e46ecfc 100644 --- a/code/ryzom/server/src/ai_share/world_map.h +++ b/code/ryzom/server/src/ai_share/world_map.h @@ -1633,18 +1633,27 @@ CTopology::CTopology() { } +// convert a 2 characters string to uint16 +#ifdef NL_LITTLE_ENDIAN +# define NELID16(x) (uint16((x[0] << 8) | (x[1]))) +#else +# define NELID16(x) (uint16((x[1] << 8) | (x[0]))) +#endif + + + inline void CTopology::serial(NLMISC::IStream& f) { uint version = 0; - uint16 check = (uint16)'Tp'; + uint16 check = NELID16("Tp"); f.serial(check); - if (check != (uint16)'TP') + if (check != NELID16("TP")) { - nlassert(check == (uint16)'Tp'); + nlassert(check == NELID16("Tp")); version = f.serialVersion(3); } @@ -2285,7 +2294,7 @@ sint CWhiteCell::getHeight(CWorldPosition const& wpos) const inline void CWhiteCell::serial(NLMISC::IStream& f) { - f.serialCheck((uint16)'WC'); + f.serialCheck(NELID16("WC")); if (f.isReading()) _HeightMap = I16x16Layer::load(f); else diff --git a/code/ryzom/tools/leveldesign/mission_compiler_lib/mission_compiler.cpp b/code/ryzom/tools/leveldesign/mission_compiler_lib/mission_compiler.cpp index 4fdd68869..5e54e5298 100644 --- a/code/ryzom/tools/leveldesign/mission_compiler_lib/mission_compiler.cpp +++ b/code/ryzom/tools/leveldesign/mission_compiler_lib/mission_compiler.cpp @@ -177,8 +177,8 @@ GenderExtractor::GenderExtractor(const std::string & literal, const std::string& static const char * es[] ={"e", "e1", "e2", "e3"}; - static char * fs[] ={"f", "f1", "f2", "f3"}; - static char * hs[] ={"h", "h1", "h2", "h3"}; + static const char * fs[] ={"f", "f1", "f2", "f3"}; + static const char * hs[] ={"h", "h1", "h2", "h3"}; const char * e = es[level]; const char * f = fs[level]; diff --git a/code/ryzom/tools/leveldesign/mission_compiler_lib/variables.cpp b/code/ryzom/tools/leveldesign/mission_compiler_lib/variables.cpp index 853d487ba..bf405ab5c 100644 --- a/code/ryzom/tools/leveldesign/mission_compiler_lib/variables.cpp +++ b/code/ryzom/tools/leveldesign/mission_compiler_lib/variables.cpp @@ -331,7 +331,7 @@ REGISTER_VAR_INDIRECT(CVarSBrick, "var_sbrick"); /* for special item */ -char *SpecialItemProp[] = +const char *SpecialItemProp[] = { "Durability", "Weight",