From 3dbb744fcc0931bfd85b1bd3cbf4194577de0de7 Mon Sep 17 00:00:00 2001 From: Maxim Mamontov Date: Wed, 8 Dec 2010 15:37:13 +0200 Subject: [PATCH 1/1] =?utf8?q?=D0=98=D1=81=D0=BA=D1=83=D1=81=D1=82=D0=B2?= =?utf8?q?=D0=B5=D0=BD=D0=BD=D1=8B=D0=B5=20"=D0=BF=D0=B0=D0=B4=D0=B5=D0=BD?= =?utf8?q?=D0=B8=D1=8F"=20=D1=87=D0=B5=D1=80=D0=B5=D0=B7=20=D1=80=D0=B0?= =?utf8?q?=D0=B7=D0=B8=D0=BC=D0=B5=D0=BD=D0=BE=D0=B2=D0=B0=D0=BD=D0=B8?= =?utf8?q?=D0=B5=20=D0=BD=D1=83=D0=BB=D0=B5=D0=B2=D0=BE=D0=B3=D0=BE=20?= =?utf8?q?=D1=83=D0=BA=D0=B0=D0=B7=D0=B0=D1=82=D0=B5=D0=BB=D1=8F=20=D0=B7?= =?utf8?q?=D0=B0=D0=BC=D0=B5=D0=BD=D0=B5=D0=BD=D1=8B=20=D0=BD=D0=B0=20?= =?utf8?q?=D0=BF=D1=80=D0=BE=D0=B2=D0=B5=D1=80=D0=BE=D1=87=D0=BD=D1=8B?= =?utf8?q?=D0=B5=20=D1=83=D1=82=D0=B2=D0=B5=D1=80=D0=B6=D0=B4=D0=B5=D0=BD?= =?utf8?q?=D0=B8=D1=8F=20=D0=B2=20=D0=B1=D0=B8=D0=B1=D0=BB=D0=B8=D0=BE?= =?utf8?q?=D1=82=D0=B5=D0=BA=D0=B5=20=D0=BF=D0=BE=D0=B4=D0=B4=D0=B5=D1=80?= =?utf8?q?=D0=B6=D0=BA=D0=B8=20=D0=BF=D1=80=D0=BE=D1=82=D0=BE=D0=BA=D0=BE?= =?utf8?q?=D0=BB=D0=B0=20=D0=B0=D0=B2=D1=82=D0=BE=D1=80=D0=B8=D0=B7=D0=B0?= =?utf8?q?=D1=82=D0=BE=D1=80=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- stglibs/ia_auth_c.lib/ia_auth_c.cpp | 50 ++++++----------------------- 1 file changed, 10 insertions(+), 40 deletions(-) diff --git a/stglibs/ia_auth_c.lib/ia_auth_c.cpp b/stglibs/ia_auth_c.lib/ia_auth_c.cpp index d97692ea..a7620692 100644 --- a/stglibs/ia_auth_c.lib/ia_auth_c.cpp +++ b/stglibs/ia_auth_c.lib/ia_auth_c.cpp @@ -28,10 +28,10 @@ //--------------------------------------------------------------------------- -#include -#include - -#include +#include +#include +#include +#include #ifdef WIN32 #include @@ -719,15 +719,9 @@ connSyn8 = (CONN_SYN_8*)buffer; SwapBytes(connSyn8->len); #endif -connSyn8->len = sizeof(CONN_SYN_8); -#ifdef IA_DEBUGPROTO -if (sizeof(CONN_SYN_8) != Min8(sizeof(CONN_SYN_8))) - { - int * a = NULL; - *a = 0; - } -#endif +assert(sizeof(CONN_SYN_8) == Min8(sizeof(CONN_SYN_8)) && "CONN_SYN_8 is not aligned to 8 bytes"); +connSyn8->len = sizeof(CONN_SYN_8); strncpy((char*)connSyn8->type, "CONN_SYN", IA_MAX_TYPE_LEN); strncpy((char*)connSyn8->login, login.c_str(), IA_LOGIN_LEN); connSyn8->dirs = 0; @@ -747,13 +741,7 @@ SwapBytes(connAck8->len); SwapBytes(connAck8->rnd); #endif -#ifdef IA_DEBUGPROTO -if (sizeof(CONN_ACK_8) != Min8(sizeof(CONN_ACK_8))) - { - int * a = NULL; - *a = 0; - } -#endif +assert(sizeof(CONN_ACK_8) == Min8(sizeof(CONN_ACK_8)) && "CONN_ACK_8 is not aligned to 8 bytes"); connAck8->len = sizeof(CONN_ACK_8); strncpy((char*)connAck8->loginS, login.c_str(), IA_LOGIN_LEN); @@ -773,13 +761,7 @@ SwapBytes(aliveAck8->len); SwapBytes(aliveAck8->rnd); #endif -#ifdef IA_DEBUGPROTO -if (Min8(sizeof(ALIVE_ACK_8)) != sizeof(ALIVE_ACK_8)) - { - int * a = NULL; - *a = 0; - } -#endif +assert(Min8(sizeof(ALIVE_ACK_8)) == sizeof(ALIVE_ACK_8) && "ALIVE_ACK_8 is not aligned to 8 bytes"); aliveAck8 = (ALIVE_ACK_8*)buffer; aliveAck8->len = sizeof(ALIVE_ACK_8); @@ -797,13 +779,7 @@ disconnSyn8 = (DISCONN_SYN_8*)buffer; SwapBytes(disconnSyn8->len); #endif -#ifdef IA_DEBUGPROTO -if (Min8(sizeof(DISCONN_SYN_8)) != sizeof(DISCONN_SYN_8)) - { - int * a = NULL; - *a = 0; - } -#endif +assert(Min8(sizeof(DISCONN_SYN_8)) == sizeof(DISCONN_SYN_8) && "DISCONN_SYN_8 is not aligned to 8 bytes"); disconnSyn8->len = sizeof(DISCONN_SYN_8); strncpy((char*)disconnSyn8->loginS, login.c_str(), IA_LOGIN_LEN); @@ -821,13 +797,7 @@ SwapBytes(disconnAck8->len); SwapBytes(disconnAck8->rnd); #endif -#ifdef IA_DEBUGPROTO -if (Min8(sizeof(DISCONN_ACK_8)) != sizeof(DISCONN_ACK_8)) - { - int * a = NULL; - *a = 0; - } -#endif +assert(Min8(sizeof(DISCONN_ACK_8)) == sizeof(DISCONN_ACK_8) && "DISCONN_ACK_8 is not aligned to 8 bytes"); disconnAck8->len = Min8(sizeof(DISCONN_ACK_8)); disconnAck8->rnd = rnd + 1; -- 2.44.2