Mercurial > libavformat.hg
annotate cutils.c @ 6332:2f14ee83c673 libavformat
rtpdec_xiph: Handle the sampling SDP parameter
Patch by Josh Allmann, joshua dot allmann at gmail
author | mstorsjo |
---|---|
date | Wed, 28 Jul 2010 06:43:58 +0000 |
parents | 28ca2d77f997 |
children |
rev | line source |
---|---|
0 | 1 /* |
2 * Various simple utilities for ffmpeg system | |
3 * Copyright (c) 2000, 2001, 2002 Fabrice Bellard | |
4 * | |
1358
0899bfe4105c
Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents:
896
diff
changeset
|
5 * This file is part of FFmpeg. |
0899bfe4105c
Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents:
896
diff
changeset
|
6 * |
0899bfe4105c
Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents:
896
diff
changeset
|
7 * FFmpeg is free software; you can redistribute it and/or |
0 | 8 * modify it under the terms of the GNU Lesser General Public |
9 * License as published by the Free Software Foundation; either | |
1358
0899bfe4105c
Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents:
896
diff
changeset
|
10 * version 2.1 of the License, or (at your option) any later version. |
0 | 11 * |
1358
0899bfe4105c
Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents:
896
diff
changeset
|
12 * FFmpeg is distributed in the hope that it will be useful, |
0 | 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
15 * Lesser General Public License for more details. | |
16 * | |
17 * You should have received a copy of the GNU Lesser General Public | |
1358
0899bfe4105c
Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents:
896
diff
changeset
|
18 * License along with FFmpeg; if not, write to the Free Software |
896
edbe5c3717f9
Update licensing information: The FSF changed postal address.
diego
parents:
887
diff
changeset
|
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
0 | 20 */ |
21 #include "avformat.h" | |
5946
28ca2d77f997
Move the internal function declarations in avformat.h to internal.h.
stefano
parents:
4375
diff
changeset
|
22 #include "internal.h" |
0 | 23 |
151 | 24 /* add one element to a dynamic array */ |
4375 | 25 void ff_dynarray_add(intptr_t **tab_ptr, int *nb_ptr, intptr_t elem) |
151 | 26 { |
27 int nb, nb_alloc; | |
4375 | 28 intptr_t *tab; |
151 | 29 |
30 nb = *nb_ptr; | |
31 tab = *tab_ptr; | |
32 if ((nb & (nb - 1)) == 0) { | |
33 if (nb == 0) | |
34 nb_alloc = 1; | |
35 else | |
36 nb_alloc = nb * 2; | |
4375 | 37 tab = av_realloc(tab, nb_alloc * sizeof(intptr_t)); |
151 | 38 *tab_ptr = tab; |
39 } | |
40 tab[nb++] = elem; | |
41 *nb_ptr = nb; | |
42 } | |
43 | |
230
9f4f4ca9f7b5
simpler strptime - added os_support.[ch] - moved localtime_r to os_support.c
bellard
parents:
229
diff
changeset
|
44 time_t mktimegm(struct tm *tm) |
9f4f4ca9f7b5
simpler strptime - added os_support.[ch] - moved localtime_r to os_support.c
bellard
parents:
229
diff
changeset
|
45 { |
9f4f4ca9f7b5
simpler strptime - added os_support.[ch] - moved localtime_r to os_support.c
bellard
parents:
229
diff
changeset
|
46 time_t t; |
9f4f4ca9f7b5
simpler strptime - added os_support.[ch] - moved localtime_r to os_support.c
bellard
parents:
229
diff
changeset
|
47 |
9f4f4ca9f7b5
simpler strptime - added os_support.[ch] - moved localtime_r to os_support.c
bellard
parents:
229
diff
changeset
|
48 int y = tm->tm_year + 1900, m = tm->tm_mon + 1, d = tm->tm_mday; |
9f4f4ca9f7b5
simpler strptime - added os_support.[ch] - moved localtime_r to os_support.c
bellard
parents:
229
diff
changeset
|
49 |
9f4f4ca9f7b5
simpler strptime - added os_support.[ch] - moved localtime_r to os_support.c
bellard
parents:
229
diff
changeset
|
50 if (m < 3) { |
9f4f4ca9f7b5
simpler strptime - added os_support.[ch] - moved localtime_r to os_support.c
bellard
parents:
229
diff
changeset
|
51 m += 12; |
9f4f4ca9f7b5
simpler strptime - added os_support.[ch] - moved localtime_r to os_support.c
bellard
parents:
229
diff
changeset
|
52 y--; |
9f4f4ca9f7b5
simpler strptime - added os_support.[ch] - moved localtime_r to os_support.c
bellard
parents:
229
diff
changeset
|
53 } |
9f4f4ca9f7b5
simpler strptime - added os_support.[ch] - moved localtime_r to os_support.c
bellard
parents:
229
diff
changeset
|
54 |
885 | 55 t = 86400 * |
230
9f4f4ca9f7b5
simpler strptime - added os_support.[ch] - moved localtime_r to os_support.c
bellard
parents:
229
diff
changeset
|
56 (d + (153 * m - 457) / 5 + 365 * y + y / 4 - y / 100 + y / 400 - 719469); |
9f4f4ca9f7b5
simpler strptime - added os_support.[ch] - moved localtime_r to os_support.c
bellard
parents:
229
diff
changeset
|
57 |
9f4f4ca9f7b5
simpler strptime - added os_support.[ch] - moved localtime_r to os_support.c
bellard
parents:
229
diff
changeset
|
58 t += 3600 * tm->tm_hour + 60 * tm->tm_min + tm->tm_sec; |
9f4f4ca9f7b5
simpler strptime - added os_support.[ch] - moved localtime_r to os_support.c
bellard
parents:
229
diff
changeset
|
59 |
9f4f4ca9f7b5
simpler strptime - added os_support.[ch] - moved localtime_r to os_support.c
bellard
parents:
229
diff
changeset
|
60 return t; |
9f4f4ca9f7b5
simpler strptime - added os_support.[ch] - moved localtime_r to os_support.c
bellard
parents:
229
diff
changeset
|
61 } |
9f4f4ca9f7b5
simpler strptime - added os_support.[ch] - moved localtime_r to os_support.c
bellard
parents:
229
diff
changeset
|
62 |
515
ad72189eec07
* replacing calls to not-always-available gmtime_r with our own code.
romansh
parents:
230
diff
changeset
|
63 #define ISLEAP(y) (((y) % 4 == 0) && (((y) % 100) != 0 || ((y) % 400) == 0)) |
ad72189eec07
* replacing calls to not-always-available gmtime_r with our own code.
romansh
parents:
230
diff
changeset
|
64 #define LEAPS_COUNT(y) ((y)/4 - (y)/100 + (y)/400) |
ad72189eec07
* replacing calls to not-always-available gmtime_r with our own code.
romansh
parents:
230
diff
changeset
|
65 |
2213 | 66 /* This is our own gmtime_r. It differs from its POSIX counterpart in a |
515
ad72189eec07
* replacing calls to not-always-available gmtime_r with our own code.
romansh
parents:
230
diff
changeset
|
67 couple of places, though. */ |
ad72189eec07
* replacing calls to not-always-available gmtime_r with our own code.
romansh
parents:
230
diff
changeset
|
68 struct tm *brktimegm(time_t secs, struct tm *tm) |
885 | 69 { |
515
ad72189eec07
* replacing calls to not-always-available gmtime_r with our own code.
romansh
parents:
230
diff
changeset
|
70 int days, y, ny, m; |
ad72189eec07
* replacing calls to not-always-available gmtime_r with our own code.
romansh
parents:
230
diff
changeset
|
71 int md[] = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 }; |
ad72189eec07
* replacing calls to not-always-available gmtime_r with our own code.
romansh
parents:
230
diff
changeset
|
72 |
ad72189eec07
* replacing calls to not-always-available gmtime_r with our own code.
romansh
parents:
230
diff
changeset
|
73 days = secs / 86400; |
ad72189eec07
* replacing calls to not-always-available gmtime_r with our own code.
romansh
parents:
230
diff
changeset
|
74 secs %= 86400; |
ad72189eec07
* replacing calls to not-always-available gmtime_r with our own code.
romansh
parents:
230
diff
changeset
|
75 tm->tm_hour = secs / 3600; |
ad72189eec07
* replacing calls to not-always-available gmtime_r with our own code.
romansh
parents:
230
diff
changeset
|
76 tm->tm_min = (secs % 3600) / 60; |
ad72189eec07
* replacing calls to not-always-available gmtime_r with our own code.
romansh
parents:
230
diff
changeset
|
77 tm->tm_sec = secs % 60; |
ad72189eec07
* replacing calls to not-always-available gmtime_r with our own code.
romansh
parents:
230
diff
changeset
|
78 |
ad72189eec07
* replacing calls to not-always-available gmtime_r with our own code.
romansh
parents:
230
diff
changeset
|
79 /* oh well, may be someone some day will invent a formula for this stuff */ |
ad72189eec07
* replacing calls to not-always-available gmtime_r with our own code.
romansh
parents:
230
diff
changeset
|
80 y = 1970; /* start "guessing" */ |
3306
4d73d137f64e
Do not loop endlessly if converting into dv with timestamps Jan 1st not
cehoyos
parents:
3249
diff
changeset
|
81 while (days > 365) { |
887 | 82 ny = (y + days/366); |
83 days -= (ny - y) * 365 + LEAPS_COUNT(ny - 1) - LEAPS_COUNT(y - 1); | |
84 y = ny; | |
515
ad72189eec07
* replacing calls to not-always-available gmtime_r with our own code.
romansh
parents:
230
diff
changeset
|
85 } |
3306
4d73d137f64e
Do not loop endlessly if converting into dv with timestamps Jan 1st not
cehoyos
parents:
3249
diff
changeset
|
86 if (days==365 && !ISLEAP(y)) { days=0; y++; } |
515
ad72189eec07
* replacing calls to not-always-available gmtime_r with our own code.
romansh
parents:
230
diff
changeset
|
87 md[1] = ISLEAP(y)?29:28; |
ad72189eec07
* replacing calls to not-always-available gmtime_r with our own code.
romansh
parents:
230
diff
changeset
|
88 for (m=0; days >= md[m]; m++) |
887 | 89 days -= md[m]; |
515
ad72189eec07
* replacing calls to not-always-available gmtime_r with our own code.
romansh
parents:
230
diff
changeset
|
90 |
ad72189eec07
* replacing calls to not-always-available gmtime_r with our own code.
romansh
parents:
230
diff
changeset
|
91 tm->tm_year = y; /* unlike gmtime_r we store complete year here */ |
ad72189eec07
* replacing calls to not-always-available gmtime_r with our own code.
romansh
parents:
230
diff
changeset
|
92 tm->tm_mon = m+1; /* unlike gmtime_r tm_mon is from 1 to 12 */ |
ad72189eec07
* replacing calls to not-always-available gmtime_r with our own code.
romansh
parents:
230
diff
changeset
|
93 tm->tm_mday = days+1; |
ad72189eec07
* replacing calls to not-always-available gmtime_r with our own code.
romansh
parents:
230
diff
changeset
|
94 |
ad72189eec07
* replacing calls to not-always-available gmtime_r with our own code.
romansh
parents:
230
diff
changeset
|
95 return tm; |
ad72189eec07
* replacing calls to not-always-available gmtime_r with our own code.
romansh
parents:
230
diff
changeset
|
96 } |
ad72189eec07
* replacing calls to not-always-available gmtime_r with our own code.
romansh
parents:
230
diff
changeset
|
97 |
230
9f4f4ca9f7b5
simpler strptime - added os_support.[ch] - moved localtime_r to os_support.c
bellard
parents:
229
diff
changeset
|
98 /* get a positive number between n_min and n_max, for a maximum length |
9f4f4ca9f7b5
simpler strptime - added os_support.[ch] - moved localtime_r to os_support.c
bellard
parents:
229
diff
changeset
|
99 of len_max. Return -1 if error. */ |
9f4f4ca9f7b5
simpler strptime - added os_support.[ch] - moved localtime_r to os_support.c
bellard
parents:
229
diff
changeset
|
100 static int date_get_num(const char **pp, |
9f4f4ca9f7b5
simpler strptime - added os_support.[ch] - moved localtime_r to os_support.c
bellard
parents:
229
diff
changeset
|
101 int n_min, int n_max, int len_max) |
9f4f4ca9f7b5
simpler strptime - added os_support.[ch] - moved localtime_r to os_support.c
bellard
parents:
229
diff
changeset
|
102 { |
9f4f4ca9f7b5
simpler strptime - added os_support.[ch] - moved localtime_r to os_support.c
bellard
parents:
229
diff
changeset
|
103 int i, val, c; |
9f4f4ca9f7b5
simpler strptime - added os_support.[ch] - moved localtime_r to os_support.c
bellard
parents:
229
diff
changeset
|
104 const char *p; |
9f4f4ca9f7b5
simpler strptime - added os_support.[ch] - moved localtime_r to os_support.c
bellard
parents:
229
diff
changeset
|
105 |
9f4f4ca9f7b5
simpler strptime - added os_support.[ch] - moved localtime_r to os_support.c
bellard
parents:
229
diff
changeset
|
106 p = *pp; |
9f4f4ca9f7b5
simpler strptime - added os_support.[ch] - moved localtime_r to os_support.c
bellard
parents:
229
diff
changeset
|
107 val = 0; |
9f4f4ca9f7b5
simpler strptime - added os_support.[ch] - moved localtime_r to os_support.c
bellard
parents:
229
diff
changeset
|
108 for(i = 0; i < len_max; i++) { |
9f4f4ca9f7b5
simpler strptime - added os_support.[ch] - moved localtime_r to os_support.c
bellard
parents:
229
diff
changeset
|
109 c = *p; |
9f4f4ca9f7b5
simpler strptime - added os_support.[ch] - moved localtime_r to os_support.c
bellard
parents:
229
diff
changeset
|
110 if (!isdigit(c)) |
9f4f4ca9f7b5
simpler strptime - added os_support.[ch] - moved localtime_r to os_support.c
bellard
parents:
229
diff
changeset
|
111 break; |
9f4f4ca9f7b5
simpler strptime - added os_support.[ch] - moved localtime_r to os_support.c
bellard
parents:
229
diff
changeset
|
112 val = (val * 10) + c - '0'; |
9f4f4ca9f7b5
simpler strptime - added os_support.[ch] - moved localtime_r to os_support.c
bellard
parents:
229
diff
changeset
|
113 p++; |
9f4f4ca9f7b5
simpler strptime - added os_support.[ch] - moved localtime_r to os_support.c
bellard
parents:
229
diff
changeset
|
114 } |
9f4f4ca9f7b5
simpler strptime - added os_support.[ch] - moved localtime_r to os_support.c
bellard
parents:
229
diff
changeset
|
115 /* no number read ? */ |
9f4f4ca9f7b5
simpler strptime - added os_support.[ch] - moved localtime_r to os_support.c
bellard
parents:
229
diff
changeset
|
116 if (p == *pp) |
9f4f4ca9f7b5
simpler strptime - added os_support.[ch] - moved localtime_r to os_support.c
bellard
parents:
229
diff
changeset
|
117 return -1; |
9f4f4ca9f7b5
simpler strptime - added os_support.[ch] - moved localtime_r to os_support.c
bellard
parents:
229
diff
changeset
|
118 if (val < n_min || val > n_max) |
9f4f4ca9f7b5
simpler strptime - added os_support.[ch] - moved localtime_r to os_support.c
bellard
parents:
229
diff
changeset
|
119 return -1; |
9f4f4ca9f7b5
simpler strptime - added os_support.[ch] - moved localtime_r to os_support.c
bellard
parents:
229
diff
changeset
|
120 *pp = p; |
9f4f4ca9f7b5
simpler strptime - added os_support.[ch] - moved localtime_r to os_support.c
bellard
parents:
229
diff
changeset
|
121 return val; |
9f4f4ca9f7b5
simpler strptime - added os_support.[ch] - moved localtime_r to os_support.c
bellard
parents:
229
diff
changeset
|
122 } |
9f4f4ca9f7b5
simpler strptime - added os_support.[ch] - moved localtime_r to os_support.c
bellard
parents:
229
diff
changeset
|
123 |
9f4f4ca9f7b5
simpler strptime - added os_support.[ch] - moved localtime_r to os_support.c
bellard
parents:
229
diff
changeset
|
124 /* small strptime for ffmpeg */ |
885 | 125 const char *small_strptime(const char *p, const char *fmt, |
230
9f4f4ca9f7b5
simpler strptime - added os_support.[ch] - moved localtime_r to os_support.c
bellard
parents:
229
diff
changeset
|
126 struct tm *dt) |
9f4f4ca9f7b5
simpler strptime - added os_support.[ch] - moved localtime_r to os_support.c
bellard
parents:
229
diff
changeset
|
127 { |
9f4f4ca9f7b5
simpler strptime - added os_support.[ch] - moved localtime_r to os_support.c
bellard
parents:
229
diff
changeset
|
128 int c, val; |
9f4f4ca9f7b5
simpler strptime - added os_support.[ch] - moved localtime_r to os_support.c
bellard
parents:
229
diff
changeset
|
129 |
9f4f4ca9f7b5
simpler strptime - added os_support.[ch] - moved localtime_r to os_support.c
bellard
parents:
229
diff
changeset
|
130 for(;;) { |
9f4f4ca9f7b5
simpler strptime - added os_support.[ch] - moved localtime_r to os_support.c
bellard
parents:
229
diff
changeset
|
131 c = *fmt++; |
9f4f4ca9f7b5
simpler strptime - added os_support.[ch] - moved localtime_r to os_support.c
bellard
parents:
229
diff
changeset
|
132 if (c == '\0') { |
9f4f4ca9f7b5
simpler strptime - added os_support.[ch] - moved localtime_r to os_support.c
bellard
parents:
229
diff
changeset
|
133 return p; |
9f4f4ca9f7b5
simpler strptime - added os_support.[ch] - moved localtime_r to os_support.c
bellard
parents:
229
diff
changeset
|
134 } else if (c == '%') { |
9f4f4ca9f7b5
simpler strptime - added os_support.[ch] - moved localtime_r to os_support.c
bellard
parents:
229
diff
changeset
|
135 c = *fmt++; |
9f4f4ca9f7b5
simpler strptime - added os_support.[ch] - moved localtime_r to os_support.c
bellard
parents:
229
diff
changeset
|
136 switch(c) { |
9f4f4ca9f7b5
simpler strptime - added os_support.[ch] - moved localtime_r to os_support.c
bellard
parents:
229
diff
changeset
|
137 case 'H': |
9f4f4ca9f7b5
simpler strptime - added os_support.[ch] - moved localtime_r to os_support.c
bellard
parents:
229
diff
changeset
|
138 val = date_get_num(&p, 0, 23, 2); |
9f4f4ca9f7b5
simpler strptime - added os_support.[ch] - moved localtime_r to os_support.c
bellard
parents:
229
diff
changeset
|
139 if (val == -1) |
9f4f4ca9f7b5
simpler strptime - added os_support.[ch] - moved localtime_r to os_support.c
bellard
parents:
229
diff
changeset
|
140 return NULL; |
9f4f4ca9f7b5
simpler strptime - added os_support.[ch] - moved localtime_r to os_support.c
bellard
parents:
229
diff
changeset
|
141 dt->tm_hour = val; |
9f4f4ca9f7b5
simpler strptime - added os_support.[ch] - moved localtime_r to os_support.c
bellard
parents:
229
diff
changeset
|
142 break; |
9f4f4ca9f7b5
simpler strptime - added os_support.[ch] - moved localtime_r to os_support.c
bellard
parents:
229
diff
changeset
|
143 case 'M': |
9f4f4ca9f7b5
simpler strptime - added os_support.[ch] - moved localtime_r to os_support.c
bellard
parents:
229
diff
changeset
|
144 val = date_get_num(&p, 0, 59, 2); |
9f4f4ca9f7b5
simpler strptime - added os_support.[ch] - moved localtime_r to os_support.c
bellard
parents:
229
diff
changeset
|
145 if (val == -1) |
9f4f4ca9f7b5
simpler strptime - added os_support.[ch] - moved localtime_r to os_support.c
bellard
parents:
229
diff
changeset
|
146 return NULL; |
9f4f4ca9f7b5
simpler strptime - added os_support.[ch] - moved localtime_r to os_support.c
bellard
parents:
229
diff
changeset
|
147 dt->tm_min = val; |
9f4f4ca9f7b5
simpler strptime - added os_support.[ch] - moved localtime_r to os_support.c
bellard
parents:
229
diff
changeset
|
148 break; |
9f4f4ca9f7b5
simpler strptime - added os_support.[ch] - moved localtime_r to os_support.c
bellard
parents:
229
diff
changeset
|
149 case 'S': |
9f4f4ca9f7b5
simpler strptime - added os_support.[ch] - moved localtime_r to os_support.c
bellard
parents:
229
diff
changeset
|
150 val = date_get_num(&p, 0, 59, 2); |
9f4f4ca9f7b5
simpler strptime - added os_support.[ch] - moved localtime_r to os_support.c
bellard
parents:
229
diff
changeset
|
151 if (val == -1) |
9f4f4ca9f7b5
simpler strptime - added os_support.[ch] - moved localtime_r to os_support.c
bellard
parents:
229
diff
changeset
|
152 return NULL; |
9f4f4ca9f7b5
simpler strptime - added os_support.[ch] - moved localtime_r to os_support.c
bellard
parents:
229
diff
changeset
|
153 dt->tm_sec = val; |
9f4f4ca9f7b5
simpler strptime - added os_support.[ch] - moved localtime_r to os_support.c
bellard
parents:
229
diff
changeset
|
154 break; |
9f4f4ca9f7b5
simpler strptime - added os_support.[ch] - moved localtime_r to os_support.c
bellard
parents:
229
diff
changeset
|
155 case 'Y': |
9f4f4ca9f7b5
simpler strptime - added os_support.[ch] - moved localtime_r to os_support.c
bellard
parents:
229
diff
changeset
|
156 val = date_get_num(&p, 0, 9999, 4); |
9f4f4ca9f7b5
simpler strptime - added os_support.[ch] - moved localtime_r to os_support.c
bellard
parents:
229
diff
changeset
|
157 if (val == -1) |
9f4f4ca9f7b5
simpler strptime - added os_support.[ch] - moved localtime_r to os_support.c
bellard
parents:
229
diff
changeset
|
158 return NULL; |
9f4f4ca9f7b5
simpler strptime - added os_support.[ch] - moved localtime_r to os_support.c
bellard
parents:
229
diff
changeset
|
159 dt->tm_year = val - 1900; |
9f4f4ca9f7b5
simpler strptime - added os_support.[ch] - moved localtime_r to os_support.c
bellard
parents:
229
diff
changeset
|
160 break; |
9f4f4ca9f7b5
simpler strptime - added os_support.[ch] - moved localtime_r to os_support.c
bellard
parents:
229
diff
changeset
|
161 case 'm': |
9f4f4ca9f7b5
simpler strptime - added os_support.[ch] - moved localtime_r to os_support.c
bellard
parents:
229
diff
changeset
|
162 val = date_get_num(&p, 1, 12, 2); |
9f4f4ca9f7b5
simpler strptime - added os_support.[ch] - moved localtime_r to os_support.c
bellard
parents:
229
diff
changeset
|
163 if (val == -1) |
9f4f4ca9f7b5
simpler strptime - added os_support.[ch] - moved localtime_r to os_support.c
bellard
parents:
229
diff
changeset
|
164 return NULL; |
9f4f4ca9f7b5
simpler strptime - added os_support.[ch] - moved localtime_r to os_support.c
bellard
parents:
229
diff
changeset
|
165 dt->tm_mon = val - 1; |
9f4f4ca9f7b5
simpler strptime - added os_support.[ch] - moved localtime_r to os_support.c
bellard
parents:
229
diff
changeset
|
166 break; |
9f4f4ca9f7b5
simpler strptime - added os_support.[ch] - moved localtime_r to os_support.c
bellard
parents:
229
diff
changeset
|
167 case 'd': |
9f4f4ca9f7b5
simpler strptime - added os_support.[ch] - moved localtime_r to os_support.c
bellard
parents:
229
diff
changeset
|
168 val = date_get_num(&p, 1, 31, 2); |
9f4f4ca9f7b5
simpler strptime - added os_support.[ch] - moved localtime_r to os_support.c
bellard
parents:
229
diff
changeset
|
169 if (val == -1) |
9f4f4ca9f7b5
simpler strptime - added os_support.[ch] - moved localtime_r to os_support.c
bellard
parents:
229
diff
changeset
|
170 return NULL; |
9f4f4ca9f7b5
simpler strptime - added os_support.[ch] - moved localtime_r to os_support.c
bellard
parents:
229
diff
changeset
|
171 dt->tm_mday = val; |
9f4f4ca9f7b5
simpler strptime - added os_support.[ch] - moved localtime_r to os_support.c
bellard
parents:
229
diff
changeset
|
172 break; |
9f4f4ca9f7b5
simpler strptime - added os_support.[ch] - moved localtime_r to os_support.c
bellard
parents:
229
diff
changeset
|
173 case '%': |
9f4f4ca9f7b5
simpler strptime - added os_support.[ch] - moved localtime_r to os_support.c
bellard
parents:
229
diff
changeset
|
174 goto match; |
9f4f4ca9f7b5
simpler strptime - added os_support.[ch] - moved localtime_r to os_support.c
bellard
parents:
229
diff
changeset
|
175 default: |
9f4f4ca9f7b5
simpler strptime - added os_support.[ch] - moved localtime_r to os_support.c
bellard
parents:
229
diff
changeset
|
176 return NULL; |
9f4f4ca9f7b5
simpler strptime - added os_support.[ch] - moved localtime_r to os_support.c
bellard
parents:
229
diff
changeset
|
177 } |
9f4f4ca9f7b5
simpler strptime - added os_support.[ch] - moved localtime_r to os_support.c
bellard
parents:
229
diff
changeset
|
178 } else { |
9f4f4ca9f7b5
simpler strptime - added os_support.[ch] - moved localtime_r to os_support.c
bellard
parents:
229
diff
changeset
|
179 match: |
9f4f4ca9f7b5
simpler strptime - added os_support.[ch] - moved localtime_r to os_support.c
bellard
parents:
229
diff
changeset
|
180 if (c != *p) |
9f4f4ca9f7b5
simpler strptime - added os_support.[ch] - moved localtime_r to os_support.c
bellard
parents:
229
diff
changeset
|
181 return NULL; |
9f4f4ca9f7b5
simpler strptime - added os_support.[ch] - moved localtime_r to os_support.c
bellard
parents:
229
diff
changeset
|
182 p++; |
9f4f4ca9f7b5
simpler strptime - added os_support.[ch] - moved localtime_r to os_support.c
bellard
parents:
229
diff
changeset
|
183 } |
9f4f4ca9f7b5
simpler strptime - added os_support.[ch] - moved localtime_r to os_support.c
bellard
parents:
229
diff
changeset
|
184 } |
9f4f4ca9f7b5
simpler strptime - added os_support.[ch] - moved localtime_r to os_support.c
bellard
parents:
229
diff
changeset
|
185 return p; |
9f4f4ca9f7b5
simpler strptime - added os_support.[ch] - moved localtime_r to os_support.c
bellard
parents:
229
diff
changeset
|
186 } |
9f4f4ca9f7b5
simpler strptime - added os_support.[ch] - moved localtime_r to os_support.c
bellard
parents:
229
diff
changeset
|
187 |