Merge pull request #2874 from akallabeth/stdtypes

Using stdint.h and stdbool.h for type definitions
This commit is contained in:
Bernhard Miklautz 2015-12-17 16:37:54 +01:00
commit 97edeca204
16 changed files with 149 additions and 39 deletions

View File

@ -337,6 +337,7 @@ if(NOT IOS)
check_include_files(unistd.h HAVE_UNISTD_H)
check_include_files(execinfo.h HAVE_EXECINFO_H)
check_include_files(stdint.h HAVE_STDINT_H)
check_include_files(stdbool.h HAVE_STDBOOL_H)
check_include_files(inttypes.h HAVE_INTTYPES_H)
check_include_files(sys/modem.h HAVE_SYS_MODEM_H)
check_include_files(sys/filio.h HAVE_SYS_FILIO_H)
@ -348,6 +349,7 @@ else()
set(HAVE_FCNTL_H 1)
set(HAVE_UNISTD_H 1)
set(HAVE_STDINT_H 1)
set(HAVE_STDBOOL_H 0)
set(HAVE_INTTYPES_H 1)
set(HAVE_SYS_FILIO_H 1)
endif()

View File

@ -522,7 +522,7 @@ static UINT audin_on_close(IWTSVirtualChannelCallback* pChannelCallback)
* @return 0 on success, otherwise a Win32 error code
*/
static UINT audin_on_new_channel_connection(IWTSListenerCallback* pListenerCallback,
IWTSVirtualChannel* pChannel, BYTE* Data, int* pbAccept,
IWTSVirtualChannel* pChannel, BYTE* Data, BOOL* pbAccept,
IWTSVirtualChannelCallback** ppCallback)
{
AUDIN_CHANNEL_CALLBACK* callback;

View File

@ -254,7 +254,7 @@ static UINT disp_on_close(IWTSVirtualChannelCallback* pChannelCallback)
* @return 0 on success, otherwise a Win32 error code
*/
static UINT disp_on_new_channel_connection(IWTSListenerCallback* pListenerCallback,
IWTSVirtualChannel* pChannel, BYTE* Data, int* pbAccept,
IWTSVirtualChannel* pChannel, BYTE* Data, BOOL* pbAccept,
IWTSVirtualChannelCallback** ppCallback)
{
DISP_CHANNEL_CALLBACK* callback;

View File

@ -436,7 +436,7 @@ static UINT dvcman_close_channel_iface(IWTSVirtualChannel* pChannel)
UINT dvcman_create_channel(IWTSVirtualChannelManager* pChannelMgr, UINT32 ChannelId, const char* ChannelName)
{
int i;
int bAccept;
BOOL bAccept;
DVCMAN_LISTENER* listener;
DVCMAN_CHANNEL* channel;
DrdynvcClientContext* context;
@ -462,11 +462,11 @@ UINT dvcman_create_channel(IWTSVirtualChannelManager* pChannelMgr, UINT32 Channe
channel->iface.Write = dvcman_write_channel;
channel->iface.Close = dvcman_close_channel_iface;
bAccept = 1;
bAccept = TRUE;
pCallback = NULL;
if ((error = listener->listener_callback->OnNewChannelConnection(listener->listener_callback,
(IWTSVirtualChannel*) channel, NULL, &bAccept, &pCallback)) == CHANNEL_RC_OK && bAccept == 1)
(IWTSVirtualChannel*) channel, NULL, &bAccept, &pCallback)) == CHANNEL_RC_OK && bAccept)
{
WLog_DBG(TAG, "listener %s created new channel %d",
listener->channel_name, channel->channel_id);

View File

@ -96,7 +96,7 @@ static UINT echo_on_close(IWTSVirtualChannelCallback* pChannelCallback)
* @return 0 on success, otherwise a Win32 error code
*/
static UINT echo_on_new_channel_connection(IWTSListenerCallback* pListenerCallback,
IWTSVirtualChannel* pChannel, BYTE* Data, int* pbAccept,
IWTSVirtualChannel* pChannel, BYTE* Data, BOOL* pbAccept,
IWTSVirtualChannelCallback** ppCallback)
{
ECHO_CHANNEL_CALLBACK* callback;

View File

@ -596,7 +596,7 @@ static UINT rdpei_on_close(IWTSVirtualChannelCallback* pChannelCallback)
* @return 0 on success, otherwise a Win32 error code
*/
static UINT rdpei_on_new_channel_connection(IWTSListenerCallback* pListenerCallback,
IWTSVirtualChannel* pChannel, BYTE* Data, int* pbAccept,
IWTSVirtualChannel* pChannel, BYTE* Data, BOOL* pbAccept,
IWTSVirtualChannelCallback** ppCallback)
{
RDPEI_CHANNEL_CALLBACK* callback;

View File

@ -1265,7 +1265,7 @@ static UINT rdpgfx_on_close(IWTSVirtualChannelCallback* pChannelCallback)
* @return 0 on success, otherwise a Win32 error code
*/
static UINT rdpgfx_on_new_channel_connection(IWTSListenerCallback* pListenerCallback,
IWTSVirtualChannel* pChannel, BYTE* Data, int* pbAccept,
IWTSVirtualChannel* pChannel, BYTE* Data, BOOL* pbAccept,
IWTSVirtualChannelCallback** ppCallback)
{
RDPGFX_CHANNEL_CALLBACK* callback;

View File

@ -50,7 +50,7 @@ struct _ITSMFDecoder
/* Optional Contol function */
BOOL (*Control)(ITSMFDecoder *decoder, ITSMFControlMsg control_msg, UINT32 *arg);
/* Decode a sample with extended interface. */
int (*DecodeEx)(ITSMFDecoder *decoder, const BYTE *data, UINT32 data_size, UINT32 extensions,
BOOL (*DecodeEx)(ITSMFDecoder *decoder, const BYTE *data, UINT32 data_size, UINT32 extensions,
UINT64 start_time, UINT64 end_time, UINT64 duration);
/* Get current play time */
UINT64(*GetRunningTime)(ITSMFDecoder *decoder);

View File

@ -392,7 +392,7 @@ static UINT tsmf_on_close(IWTSVirtualChannelCallback *pChannelCallback)
static UINT tsmf_on_new_channel_connection(IWTSListenerCallback *pListenerCallback,
IWTSVirtualChannel *pChannel,
BYTE *Data,
int *pbAccept,
BOOL *pbAccept,
IWTSVirtualChannelCallback **ppCallback)
{
TSMF_CHANNEL_CALLBACK* callback;

View File

@ -1335,7 +1335,7 @@ static UINT urbdrc_on_close(IWTSVirtualChannelCallback * pChannelCallback)
* @return 0 on success, otherwise a Win32 error code
*/
static UINT urbdrc_on_new_channel_connection(IWTSListenerCallback* pListenerCallback,
IWTSVirtualChannel * pChannel, BYTE* pData, int* pbAccept, IWTSVirtualChannelCallback** ppCallback)
IWTSVirtualChannel * pChannel, BYTE* pData, BOOL* pbAccept, IWTSVirtualChannelCallback** ppCallback)
{
URBDRC_LISTENER_CALLBACK* listener_callback = (URBDRC_LISTENER_CALLBACK*) pListenerCallback;
URBDRC_CHANNEL_CALLBACK* callback;

View File

@ -5,6 +5,7 @@
#cmakedefine HAVE_FCNTL_H
#cmakedefine HAVE_UNISTD_H
#cmakedefine HAVE_STDINT_H
#cmakedefine HAVE_STDBOOL_H
#cmakedefine HAVE_INTTYPES_H
#cmakedefine HAVE_SYS_MODEM_H
#cmakedefine HAVE_SYS_FILIO_H

View File

@ -77,7 +77,7 @@ FREERDP_API int freerdp_assistance_decrypt(rdpAssistanceFile* file, const char*
FREERDP_API int freerdp_client_populate_settings_from_assistance_file(rdpAssistanceFile* file, rdpSettings* settings);
FREERDP_API rdpAssistanceFile* freerdp_assistance_file_new();
FREERDP_API rdpAssistanceFile* freerdp_assistance_file_new(void);
FREERDP_API void freerdp_assistance_file_free(rdpAssistanceFile* file);
#ifdef __cplusplus

View File

@ -45,7 +45,7 @@ static void my_init_source(j_decompress_ptr cinfo)
}
/*****************************************************************************/
static BOOL my_fill_input_buffer(j_decompress_ptr cinfo)
static boolean my_fill_input_buffer(j_decompress_ptr cinfo)
{
struct mydata_decomp* md;
@ -61,7 +61,7 @@ static void my_skip_input_data(j_decompress_ptr cinfo, long num_bytes)
}
/*****************************************************************************/
static BOOL my_resync_to_restart(j_decompress_ptr cinfo, int desired)
static boolean my_resync_to_restart(j_decompress_ptr cinfo, int desired)
{
return 1;
}

View File

@ -1193,7 +1193,7 @@ int freerdp_client_populate_settings_from_assistance_file(rdpAssistanceFile* fil
return 1;
}
rdpAssistanceFile* freerdp_assistance_file_new()
rdpAssistanceFile* freerdp_assistance_file_new(void)
{
return (rdpAssistanceFile*) calloc(1, sizeof(rdpAssistanceFile));
}

View File

@ -16,6 +16,7 @@
# limitations under the License.
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/winpr/version.h.in ${CMAKE_CURRENT_BINARY_DIR}/winpr/version.h)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/winpr/wtypes.h.in ${CMAKE_CURRENT_BINARY_DIR}/winpr/wtypes.h)
file(GLOB WINPR_HEADERS "winpr/*.h")
install(FILES ${WINPR_HEADERS} DESTINATION include/winpr COMPONENT headers)

View File

@ -20,6 +20,11 @@
#ifndef WINPR_WTYPES_H
#define WINPR_WTYPES_H
/* Set by CMake during configuration. */
#define WINPR_HAVE_STDINT_H @HAVE_STDINT_H@
/* Set by CMake during configuration. */
#define WINPR_HAVE_STDINT_H @HAVE_STDBOOL_H@
/* MSDN: Windows Data Types - http://msdn.microsoft.com/en-us/library/aa383751/ */
/* [MS-DTYP]: Windows Data Types - http://msdn.microsoft.com/en-us/library/cc230273/ */
@ -28,6 +33,14 @@
#include <winpr/spec.h>
#if WINPR_HAVE_STDBOOL_H
#include <stdbool.h>
#endif
#if WINPR_HAVE_STDINT_H
#include <stdint.h>
#endif
#ifdef _WIN32
#include <wtypes.h>
#endif
@ -49,17 +62,47 @@
#define NEAR
#endif
#define __int8 char
#define __int16 short
#define __int32 int
#define __int64 long long
#if defined(__x86_64__) || defined(__arm64__)
#define __int3264 __int64
#if WINPR_HAVE_STDINT_H
#define __int8 int8_t
#define __uint8 uint8_t
#define __int16 int16_t
#define __uint16 uint16_t
#define __int32 int32_t
#define __uint32 uint32_t
#define __int64 int64_t
#define __uint64 uint64_t
#else
#define __int3264 __int32
#define __int8 char
#define __uint8 unsigned char
#define __int16 short
#define __uint16 unsigned short
#define __int32 int
#define __uint32 unsigned int
#define __int64 long long
#define __uint64 unsigned long long
#endif
#if WINPR_HAVE_STDINT_H
#if defined(__x86_64__) || defined(__arm64__)
#define __int3264 int64_t
#define __uint3264 uint64_t
#else
#define __int3264 int32_t
#define __uint3264 uint32_t
#endif
#else
#if defined(__x86_64__) || defined(__arm64__)
#define __int3264 __int64
#define __uint3264 __uint64
#else
#define __int3264 __int32
#define __uint3264 __uint32
#endif
#endif
#if WINPR_HAVE_STDBOOL_H && !defined(__OBJC__)
typedef bool BOOL;
#else
#ifndef __OBJC__
#if defined(__APPLE__)
typedef signed char BOOL;
@ -69,10 +112,15 @@ typedef int BOOL;
#endif
#endif
#endif
#endif
typedef BOOL *PBOOL, *LPBOOL;
#if defined(__LP64__) || defined(__APPLE__)
#if WINPR_HAVE_STDINT_H
typedef int32_t LONG;
typedef uint32_t DWORD;
typedef uint32_t ULONG;
#elif defined(__LP64__) || defined(__APPLE__)
typedef int LONG;
typedef unsigned int DWORD;
typedef unsigned int ULONG;
@ -82,27 +130,50 @@ typedef unsigned long DWORD;
typedef unsigned long ULONG;
#endif
#if WINPR_HAVE_STDINT_H
typedef uint8_t BYTE, *PBYTE, *LPBYTE;
#else
typedef unsigned char BYTE, *PBYTE, *LPBYTE;
#endif
typedef BYTE BOOLEAN, *PBOOLEAN;
#if defined(wchar_t)
typedef wchar_t WCHAR, *PWCHAR;
#else
typedef unsigned short WCHAR, *PWCHAR;
#endif
typedef WCHAR* BSTR;
typedef char CHAR, *PCHAR;
typedef DWORD *PDWORD, *LPDWORD;
#if WINPR_HAVE_STDINT_H
typedef uint32_t DWORD32;
typedef uint64_t DWORD64;
typedef uint64_t ULONGLONG;
#else
typedef unsigned int DWORD32;
typedef unsigned __int64 DWORD64;
typedef unsigned __int64 ULONGLONG;
#endif
typedef ULONGLONG DWORDLONG, *PDWORDLONG;
typedef float FLOAT;
typedef unsigned char UCHAR, *PUCHAR;
typedef short SHORT;
#ifndef FALSE
#if WINPR_HAVE_STDBOOL_H && !defined(__OBJC__)
#define FALSE false
#else
#define FALSE 0
#endif
#endif
#ifndef TRUE
#if WINPR_HAVE_STDBOOL_H && !defined(__OBJC__)
#define TRUE true
#else
#define TRUE 1
#endif
#endif
#define CONST const
#define CALLBACK
@ -119,25 +190,40 @@ typedef HANDLE HMENU;
typedef DWORD HCALL;
typedef int INT, *LPINT;
#if WINPR_HAVE_STDINT_H
typedef int8_t INT8;
typedef int16_t INT16;
typedef int32_t INT32;
typedef int64_t INT64;
#else
typedef signed char INT8;
typedef signed short INT16;
#ifndef XMD_H
typedef signed int INT32;
typedef signed __int64 INT64;
#endif
#endif
typedef const WCHAR* LMCSTR;
typedef WCHAR* LMSTR;
typedef LONG *PLONG, *LPLONG;
#if WINPR_HAVE_STDINT_H
typedef int64_t LONGLONG;
#else
typedef signed __int64 LONGLONG;
#endif
typedef __int3264 LONG_PTR, *PLONG_PTR;
typedef unsigned __int3264 ULONG_PTR, *PULONG_PTR;
typedef __uint3264 ULONG_PTR, *PULONG_PTR;
#if WINPR_HAVE_STDINT_H
typedef int32_t LONG32;
typedef int64_t LONG64;
#else
typedef signed int LONG32;
#ifndef XMD_H
typedef signed __int64 LONG64;
#endif
#endif
typedef CHAR *PSTR, *LPSTR, *LPCH;
typedef const CHAR *LPCSTR,*PCSTR;
@ -145,13 +231,23 @@ typedef const CHAR *LPCSTR,*PCSTR;
typedef WCHAR *LPWSTR, *PWSTR, *LPWCH;
typedef const WCHAR *LPCWSTR,*PCWSTR;
typedef unsigned int UINT;
#if WINPR_HAVE_STDINT_H
typedef uint64_t QWORD;
typedef uint8_t UINT8;
typedef uint16_t UINT16;
typedef uint32_t UINT32;
typedef uint64_t UINT64;
#else
typedef unsigned __int64 QWORD;
typedef unsigned int UINT;
typedef unsigned char UINT8;
typedef unsigned short UINT16;
typedef unsigned int UINT32;
typedef unsigned __int64 UINT64;
#endif
typedef ULONG *PULONG;
typedef LONG HRESULT;
@ -160,16 +256,26 @@ typedef SCODE *PSCODE;
typedef ULONG_PTR DWORD_PTR, *PDWORD_PTR;
typedef ULONG_PTR SIZE_T;
#if WINPR_HAVE_STDINT_H
typedef uint32_t ULONG32;
typedef uint64_t ULONG64;
typedef uint16_t USHORT;
typedef uint16_t WORD, *PWORD, *LPWORD;
#else
typedef unsigned int ULONG32;
typedef unsigned __int64 ULONG64;
typedef wchar_t UNICODE;
typedef unsigned short USHORT;
typedef unsigned short WORD, *PWORD, *LPWORD;
#endif
typedef wchar_t UNICODE;
#define VOID void
typedef void *PVOID, *LPVOID;
typedef void *PVOID64, *LPVOID64;
typedef unsigned short WORD, *PWORD, *LPWORD;
#if defined(__x86_64__) || defined(__arm64__)
#if WINPR_HAVE_STDINT_H
typedef intptr_t INT_PTR;
typedef uintptr_t UINT_PTR;
#elif __x86_64__
typedef __int64 INT_PTR;
typedef unsigned __int64 UINT_PTR;
#else
@ -273,19 +379,19 @@ typedef DWORD SECURITY_INFORMATION, *PSECURITY_INFORMATION;
typedef struct _RPC_SID
{
unsigned char Revision;
unsigned char SubAuthorityCount;
UCHAR Revision;
UCHAR SubAuthorityCount;
RPC_SID_IDENTIFIER_AUTHORITY IdentifierAuthority;
unsigned long SubAuthority[];
ULONG SubAuthority[];
} RPC_SID, *PRPC_SID, *PSID;
typedef struct _ACL
{
unsigned char AclRevision;
unsigned char Sbz1;
unsigned short AclSize;
unsigned short AceCount;
unsigned short Sbz2;
UCHAR AclRevision;
UCHAR Sbz1;
USHORT AclSize;
USHORT AceCount;
USHORT Sbz2;
} ACL, *PACL;
typedef struct _SECURITY_DESCRIPTOR
@ -329,7 +435,7 @@ typedef double DOUBLE;
typedef void* PCONTEXT_HANDLE;
typedef PCONTEXT_HANDLE* PPCONTEXT_HANDLE;
typedef unsigned long error_status_t;
typedef ULONG error_status_t;
#ifndef _NTDEF_
typedef LONG NTSTATUS;