[ZBX-10375] Define our own zbx_int32_t instead of using common name uint32_t Created: 2016 Feb 11  Updated: 2017 May 30  Resolved: 2016 Apr 04

Status: Closed
Project: ZABBIX BUGS AND ISSUES
Component/s: Agent (G), Installation (I), Proxy (P), Server (S)
Affects Version/s: 3.0.0rc2
Fix Version/s: 3.0.2rc1, 3.2.0alpha1

Type: Incident report Priority: Trivial
Reporter: Glebs Ivanovskis (Inactive) Assignee: Unassigned
Resolution: Fixed Votes: 0
Labels: codequality, compilation, encryption, windows
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Windows, Microsoft Visual C++



 Description   

One can spot the following piece in mbed tls library sources:

#ifdef _MSC_VER
#include <basetsd.h>
typedef UINT32 uint32_t;
#else
#include <stdint.h>
#endif

This conflicts with Zabbix definition:

#if defined(_WINDOWS)
#	ifndef uint32_t
#		define uint32_t	__int32
#	endif
#endif

...and forces us to #undef uint32_t on Windows before we include mbed tls headers, which makes the further use of uint32_t somewhat ambiguous.

I would like to suggest defining zbx_uint32_t properly (as we define zbx_uint64_t) and use a temporary #define uint32_t zbx_uint32_t while we make continuous effort to eliminate uint32_t from Zabbix code.



 Comments   
Comment by Viktors Tjarve [ 2016 Feb 19 ]

Compilation error message when building without #undef uint32_t on Windows:

c:\tmp\mbedtls\include\polarssl\bignum.h(50) : error C2628: 'UINT32' followed by '__int32' is illegal (did you forget a ';'?)
c:\tmp\mbedtls\include\polarssl\bignum.h(50) : warning C4091: 'typedef ' : ignored on left of 'unsigned int' when no variable is declared
c:\tmp\mbedtls\include\polarssl\md5.h(37) : error C2628: 'UINT32' followed by '__int32' is illegal (did you forget a ';'?)
c:\tmp\mbedtls\include\polarssl\md5.h(37) : warning C4091: 'typedef ' : ignored on left of 'unsigned int' when no variable is declared
c:\tmp\mbedtls\include\polarssl\sha1.h(37) : error C2628: 'UINT32' followed by '__int32' is illegal (did you forget a ';'?)
c:\tmp\mbedtls\include\polarssl\sha1.h(37) : warning C4091: 'typedef ' : ignored on left of 'unsigned int' when no variable is declared
c:\tmp\mbedtls\include\polarssl\sha256.h(37) : error C2628: 'UINT32' followed by '__int32' is illegal (did you forget a ';'?)
c:\tmp\mbedtls\include\polarssl\sha256.h(37) : warning C4091: 'typedef ' : ignored on left of 'unsigned int' when no variable is declared
c:\tmp\mbedtls\include\polarssl\aes.h(37) : error C2628: 'UINT32' followed by '__int32' is illegal (did you forget a ';'?)
c:\tmp\mbedtls\include\polarssl\aes.h(37) : warning C4091: 'typedef ' : ignored on left of 'unsigned int' when no variable is declared
..\..\..\src\libs\zbxcomms\comms.c(1506) : warning C4018: '<' : signed/unsigned mismatch
NMAKE : fatal error U1077: '"C:\Program Files\Microsoft Visual Studio 9.0\VC\Bin\cl.exe"' : return code '0x2'
Stop.
Comment by Glebs Ivanovskis (Inactive) [ 2016 Mar 29 ]

Fix available in development branch svn://svn.zabbix.com/branches/dev/ZBX-10375 revision 59148.

Comment by Andris Zeila [ 2016 Apr 01 ]

Successfully tested

Comment by Glebs Ivanovskis (Inactive) [ 2016 Apr 01 ]

Fixed in pre-3.0.2rc1 r59235, pre-3.1.0 (trunk) r59233.

Generated at Fri Mar 29 13:18:44 EET 2024 using Jira 9.12.4#9120004-sha1:625303b708afdb767e17cb2838290c41888e9ff0.