1
0
mirror of https://github.com/SoftEtherVPN/SoftEtherVPN.git synced 2024-12-26 01:59:53 +03:00

Use bool from stdbool.h, get rid of BOOL

BOOL was just an alias for bool, this commit replaces all instances of it for consistency.

For some reason bool was defined as a 4-byte integer instead of a 1-byte one, presumably to match WinAPI's definition: https://docs.microsoft.com/en-us/windows/win32/winprog/windows-data-types
Nothing should break now that bool is 1-byte, as no protocol code appears to be relying on the size of the data type.
PACK, for example, explicitly stores boolean values as 4-byte integers.

This commit can be seen as a follow-up to 61ccaed4f6.
This commit is contained in:
Davide Beatrici 2021-02-28 06:04:11 +01:00
parent 7f30cbccf4
commit 914bfe7d44
9 changed files with 6 additions and 27 deletions

View File

@ -24,10 +24,6 @@
#endif // VPN_SPEED
#define bool UINT
#define BOOL UINT
// Version number
#ifndef CEDAR_VERSION_MAJOR
#define CEDAR_VERSION_MAJOR 0

View File

@ -23025,7 +23025,7 @@ void CtEscapeCsv(wchar_t *dst, UINT size, wchar_t *src){
UINT i;
UINT len = UniStrLen(src);
UINT idx;
BOOL need_to_escape = false;
bool need_to_escape = false;
wchar_t tmp[2]=L"*";
// Check the input value

View File

@ -149,7 +149,7 @@ struct UDP
// Data block
struct BLOCK
{
BOOL Compressed; // Compression flag
bool Compressed; // Compression flag
UINT Size; // Block size
UINT SizeofData; // Data size
UCHAR *Buf; // Buffer

View File

@ -51,7 +51,7 @@ struct RPC_ENUM_DEVICE
// License status of the service
struct RPC_EL_LICENSE_STATUS
{
BOOL Valid; // Enable flag
bool Valid; // Enable flag
UINT64 SystemId; // System ID
UINT64 SystemExpires; // System expiration date
};
@ -74,7 +74,7 @@ struct EL_DEVICE
// License status
struct EL_LICENSE_STATUS
{
BOOL Valid; // Enable flag
bool Valid; // Enable flag
UINT64 SystemId; // System ID
UINT64 Expires; // Expiration date
};

View File

@ -1785,7 +1785,7 @@ bool RadiusLogin(CONNECTION *c, char *server, UINT port, UCHAR *secret, UINT sec
SOCK *sock;
USHORT sz = 0;
UINT pos = 0;
BOOL *finish = ZeroMallocEx(sizeof(BOOL) * LIST_NUM(ip_list), true);
bool *finish = ZeroMallocEx(sizeof(bool) * LIST_NUM(ip_list), true);
Zero(tmp, sizeof(tmp));

View File

@ -9,8 +9,6 @@
#ifdef WIN32
#define WIN32COM_CPP
#define _WIN32_DCOM
//#define _WIN32_WINNT 0x0502

View File

@ -8,12 +8,6 @@
#ifndef WIN32COM_H
#define WIN32COM_H
#ifdef WIN32COM_CPP
// Internal function
#endif // WIN32COM_CPP
#if defined(__cplusplus)
extern "C"
{

View File

@ -35,9 +35,6 @@
#undef StrCmp
#endif
#define WIN32COM_CPP
//#define _WIN32_WINNT 0x0502
//#define WINVER 0x0502
#include <winsock2.h>

View File

@ -8,6 +8,7 @@
#ifndef MAYATYPE_H
#define MAYATYPE_H
#include <stdbool.h>
#include <stdint.h>
// Check whether the windows.h header is included
@ -172,13 +173,6 @@ typedef int PID;
typedef unsigned long PID;
#endif // WINDOWS_H
// TODO: include <stdbool.h> instead of manually defining type
#ifndef WIN32COM_CPP
typedef unsigned int bool;
#define true 1
#define false 0
#endif // WIN32COM_CPP
typedef int64_t time_64t;
#ifndef _BASETSD_H_