Merge pull request #1349 from p12tic/types-cleanup

Cleanup declarations of {S,U}Int{8,16,32} types
This commit is contained in:
Povilas Kanapickas 2021-11-01 14:04:32 +02:00 committed by GitHub
commit aaa0e4d2e0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 15 additions and 74 deletions

View File

@ -17,7 +17,7 @@
#pragma once
#include "common/basic_types.h"
#include <cstddef>
class Chunk {
public:

View File

@ -17,6 +17,7 @@
*/
#include "barrier/key_types.h"
#include <cstddef>
const KeyNameMapEntry kKeyNameMap[] = {
{ "AltGr", kKeyAltGr },

View File

@ -18,49 +18,7 @@
#pragma once
#include "common/common.h"
//
// pick types of particular sizes
//
#if !defined(TYPE_OF_SIZE_1)
# if SIZEOF_CHAR == 1
# define TYPE_OF_SIZE_1 char
# endif
#endif
#if !defined(TYPE_OF_SIZE_2)
# if SIZEOF_INT == 2
# define TYPE_OF_SIZE_2 int
# else
# define TYPE_OF_SIZE_2 short
# endif
#endif
#if !defined(TYPE_OF_SIZE_4)
// Carbon defines SInt32 and UInt32 in terms of long
# if SIZEOF_INT == 4 && !defined(__APPLE__)
# define TYPE_OF_SIZE_4 int
# else
# define TYPE_OF_SIZE_4 long
# endif
#endif
//
// verify existence of required types
//
#if !defined(TYPE_OF_SIZE_1)
# error No 1 byte integer type
#endif
#if !defined(TYPE_OF_SIZE_2)
# error No 2 byte integer type
#endif
#if !defined(TYPE_OF_SIZE_4)
# error No 4 byte integer type
#endif
#include <cstdint>
//
// make typedefs
@ -75,18 +33,11 @@
#if defined(__APPLE__)
#include <CoreServices/CoreServices.h>
#else
typedef signed TYPE_OF_SIZE_1 SInt8;
typedef signed TYPE_OF_SIZE_2 SInt16;
typedef signed TYPE_OF_SIZE_4 SInt32;
typedef unsigned TYPE_OF_SIZE_1 UInt8;
typedef unsigned TYPE_OF_SIZE_2 UInt16;
typedef unsigned TYPE_OF_SIZE_4 UInt32;
using SInt8 = std::int8_t;
using SInt16 = std::int16_t;
using SInt32 = std::int32_t;
using UInt8 = std::uint8_t;
using UInt16 = std::uint16_t;
using UInt32 = std::uint32_t;
#endif
#endif
//
// clean up
//
#undef TYPE_OF_SIZE_1
#undef TYPE_OF_SIZE_2
#undef TYPE_OF_SIZE_4

View File

@ -22,19 +22,6 @@
# include "config.h"
#endif
// VC++ has built-in sized types
#if defined(_MSC_VER)
# include <wchar.h>
# define TYPE_OF_SIZE_1 __int8
# define TYPE_OF_SIZE_2 __int16
# define TYPE_OF_SIZE_4 __int32
#else
# define SIZE_OF_CHAR 1
# define SIZE_OF_SHORT 2
# define SIZE_OF_INT 4
# define SIZE_OF_LONG 4
#endif
// define NULL
#include <stddef.h>

View File

@ -22,6 +22,8 @@
// StreamBuffer
//
#include <cassert>
const UInt32 StreamBuffer::kChunkSize = 4096;
StreamBuffer::StreamBuffer() :

View File

@ -85,8 +85,8 @@ fakeNativeMediaKey(KeyID id)
data2:-1];
CGEventRef upEvent = [upRef CGEvent];
CGEventPost(0, downEvent);
CGEventPost(0, upEvent);
CGEventPost(kCGHIDEventTap, downEvent);
CGEventPost(kCGHIDEventTap, upEvent);
return true;
}

View File

@ -147,8 +147,8 @@ fakeNativeMediaKey(KeyID id)
data2:-1];
CGEventRef upEvent = [upRef CGEvent];
CGEventPost(0, downEvent);
CGEventPost(0, upEvent);
CGEventPost(kCGHIDEventTap, downEvent);
CGEventPost(kCGHIDEventTap, upEvent);
return true;
}