Replace SDL types by C99 standard types

Scrcpy is a C11 project. Use the C99 standard types instead of the
SDL-specific types:

    SDL_bool -> bool
    SintXX   -> intXX_t
    UintXX   -> uintXX_t
This commit is contained in:
Romain Vimont
2019-03-02 23:52:22 +01:00
parent 8655ba7197
commit dfed1b250e
40 changed files with 456 additions and 438 deletions

View File

@@ -1,32 +1,33 @@
#ifndef BUFFER_UTIL_H
#define BUFFER_UTIL_H
#include <SDL2/SDL_stdinc.h>
#include <stdbool.h>
#include <stdint.h>
static inline void
buffer_write16be(Uint8 *buf, Uint16 value) {
buffer_write16be(uint8_t *buf, uint16_t value) {
buf[0] = value >> 8;
buf[1] = value;
}
static inline void
buffer_write32be(Uint8 *buf, Uint32 value) {
buffer_write32be(uint8_t *buf, uint32_t value) {
buf[0] = value >> 24;
buf[1] = value >> 16;
buf[2] = value >> 8;
buf[3] = value;
}
static inline Uint32
buffer_read32be(Uint8 *buf) {
static inline uint32_t
buffer_read32be(uint8_t *buf) {
return (buf[0] << 24) | (buf[1] << 16) | (buf[2] << 8) | buf[3];
}
static inline
Uint64 buffer_read64be(Uint8 *buf) {
Uint32 msb = buffer_read32be(buf);
Uint32 lsb = buffer_read32be(&buf[4]);
return ((Uint64) msb << 32) | lsb;
uint64_t buffer_read64be(uint8_t *buf) {
uint32_t msb = buffer_read32be(buf);
uint32_t lsb = buffer_read32be(&buf[4]);
return ((uint64_t) msb << 32) | lsb;
}
#endif