From ae43a9ce4eba19f403dba5837474cf5fe294a247 Mon Sep 17 00:00:00 2001 From: kervala Date: Sat, 2 Jan 2016 19:19:39 +0100 Subject: [PATCH] Fixed: Warnings with GCC --- code/nel/tools/3d/lightmap_optimizer/main.cpp | 8 +++++++ code/nel/tools/3d/tga_2_dds/tga2dds.cpp | 24 +++++++++---------- code/ryzom/common/src/game_share/crypt.cpp | 10 ++++---- .../common/src/game_share/crypt_sha512.cpp | 4 ++-- 4 files changed, 27 insertions(+), 19 deletions(-) diff --git a/code/nel/tools/3d/lightmap_optimizer/main.cpp b/code/nel/tools/3d/lightmap_optimizer/main.cpp index 3323cce40..f7e999799 100644 --- a/code/nel/tools/3d/lightmap_optimizer/main.cpp +++ b/code/nel/tools/3d/lightmap_optimizer/main.cpp @@ -920,6 +920,14 @@ int main(int nNbArg, char **ppArgs) const CMeshGeom *pMG = dynamic_cast(&pMeshML->getMeshGeom(m)); pVB = const_cast(&pMG->getVertexBuffer()); } + else + { + pVB = NULL; + } + + // to avoid a possible crash + if (!pVB) continue; + CVertexBufferReadWrite vba; pVB->lock (vba); diff --git a/code/nel/tools/3d/tga_2_dds/tga2dds.cpp b/code/nel/tools/3d/tga_2_dds/tga2dds.cpp index 6e235a3f1..f51e1aa04 100644 --- a/code/nel/tools/3d/tga_2_dds/tga2dds.cpp +++ b/code/nel/tools/3d/tga_2_dds/tga2dds.cpp @@ -360,24 +360,24 @@ void dividSize (CBitmap &bitmap) } const int bayerDiv8R[4][4] = { - 7, 3, 6, 2, - 1, 5, 0, 4, - 6, 2, 7, 3, - 0, 4, 1, 5, + { 7, 3, 6, 2 }, + { 1, 5, 0, 4 }, + { 6, 2, 7, 3 }, + { 0, 4, 1, 5 } }; const int bayerDiv8G[4][4] = { - 0, 4, 1, 5, - 6, 2, 7, 3, - 1, 5, 0, 4, - 7, 3, 6, 2, + { 0, 4, 1, 5 }, + { 6, 2, 7, 3 }, + { 1, 5, 0, 4 }, + { 7, 3, 6, 2 } }; const int bayerDiv8B[4][4] = { - 5, 1, 4, 0, - 3, 7, 2, 6, - 4, 0, 5, 1, - 2, 6, 3, 7, + { 5, 1, 4, 0 }, + { 3, 7, 2, 6 }, + { 4, 0, 5, 1 }, + { 2, 6, 3, 7 } }; // *************************************************************************** diff --git a/code/ryzom/common/src/game_share/crypt.cpp b/code/ryzom/common/src/game_share/crypt.cpp index 1750d5d20..05f66d87f 100644 --- a/code/ryzom/common/src/game_share/crypt.cpp +++ b/code/ryzom/common/src/game_share/crypt.cpp @@ -18,8 +18,8 @@ #include "crypt.h" -char * rz_crypt(register const char *key, register const char *setting, char *buf); -char *__crypt_sha512(const char *key, const char *setting, char *output); +std::string rz_crypt(register const char *key, register const char *setting, char *buf); +std::string __crypt_sha512(const char *key, const char *setting, char *output); // Crypts password using salt @@ -505,7 +505,7 @@ static char cryptresult[1+4+4+11+1]; /* encrypted result */ * Return a pointer to static data consisting of the "setting" * followed by an encryption produced by the "key" and "setting". */ -char * rz_crypt(register const char *key, register const char *setting, char *buf) { +std::string rz_crypt(register const char *key, register const char *setting, char *buf) { register char *encp; register long i; register int t; @@ -580,7 +580,7 @@ char * rz_crypt(register const char *key, register const char *setting, char *bu encp += salt_size; if (rz_des_cipher((char *)&constdatablock, (char *)&rsltblock, salt, num_iter)) - return (NULL); + return ""; /* * Encode the 64 cipher bits as 11 ascii characters. @@ -602,7 +602,7 @@ char * rz_crypt(register const char *key, register const char *setting, char *bu encp[3] = 0; - return (cryptresult); + return cryptresult; } diff --git a/code/ryzom/common/src/game_share/crypt_sha512.cpp b/code/ryzom/common/src/game_share/crypt_sha512.cpp index 70a142baa..77e514a3b 100644 --- a/code/ryzom/common/src/game_share/crypt_sha512.cpp +++ b/code/ryzom/common/src/game_share/crypt_sha512.cpp @@ -294,7 +294,7 @@ static char *sha512crypt(const char *key, const char *setting, char *output) /* DS = sha(repeat-salt) */ sha512_init(&ctx); - for (i = 0; i < 16 + md[0]; i++) + for (i = 0; i < 16u + md[0]; i++) sha512_update(&ctx, salt, slen); sha512_sum(&ctx, smd); @@ -373,7 +373,7 @@ static char *sha512crypt(const char *key, const char *setting, char *output) return output; } -char *__crypt_sha512(const char *key, const char *setting, char *output) +std::string __crypt_sha512(const char *key, const char *setting, char *output) { static const char testkey[] = "Xy01@#\x01\x02\x80\x7f\xff\r\n\x81\t !"; static const char testsetting[] = "$6$rounds=1234$abc0123456789$";