Quake II RTX doxygen
1.0 dev
error.c
Go to the documentation of this file.
1
/*
2
Copyright (C) 2010 Andrey Nazarov
3
4
This program is free software; you can redistribute it and/or modify
5
it under the terms of the GNU General Public License as published by
6
the Free Software Foundation; either version 2 of the License, or
7
(at your option) any later version.
8
9
This program is distributed in the hope that it will be useful,
10
but WITHOUT ANY WARRANTY; without even the implied warranty of
11
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
GNU General Public License for more details.
13
14
You should have received a copy of the GNU General Public License along
15
with this program; if not, write to the Free Software Foundation, Inc.,
16
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
17
*/
18
19
#include "shared/shared.h"
20
#include "common/error.h"
21
22
static
const
char
*
const
error_table
[] = {
23
"Unspecified error"
,
24
"Unknown file format"
,
25
"Invalid file format"
,
26
"Bad lump extent"
,
27
"Odd lump size"
,
28
"Too many elements"
,
29
"Too few elements"
,
30
"Index out of range"
,
31
"Invalid quake path"
,
32
"File name too short"
,
33
"Unexpected end of file"
,
34
"File too small"
,
35
"Not a regular file"
,
36
"Bad run length packet"
,
37
"String truncation avoided"
,
38
"Runaway loop avoided"
,
39
"Infinite loop avoided"
,
40
"Library error"
,
41
"Out of slots"
,
42
#if USE_ZLIB
43
"Inflate failed"
,
44
"Deflate failed"
,
45
"Coherency check failed"
,
46
#endif
47
};
48
49
static
const
int
num_errors
= q_countof(
error_table
);
50
51
const
char
*
Q_ErrorString
(qerror_t error)
52
{
53
int
e;
54
55
if
(error >= 0) {
56
return
"Success"
;
57
}
58
59
if
(error > -ERRNO_MAX) {
60
#if EINVAL > 0
61
e = -error;
62
#else
63
e = error;
64
#endif
65
return
strerror(e);
66
}
67
68
e = _Q_ERR(error);
69
70
return
error_table
[e >=
num_errors
? 0 : e];
71
}
72
Q_ErrorString
const char * Q_ErrorString(qerror_t error)
Definition:
error.c:51
error_table
static const char *const error_table[]
Definition:
error.c:22
num_errors
static const int num_errors
Definition:
error.c:49
src
common
error.c
Generated by
1.8.17