diff options
Diffstat (limited to 'src/daemon/https/lgl/printf-args.c')
-rw-r--r-- | src/daemon/https/lgl/printf-args.c | 185 |
1 files changed, 0 insertions, 185 deletions
diff --git a/src/daemon/https/lgl/printf-args.c b/src/daemon/https/lgl/printf-args.c deleted file mode 100644 index a3f84740..00000000 --- a/src/daemon/https/lgl/printf-args.c +++ /dev/null | |||
@@ -1,185 +0,0 @@ | |||
1 | /* Decomposed printf argument list. | ||
2 | Copyright (C) 1999, 2002-2003, 2005-2007 Free Software Foundation, Inc. | ||
3 | |||
4 | This program is free software; you can redistribute it and/or modify | ||
5 | it under the terms of the GNU Lesser General Public License as published by | ||
6 | the Free Software Foundation; either version 2.1, or (at your option) | ||
7 | 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 Lesser General Public License for more details. | ||
13 | |||
14 | You should have received a copy of the GNU Lesser General Public License along | ||
15 | with this program; if not, write to the Free Software Foundation, | ||
16 | Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ | ||
17 | |||
18 | /* This file can be parametrized with the following macros: | ||
19 | ENABLE_UNISTDIO Set to 1 to enable the unistdio extensions. | ||
20 | PRINTF_FETCHARGS Name of the function to be defined. | ||
21 | STATIC Set to 'static' to declare the function static. */ | ||
22 | |||
23 | #ifndef PRINTF_FETCHARGS | ||
24 | #include "MHD_config.h" | ||
25 | #endif | ||
26 | |||
27 | /* Specification. */ | ||
28 | #ifndef PRINTF_FETCHARGS | ||
29 | # include "printf-args.h" | ||
30 | #endif | ||
31 | |||
32 | #ifdef STATIC | ||
33 | STATIC | ||
34 | #endif | ||
35 | int | ||
36 | PRINTF_FETCHARGS (va_list args, arguments * a) | ||
37 | { | ||
38 | size_t i; | ||
39 | argument *ap; | ||
40 | |||
41 | for (i = 0, ap = &a->arg[0]; i < a->count; i++, ap++) | ||
42 | switch (ap->type) | ||
43 | { | ||
44 | case TYPE_SCHAR: | ||
45 | ap->a.a_schar = va_arg (args, /*signed char */ int); | ||
46 | break; | ||
47 | case TYPE_UCHAR: | ||
48 | ap->a.a_uchar = va_arg (args, /*unsigned char */ int); | ||
49 | break; | ||
50 | case TYPE_SHORT: | ||
51 | ap->a.a_short = va_arg (args, /*short */ int); | ||
52 | break; | ||
53 | case TYPE_USHORT: | ||
54 | ap->a.a_ushort = va_arg (args, /*unsigned short */ int); | ||
55 | break; | ||
56 | case TYPE_INT: | ||
57 | ap->a.a_int = va_arg (args, int); | ||
58 | break; | ||
59 | case TYPE_UINT: | ||
60 | ap->a.a_uint = va_arg (args, unsigned int); | ||
61 | break; | ||
62 | case TYPE_LONGINT: | ||
63 | ap->a.a_longint = va_arg (args, long int); | ||
64 | break; | ||
65 | case TYPE_ULONGINT: | ||
66 | ap->a.a_ulongint = va_arg (args, unsigned long int); | ||
67 | break; | ||
68 | #if HAVE_LONG_LONG_INT | ||
69 | case TYPE_LONGLONGINT: | ||
70 | ap->a.a_longlongint = va_arg (args, long long int); | ||
71 | break; | ||
72 | case TYPE_ULONGLONGINT: | ||
73 | ap->a.a_ulonglongint = va_arg (args, unsigned long long int); | ||
74 | break; | ||
75 | #endif | ||
76 | case TYPE_DOUBLE: | ||
77 | ap->a.a_double = va_arg (args, double); | ||
78 | break; | ||
79 | case TYPE_LONGDOUBLE: | ||
80 | ap->a.a_longdouble = va_arg (args, long double); | ||
81 | break; | ||
82 | case TYPE_CHAR: | ||
83 | ap->a.a_char = va_arg (args, int); | ||
84 | break; | ||
85 | #if HAVE_WINT_T | ||
86 | case TYPE_WIDE_CHAR: | ||
87 | /* Although ISO C 99 7.24.1.(2) says that wint_t is "unchanged by | ||
88 | default argument promotions", this is not the case in mingw32, | ||
89 | where wint_t is 'unsigned short'. */ | ||
90 | ap->a.a_wide_char = | ||
91 | (sizeof (wint_t) < sizeof (int) | ||
92 | ? va_arg (args, int) : va_arg (args, wint_t)); | ||
93 | break; | ||
94 | #endif | ||
95 | case TYPE_STRING: | ||
96 | ap->a.a_string = va_arg (args, const char *); | ||
97 | /* A null pointer is an invalid argument for "%s", but in practice | ||
98 | it occurs quite frequently in printf statements that produce | ||
99 | debug output. Use a fallback in this case. */ | ||
100 | if (ap->a.a_string == NULL) | ||
101 | ap->a.a_string = "(NULL)"; | ||
102 | break; | ||
103 | #if HAVE_WCHAR_T | ||
104 | case TYPE_WIDE_STRING: | ||
105 | ap->a.a_wide_string = va_arg (args, const wchar_t *); | ||
106 | /* A null pointer is an invalid argument for "%ls", but in practice | ||
107 | it occurs quite frequently in printf statements that produce | ||
108 | debug output. Use a fallback in this case. */ | ||
109 | if (ap->a.a_wide_string == NULL) | ||
110 | { | ||
111 | static const wchar_t wide_null_string[] = { | ||
112 | (wchar_t) '(', | ||
113 | (wchar_t) 'N', (wchar_t) 'U', (wchar_t) 'L', (wchar_t) 'L', | ||
114 | (wchar_t) ')', | ||
115 | (wchar_t) 0 | ||
116 | }; | ||
117 | ap->a.a_wide_string = wide_null_string; | ||
118 | } | ||
119 | break; | ||
120 | #endif | ||
121 | case TYPE_POINTER: | ||
122 | ap->a.a_pointer = va_arg (args, void *); | ||
123 | break; | ||
124 | case TYPE_COUNT_SCHAR_POINTER: | ||
125 | ap->a.a_count_schar_pointer = va_arg (args, signed char *); | ||
126 | break; | ||
127 | case TYPE_COUNT_SHORT_POINTER: | ||
128 | ap->a.a_count_short_pointer = va_arg (args, short *); | ||
129 | break; | ||
130 | case TYPE_COUNT_INT_POINTER: | ||
131 | ap->a.a_count_int_pointer = va_arg (args, int *); | ||
132 | break; | ||
133 | case TYPE_COUNT_LONGINT_POINTER: | ||
134 | ap->a.a_count_longint_pointer = va_arg (args, long int *); | ||
135 | break; | ||
136 | #if HAVE_LONG_LONG_INT | ||
137 | case TYPE_COUNT_LONGLONGINT_POINTER: | ||
138 | ap->a.a_count_longlongint_pointer = va_arg (args, long long int *); | ||
139 | break; | ||
140 | #endif | ||
141 | #if ENABLE_UNISTDIO | ||
142 | /* The unistdio extensions. */ | ||
143 | case TYPE_U8_STRING: | ||
144 | ap->a.a_u8_string = va_arg (args, const uint8_t *); | ||
145 | /* A null pointer is an invalid argument for "%U", but in practice | ||
146 | it occurs quite frequently in printf statements that produce | ||
147 | debug output. Use a fallback in this case. */ | ||
148 | if (ap->a.a_u8_string == NULL) | ||
149 | { | ||
150 | static const uint8_t u8_null_string[] = | ||
151 | { '(', 'N', 'U', 'L', 'L', ')', 0 }; | ||
152 | ap->a.a_u8_string = u8_null_string; | ||
153 | } | ||
154 | break; | ||
155 | case TYPE_U16_STRING: | ||
156 | ap->a.a_u16_string = va_arg (args, const uint16_t *); | ||
157 | /* A null pointer is an invalid argument for "%lU", but in practice | ||
158 | it occurs quite frequently in printf statements that produce | ||
159 | debug output. Use a fallback in this case. */ | ||
160 | if (ap->a.a_u16_string == NULL) | ||
161 | { | ||
162 | static const uint16_t u16_null_string[] = | ||
163 | { '(', 'N', 'U', 'L', 'L', ')', 0 }; | ||
164 | ap->a.a_u16_string = u16_null_string; | ||
165 | } | ||
166 | break; | ||
167 | case TYPE_U32_STRING: | ||
168 | ap->a.a_u32_string = va_arg (args, const uint32_t *); | ||
169 | /* A null pointer is an invalid argument for "%llU", but in practice | ||
170 | it occurs quite frequently in printf statements that produce | ||
171 | debug output. Use a fallback in this case. */ | ||
172 | if (ap->a.a_u32_string == NULL) | ||
173 | { | ||
174 | static const uint32_t u32_null_string[] = | ||
175 | { '(', 'N', 'U', 'L', 'L', ')', 0 }; | ||
176 | ap->a.a_u32_string = u32_null_string; | ||
177 | } | ||
178 | break; | ||
179 | #endif | ||
180 | default: | ||
181 | /* Unknown type. */ | ||
182 | return -1; | ||
183 | } | ||
184 | return 0; | ||
185 | } | ||