-
Notifications
You must be signed in to change notification settings - Fork 0
/
rtv.h
70 lines (58 loc) · 2.03 KB
/
rtv.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
/*
* Copyright (C) 2002 John Todd Larason <[email protected]>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*/
#ifndef RTV_H
#define RTV_H
#ifdef __unix__
#define _LARGEFILE64_SOURCE
typedef unsigned char u8;
typedef unsigned short u16;
typedef unsigned long u32;
typedef unsigned long long u64;
typedef long long s64;
#endif
#ifdef _WIN32
typedef unsigned char u8;
typedef unsigned short u16;
typedef unsigned long u32;
typedef unsigned __int64 u64;
typedef __int64 s64;
#endif
#ifdef __APPLE__
#define U64F "q"
#else
#define U64F "ll"
#endif
#ifndef EXPECT_CAN_EXIT
#define EXPECT_CAN_EXIT 0
#endif
struct replaytv_version {
int major, minor, patch, build;
};
extern struct replaytv_version replaytv_version;
extern u16 rtv_to_u16(unsigned char ** pp);
extern u32 rtv_to_u32(unsigned char ** pp);
extern u64 rtv_to_u64(unsigned char ** pp);
extern void rtv_from_u16(unsigned char ** pp, u16 v);
extern void rtv_from_u32(unsigned char ** pp, u32 v);
extern void rtv_from_u64(unsigned char ** pp, u64 v);
extern int rtv_set_replaytv_version(char * version);
extern int rtv_split_lines(char * src, char *** dst);
extern void rtv_free_lines(int num, char ** lines);
#define expect(x) do { \
if (!(x)) { \
fprintf(stderr, "Unexpected %s %s:%d\n", #x, __FILE__, __LINE__); \
if (EXPECT_CAN_EXIT) (exit(-1)); \
} \
} while(0)
#endif