blob: dab50ccbd83e5da8c73f9d69909f7612940b0c8b (
plain)
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
|
/*
Copyright (C) 2010 skuller.net
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.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#define ERRNO_MAX 20000
#if EINVAL > 0
#define Q_ERRNO(e) ((e == Q_ERR_SUCCESS || e < -ERRNO_MAX) ? 0 : -e)
#define Q_ERR(e) (e == 0 ? Q_ERR_SUCCESS : e > ERRNO_MAX ? -ERRNO_MAX : -e)
#else
#define Q_ERRNO(e) ((e == Q_ERR_SUCCESS || e < -ERRNO_MAX) ? 0 : e)
#define Q_ERR(e) (e == 0 ? Q_ERR_SUCCESS : e < -ERRNO_MAX ? -ERRNO_MAX : e)
#endif
#define _Q_ERR(e) (-ERRNO_MAX-e)
#define Q_ERR_SUCCESS 0 // Success
#define Q_ERR_FAILURE _Q_ERR(0) // Unspecified error
#define Q_ERR_UNKNOWN_FORMAT _Q_ERR(1) // Unknown file format
#define Q_ERR_INVALID_FORMAT _Q_ERR(2) // Invalid file format
#define Q_ERR_BAD_EXTENT _Q_ERR(3) // Bad lump extent
#define Q_ERR_ODD_SIZE _Q_ERR(4) // Odd lump size
#define Q_ERR_TOO_MANY _Q_ERR(5) // Too many elements
#define Q_ERR_TOO_FEW _Q_ERR(6) // Too few elements
#define Q_ERR_BAD_INDEX _Q_ERR(7) // Index out of range
#define Q_ERR_INVALID_PATH _Q_ERR(8) // Invalid quake path
#define Q_ERR_UNCLEAN_PATH _Q_ERR(9) // Unclean quake path
#define Q_ERR_UNEXPECTED_EOF _Q_ERR(10) // Unexpected end of file
#define Q_ERR_FILE_TOO_SMALL _Q_ERR(11) // File too small
#define Q_ERR_BAD_RLE_PACKET _Q_ERR(12) // Bad run length packet
#define Q_ERR_STRING_TRUNCATED _Q_ERR(13) // String truncated
#define Q_ERR_LIBRARY_ERROR _Q_ERR(14) // Library error
#if USE_ZLIB
#define Q_ERR_INFLATE_FAILED _Q_ERR(15) // Inflate failed
#define Q_ERR_DEFLATE_FAILED _Q_ERR(16) // Deflate failed
#define Q_ERR_NOT_COHERENT _Q_ERR(17) // Coherency check failed
#endif
#define Q_ERR_NOENT Q_ERR(ENOENT)
#define Q_ERR_NAMETOOLONG Q_ERR(ENAMETOOLONG)
#define Q_ERR_INVAL Q_ERR(EINVAL)
#define Q_ERR_DEADLOCK Q_ERR(EDEADLK)
#define Q_ERR_NOSYS Q_ERR(ENOSYS)
#define Q_ERR_SPIPE Q_ERR(ESPIPE)
#define Q_ERR_FBIG Q_ERR(EFBIG)
#define Q_ERR_ISDIR Q_ERR(EISDIR)
#define Q_ERR_AGAIN Q_ERR(EAGAIN)
#define Q_ERR_NFILE Q_ERR(ENFILE)
#define Q_ERR_EXIST Q_ERR(EEXIST)
const char *Q_ErrorString( qerror_t error );
|