OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2010 The WebM project authors. All Rights Reserved. | 2 * Copyright (c) 2010 The WebM project authors. All Rights Reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
11 | 11 |
12 #include <stdlib.h> | 12 #include <stdlib.h> |
13 #include <string.h> | 13 #include <string.h> |
14 #include <limits.h> | 14 #include <limits.h> |
15 #include "args.h" | 15 #include "args.h" |
16 | 16 |
17 #ifdef _MSC_VER | 17 #include "vpx_ports/msvc.h" |
18 #define snprintf _snprintf | |
19 #endif | |
20 | 18 |
21 #if defined(__GNUC__) && __GNUC__ | 19 #if defined(__GNUC__) && __GNUC__ |
22 extern void die(const char *fmt, ...) __attribute__((noreturn)); | 20 extern void die(const char *fmt, ...) __attribute__((noreturn)); |
23 #else | 21 #else |
24 extern void die(const char *fmt, ...); | 22 extern void die(const char *fmt, ...); |
25 #endif | 23 #endif |
26 | 24 |
27 | 25 |
28 struct arg arg_init(char **argv) { | 26 struct arg arg_init(char **argv) { |
29 struct arg a; | 27 struct arg a; |
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
229 die("Option %s: Invalid value '%s'\n", arg->name, arg->val); | 227 die("Option %s: Invalid value '%s'\n", arg->name, arg->val); |
230 return 0; | 228 return 0; |
231 } | 229 } |
232 | 230 |
233 | 231 |
234 int arg_parse_enum_or_int(const struct arg *arg) { | 232 int arg_parse_enum_or_int(const struct arg *arg) { |
235 if (arg->def->enums) | 233 if (arg->def->enums) |
236 return arg_parse_enum(arg); | 234 return arg_parse_enum(arg); |
237 return arg_parse_int(arg); | 235 return arg_parse_int(arg); |
238 } | 236 } |
OLD | NEW |