Merge pull request #1349 from p12tic/types-cleanup
Cleanup declarations of {S,U}Int{8,16,32} types
This commit is contained in:
commit
aaa0e4d2e0
|
@ -17,7 +17,7 @@
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "common/basic_types.h"
|
#include <cstddef>
|
||||||
|
|
||||||
class Chunk {
|
class Chunk {
|
||||||
public:
|
public:
|
||||||
|
|
|
@ -17,6 +17,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "barrier/key_types.h"
|
#include "barrier/key_types.h"
|
||||||
|
#include <cstddef>
|
||||||
|
|
||||||
const KeyNameMapEntry kKeyNameMap[] = {
|
const KeyNameMapEntry kKeyNameMap[] = {
|
||||||
{ "AltGr", kKeyAltGr },
|
{ "AltGr", kKeyAltGr },
|
||||||
|
|
|
@ -18,49 +18,7 @@
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "common/common.h"
|
#include <cstdint>
|
||||||
|
|
||||||
//
|
|
||||||
// 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
|
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// make typedefs
|
// make typedefs
|
||||||
|
@ -75,18 +33,11 @@
|
||||||
#if defined(__APPLE__)
|
#if defined(__APPLE__)
|
||||||
#include <CoreServices/CoreServices.h>
|
#include <CoreServices/CoreServices.h>
|
||||||
#else
|
#else
|
||||||
typedef signed TYPE_OF_SIZE_1 SInt8;
|
using SInt8 = std::int8_t;
|
||||||
typedef signed TYPE_OF_SIZE_2 SInt16;
|
using SInt16 = std::int16_t;
|
||||||
typedef signed TYPE_OF_SIZE_4 SInt32;
|
using SInt32 = std::int32_t;
|
||||||
typedef unsigned TYPE_OF_SIZE_1 UInt8;
|
using UInt8 = std::uint8_t;
|
||||||
typedef unsigned TYPE_OF_SIZE_2 UInt16;
|
using UInt16 = std::uint16_t;
|
||||||
typedef unsigned TYPE_OF_SIZE_4 UInt32;
|
using UInt32 = std::uint32_t;
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
//
|
|
||||||
// clean up
|
|
||||||
//
|
|
||||||
|
|
||||||
#undef TYPE_OF_SIZE_1
|
|
||||||
#undef TYPE_OF_SIZE_2
|
|
||||||
#undef TYPE_OF_SIZE_4
|
|
||||||
|
|
|
@ -22,19 +22,6 @@
|
||||||
# include "config.h"
|
# include "config.h"
|
||||||
#endif
|
#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
|
// define NULL
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
|
|
||||||
|
|
|
@ -22,6 +22,8 @@
|
||||||
// StreamBuffer
|
// StreamBuffer
|
||||||
//
|
//
|
||||||
|
|
||||||
|
#include <cassert>
|
||||||
|
|
||||||
const UInt32 StreamBuffer::kChunkSize = 4096;
|
const UInt32 StreamBuffer::kChunkSize = 4096;
|
||||||
|
|
||||||
StreamBuffer::StreamBuffer() :
|
StreamBuffer::StreamBuffer() :
|
||||||
|
|
|
@ -85,8 +85,8 @@ fakeNativeMediaKey(KeyID id)
|
||||||
data2:-1];
|
data2:-1];
|
||||||
CGEventRef upEvent = [upRef CGEvent];
|
CGEventRef upEvent = [upRef CGEvent];
|
||||||
|
|
||||||
CGEventPost(0, downEvent);
|
CGEventPost(kCGHIDEventTap, downEvent);
|
||||||
CGEventPost(0, upEvent);
|
CGEventPost(kCGHIDEventTap, upEvent);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
|
@ -147,8 +147,8 @@ fakeNativeMediaKey(KeyID id)
|
||||||
data2:-1];
|
data2:-1];
|
||||||
CGEventRef upEvent = [upRef CGEvent];
|
CGEventRef upEvent = [upRef CGEvent];
|
||||||
|
|
||||||
CGEventPost(0, downEvent);
|
CGEventPost(kCGHIDEventTap, downEvent);
|
||||||
CGEventPost(0, upEvent);
|
CGEventPost(kCGHIDEventTap, upEvent);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
Loading…
Reference in New Issue