Mercurial > libavformat.hg
annotate cutils.c @ 2229:4db0808c3f91 libavformat
ogm: don't use deprecated codec_get_{bmp,wav}_id()
author | mru |
---|---|
date | Sun, 08 Jul 2007 01:41:09 +0000 |
parents | 835de8466c39 |
children | bda0941921fe |
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" | |
22 | |
151 | 23 /* add one element to a dynamic array */ |
24 void __dynarray_add(unsigned long **tab_ptr, int *nb_ptr, unsigned long elem) | |
25 { | |
26 int nb, nb_alloc; | |
27 unsigned long *tab; | |
28 | |
29 nb = *nb_ptr; | |
30 tab = *tab_ptr; | |
31 if ((nb & (nb - 1)) == 0) { | |
32 if (nb == 0) | |
33 nb_alloc = 1; | |
34 else | |
35 nb_alloc = nb * 2; | |
36 tab = av_realloc(tab, nb_alloc * sizeof(unsigned long)); | |
37 *tab_ptr = tab; | |
38 } | |
39 tab[nb++] = elem; | |
40 *nb_ptr = nb; | |
41 } | |
42 | |
230
9f4f4ca9f7b5
simpler strptime - added os_support.[ch] - moved localtime_r to os_support.c
bellard
parents:
229
diff
changeset
|
43 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
|
44 { |
9f4f4ca9f7b5
simpler strptime - added os_support.[ch] - moved localtime_r to os_support.c
bellard
parents:
229
diff
changeset
|
45 time_t t; |
9f4f4ca9f7b5
simpler strptime - added os_support.[ch] - moved localtime_r to os_support.c
bellard
parents:
229
diff
changeset
|
46 |
9f4f4ca9f7b5
simpler strptime - added os_support.[ch] - moved localtime_r to os_support.c
bellard
parents:
229
diff
changeset
|
47 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
|
48 |
9f4f4ca9f7b5
simpler strptime - added os_support.[ch] - moved localtime_r to os_support.c
bellard
parents:
229
diff
changeset
|
49 if (m < 3) { |
9f4f4ca9f7b5
simpler strptime - added os_support.[ch] - moved localtime_r to os_support.c
bellard
parents:
229
diff
changeset
|
50 m += 12; |
9f4f4ca9f7b5
simpler strptime - added os_support.[ch] - moved localtime_r to os_support.c
bellard
parents:
229
diff
changeset
|
51 y--; |
9f4f4ca9f7b5
simpler strptime - added os_support.[ch] - moved localtime_r to os_support.c
bellard
parents:
229
diff
changeset
|
52 } |
9f4f4ca9f7b5
simpler strptime - added os_support.[ch] - moved localtime_r to os_support.c
bellard
parents:
229
diff
changeset
|
53 |
885 | 54 t = 86400 * |
230
9f4f4ca9f7b5
simpler strptime - added os_support.[ch] - moved localtime_r to os_support.c
bellard
parents:
229
diff
changeset
|
55 (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
|
56 |
9f4f4ca9f7b5
simpler strptime - added os_support.[ch] - moved localtime_r to os_support.c
bellard
parents:
229
diff
changeset
|
57 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
|
58 |
9f4f4ca9f7b5
simpler strptime - added os_support.[ch] - moved localtime_r to os_support.c
bellard
parents:
229
diff
changeset
|
59 return t; |
9f4f4ca9f7b5
simpler strptime - added os_support.[ch] - moved localtime_r to os_support.c
bellard
parents:
229
diff
changeset
|
60 } |
9f4f4ca9f7b5
simpler strptime - added os_support.[ch] - moved localtime_r to os_support.c
bellard
parents:
229
diff
changeset
|
61 |
515
ad72189eec07
* replacing calls to not-always-available gmtime_r with our own code.
romansh
parents:
230
diff
changeset
|
62 #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
|
63 #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
|
64 |
2213 | 65 /* 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
|
66 couple of places, though. */ |
ad72189eec07
* replacing calls to not-always-available gmtime_r with our own code.
romansh
parents:
230
diff
changeset
|
67 struct tm *brktimegm(time_t secs, struct tm *tm) |
885 | 68 { |
515
ad72189eec07
* replacing calls to not-always-available gmtime_r with our own code.
romansh
parents:
230
diff
changeset
|
69 int days, y, ny, m; |
ad72189eec07
* replacing calls to not-always-available gmtime_r with our own code.
romansh
parents:
230
diff
changeset
|
70 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
|
71 |
ad72189eec07
* replacing calls to not-always-available gmtime_r with our own code.
romansh
parents:
230
diff
changeset
|
72 days = secs / 86400; |
ad72189eec07
* replacing calls to not-always-available gmtime_r with our own code.
romansh
parents:
230
diff
changeset
|
73 secs %= 86400; |
ad72189eec07
* replacing calls to not-always-available gmtime_r with our own code.
romansh
parents:
230
diff
changeset
|
74 tm->tm_hour = secs / 3600; |
ad72189eec07
* replacing calls to not-always-available gmtime_r with our own code.
romansh
parents:
230
diff
changeset
|
75 tm->tm_min = (secs % 3600) / 60; |
ad72189eec07
* replacing calls to not-always-available gmtime_r with our own code.
romansh
parents:
230
diff
changeset
|
76 tm->tm_sec = secs % 60; |
ad72189eec07
* replacing calls to not-always-available gmtime_r with our own code.
romansh
parents:
230
diff
changeset
|
77 |
ad72189eec07
* replacing calls to not-always-available gmtime_r with our own code.
romansh
parents:
230
diff
changeset
|
78 /* 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
|
79 y = 1970; /* start "guessing" */ |
ad72189eec07
* replacing calls to not-always-available gmtime_r with our own code.
romansh
parents:
230
diff
changeset
|
80 while (days >= (ISLEAP(y)?366:365)) { |
887 | 81 ny = (y + days/366); |
82 days -= (ny - y) * 365 + LEAPS_COUNT(ny - 1) - LEAPS_COUNT(y - 1); | |
83 y = ny; | |
515
ad72189eec07
* replacing calls to not-always-available gmtime_r with our own code.
romansh
parents:
230
diff
changeset
|
84 } |
ad72189eec07
* replacing calls to not-always-available gmtime_r with our own code.
romansh
parents:
230
diff
changeset
|
85 md[1] = ISLEAP(y)?29:28; |
ad72189eec07
* replacing calls to not-always-available gmtime_r with our own code.
romansh
parents:
230
diff
changeset
|
86 for (m=0; days >= md[m]; m++) |
887 | 87 days -= md[m]; |
515
ad72189eec07
* replacing calls to not-always-available gmtime_r with our own code.
romansh
parents:
230
diff
changeset
|
88 |
ad72189eec07
* replacing calls to not-always-available gmtime_r with our own code.
romansh
parents:
230
diff
changeset
|
89 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
|
90 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
|
91 tm->tm_mday = days+1; |
ad72189eec07
* replacing calls to not-always-available gmtime_r with our own code.
romansh
parents:
230
diff
changeset
|
92 |
ad72189eec07
* replacing calls to not-always-available gmtime_r with our own code.
romansh
parents:
230
diff
changeset
|
93 return tm; |
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 |
230
9f4f4ca9f7b5
simpler strptime - added os_support.[ch] - moved localtime_r to os_support.c
bellard
parents:
229
diff
changeset
|
96 /* 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
|
97 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
|
98 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
|
99 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
|
100 { |
9f4f4ca9f7b5
simpler strptime - added os_support.[ch] - moved localtime_r to os_support.c
bellard
parents:
229
diff
changeset
|
101 int i, val, c; |
9f4f4ca9f7b5
simpler strptime - added os_support.[ch] - moved localtime_r to os_support.c
bellard
parents:
229
diff
changeset
|
102 const char *p; |
9f4f4ca9f7b5
simpler strptime - added os_support.[ch] - moved localtime_r to os_support.c
bellard
parents:
229
diff
changeset
|
103 |
9f4f4ca9f7b5
simpler strptime - added os_support.[ch] - moved localtime_r to os_support.c
bellard
parents:
229
diff
changeset
|
104 p = *pp; |
9f4f4ca9f7b5
simpler strptime - added os_support.[ch] - moved localtime_r to os_support.c
bellard
parents:
229
diff
changeset
|
105 val = 0; |
9f4f4ca9f7b5
simpler strptime - added os_support.[ch] - moved localtime_r to os_support.c
bellard
parents:
229
diff
changeset
|
106 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
|
107 c = *p; |
9f4f4ca9f7b5
simpler strptime - added os_support.[ch] - moved localtime_r to os_support.c
bellard
parents:
229
diff
changeset
|
108 if (!isdigit(c)) |
9f4f4ca9f7b5
simpler strptime - added os_support.[ch] - moved localtime_r to os_support.c
bellard
parents:
229
diff
changeset
|
109 break; |
9f4f4ca9f7b5
simpler strptime - added os_support.[ch] - moved localtime_r to os_support.c
bellard
parents:
229
diff
changeset
|
110 val = (val * 10) + c - '0'; |
9f4f4ca9f7b5
simpler strptime - added os_support.[ch] - moved localtime_r to os_support.c
bellard
parents:
229
diff
changeset
|
111 p++; |
9f4f4ca9f7b5
simpler strptime - added os_support.[ch] - moved localtime_r to os_support.c
bellard
parents:
229
diff
changeset
|
112 } |
9f4f4ca9f7b5
simpler strptime - added os_support.[ch] - moved localtime_r to os_support.c
bellard
parents:
229
diff
changeset
|
113 /* no number read ? */ |
9f4f4ca9f7b5
simpler strptime - added os_support.[ch] - moved localtime_r to os_support.c
bellard
parents:
229
diff
changeset
|
114 if (p == *pp) |
9f4f4ca9f7b5
simpler strptime - added os_support.[ch] - moved localtime_r to os_support.c
bellard
parents:
229
diff
changeset
|
115 return -1; |
9f4f4ca9f7b5
simpler strptime - added os_support.[ch] - moved localtime_r to os_support.c
bellard
parents:
229
diff
changeset
|
116 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
|
117 return -1; |
9f4f4ca9f7b5
simpler strptime - added os_support.[ch] - moved localtime_r to os_support.c
bellard
parents:
229
diff
changeset
|
118 *pp = p; |
9f4f4ca9f7b5
simpler strptime - added os_support.[ch] - moved localtime_r to os_support.c
bellard
parents:
229
diff
changeset
|
119 return val; |
9f4f4ca9f7b5
simpler strptime - added os_support.[ch] - moved localtime_r to os_support.c
bellard
parents:
229
diff
changeset
|
120 } |
9f4f4ca9f7b5
simpler strptime - added os_support.[ch] - moved localtime_r to os_support.c
bellard
parents:
229
diff
changeset
|
121 |
9f4f4ca9f7b5
simpler strptime - added os_support.[ch] - moved localtime_r to os_support.c
bellard
parents:
229
diff
changeset
|
122 /* small strptime for ffmpeg */ |
885 | 123 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
|
124 struct tm *dt) |
9f4f4ca9f7b5
simpler strptime - added os_support.[ch] - moved localtime_r to os_support.c
bellard
parents:
229
diff
changeset
|
125 { |
9f4f4ca9f7b5
simpler strptime - added os_support.[ch] - moved localtime_r to os_support.c
bellard
parents:
229
diff
changeset
|
126 int c, val; |
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 for(;;) { |
9f4f4ca9f7b5
simpler strptime - added os_support.[ch] - moved localtime_r to os_support.c
bellard
parents:
229
diff
changeset
|
129 c = *fmt++; |
9f4f4ca9f7b5
simpler strptime - added os_support.[ch] - moved localtime_r to os_support.c
bellard
parents:
229
diff
changeset
|
130 if (c == '\0') { |
9f4f4ca9f7b5
simpler strptime - added os_support.[ch] - moved localtime_r to os_support.c
bellard
parents:
229
diff
changeset
|
131 return p; |
9f4f4ca9f7b5
simpler strptime - added os_support.[ch] - moved localtime_r to os_support.c
bellard
parents:
229
diff
changeset
|
132 } else if (c == '%') { |
9f4f4ca9f7b5
simpler strptime - added os_support.[ch] - moved localtime_r to os_support.c
bellard
parents:
229
diff
changeset
|
133 c = *fmt++; |
9f4f4ca9f7b5
simpler strptime - added os_support.[ch] - moved localtime_r to os_support.c
bellard
parents:
229
diff
changeset
|
134 switch(c) { |
9f4f4ca9f7b5
simpler strptime - added os_support.[ch] - moved localtime_r to os_support.c
bellard
parents:
229
diff
changeset
|
135 case 'H': |
9f4f4ca9f7b5
simpler strptime - added os_support.[ch] - moved localtime_r to os_support.c
bellard
parents:
229
diff
changeset
|
136 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
|
137 if (val == -1) |
9f4f4ca9f7b5
simpler strptime - added os_support.[ch] - moved localtime_r to os_support.c
bellard
parents:
229
diff
changeset
|
138 return NULL; |
9f4f4ca9f7b5
simpler strptime - added os_support.[ch] - moved localtime_r to os_support.c
bellard
parents:
229
diff
changeset
|
139 dt->tm_hour = val; |
9f4f4ca9f7b5
simpler strptime - added os_support.[ch] - moved localtime_r to os_support.c
bellard
parents:
229
diff
changeset
|
140 break; |
9f4f4ca9f7b5
simpler strptime - added os_support.[ch] - moved localtime_r to os_support.c
bellard
parents:
229
diff
changeset
|
141 case 'M': |
9f4f4ca9f7b5
simpler strptime - added os_support.[ch] - moved localtime_r to os_support.c
bellard
parents:
229
diff
changeset
|
142 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
|
143 if (val == -1) |
9f4f4ca9f7b5
simpler strptime - added os_support.[ch] - moved localtime_r to os_support.c
bellard
parents:
229
diff
changeset
|
144 return NULL; |
9f4f4ca9f7b5
simpler strptime - added os_support.[ch] - moved localtime_r to os_support.c
bellard
parents:
229
diff
changeset
|
145 dt->tm_min = val; |
9f4f4ca9f7b5
simpler strptime - added os_support.[ch] - moved localtime_r to os_support.c
bellard
parents:
229
diff
changeset
|
146 break; |
9f4f4ca9f7b5
simpler strptime - added os_support.[ch] - moved localtime_r to os_support.c
bellard
parents:
229
diff
changeset
|
147 case 'S': |
9f4f4ca9f7b5
simpler strptime - added os_support.[ch] - moved localtime_r to os_support.c
bellard
parents:
229
diff
changeset
|
148 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
|
149 if (val == -1) |
9f4f4ca9f7b5
simpler strptime - added os_support.[ch] - moved localtime_r to os_support.c
bellard
parents:
229
diff
changeset
|
150 return NULL; |
9f4f4ca9f7b5
simpler strptime - added os_support.[ch] - moved localtime_r to os_support.c
bellard
parents:
229
diff
changeset
|
151 dt->tm_sec = val; |
9f4f4ca9f7b5
simpler strptime - added os_support.[ch] - moved localtime_r to os_support.c
bellard
parents:
229
diff
changeset
|
152 break; |
9f4f4ca9f7b5
simpler strptime - added os_support.[ch] - moved localtime_r to os_support.c
bellard
parents:
229
diff
changeset
|
153 case 'Y': |
9f4f4ca9f7b5
simpler strptime - added os_support.[ch] - moved localtime_r to os_support.c
bellard
parents:
229
diff
changeset
|
154 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
|
155 if (val == -1) |
9f4f4ca9f7b5
simpler strptime - added os_support.[ch] - moved localtime_r to os_support.c
bellard
parents:
229
diff
changeset
|
156 return NULL; |
9f4f4ca9f7b5
simpler strptime - added os_support.[ch] - moved localtime_r to os_support.c
bellard
parents:
229
diff
changeset
|
157 dt->tm_year = val - 1900; |
9f4f4ca9f7b5
simpler strptime - added os_support.[ch] - moved localtime_r to os_support.c
bellard
parents:
229
diff
changeset
|
158 break; |
9f4f4ca9f7b5
simpler strptime - added os_support.[ch] - moved localtime_r to os_support.c
bellard
parents:
229
diff
changeset
|
159 case 'm': |
9f4f4ca9f7b5
simpler strptime - added os_support.[ch] - moved localtime_r to os_support.c
bellard
parents:
229
diff
changeset
|
160 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
|
161 if (val == -1) |
9f4f4ca9f7b5
simpler strptime - added os_support.[ch] - moved localtime_r to os_support.c
bellard
parents:
229
diff
changeset
|
162 return NULL; |
9f4f4ca9f7b5
simpler strptime - added os_support.[ch] - moved localtime_r to os_support.c
bellard
parents:
229
diff
changeset
|
163 dt->tm_mon = val - 1; |
9f4f4ca9f7b5
simpler strptime - added os_support.[ch] - moved localtime_r to os_support.c
bellard
parents:
229
diff
changeset
|
164 break; |
9f4f4ca9f7b5
simpler strptime - added os_support.[ch] - moved localtime_r to os_support.c
bellard
parents:
229
diff
changeset
|
165 case 'd': |
9f4f4ca9f7b5
simpler strptime - added os_support.[ch] - moved localtime_r to os_support.c
bellard
parents:
229
diff
changeset
|
166 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
|
167 if (val == -1) |
9f4f4ca9f7b5
simpler strptime - added os_support.[ch] - moved localtime_r to os_support.c
bellard
parents:
229
diff
changeset
|
168 return NULL; |
9f4f4ca9f7b5
simpler strptime - added os_support.[ch] - moved localtime_r to os_support.c
bellard
parents:
229
diff
changeset
|
169 dt->tm_mday = val; |
9f4f4ca9f7b5
simpler strptime - added os_support.[ch] - moved localtime_r to os_support.c
bellard
parents:
229
diff
changeset
|
170 break; |
9f4f4ca9f7b5
simpler strptime - added os_support.[ch] - moved localtime_r to os_support.c
bellard
parents:
229
diff
changeset
|
171 case '%': |
9f4f4ca9f7b5
simpler strptime - added os_support.[ch] - moved localtime_r to os_support.c
bellard
parents:
229
diff
changeset
|
172 goto match; |
9f4f4ca9f7b5
simpler strptime - added os_support.[ch] - moved localtime_r to os_support.c
bellard
parents:
229
diff
changeset
|
173 default: |
9f4f4ca9f7b5
simpler strptime - added os_support.[ch] - moved localtime_r to os_support.c
bellard
parents:
229
diff
changeset
|
174 return NULL; |
9f4f4ca9f7b5
simpler strptime - added os_support.[ch] - moved localtime_r to os_support.c
bellard
parents:
229
diff
changeset
|
175 } |
9f4f4ca9f7b5
simpler strptime - added os_support.[ch] - moved localtime_r to os_support.c
bellard
parents:
229
diff
changeset
|
176 } else { |
9f4f4ca9f7b5
simpler strptime - added os_support.[ch] - moved localtime_r to os_support.c
bellard
parents:
229
diff
changeset
|
177 match: |
9f4f4ca9f7b5
simpler strptime - added os_support.[ch] - moved localtime_r to os_support.c
bellard
parents:
229
diff
changeset
|
178 if (c != *p) |
9f4f4ca9f7b5
simpler strptime - added os_support.[ch] - moved localtime_r to os_support.c
bellard
parents:
229
diff
changeset
|
179 return NULL; |
9f4f4ca9f7b5
simpler strptime - added os_support.[ch] - moved localtime_r to os_support.c
bellard
parents:
229
diff
changeset
|
180 p++; |
9f4f4ca9f7b5
simpler strptime - added os_support.[ch] - moved localtime_r to os_support.c
bellard
parents:
229
diff
changeset
|
181 } |
9f4f4ca9f7b5
simpler strptime - added os_support.[ch] - moved localtime_r to os_support.c
bellard
parents:
229
diff
changeset
|
182 } |
9f4f4ca9f7b5
simpler strptime - added os_support.[ch] - moved localtime_r to os_support.c
bellard
parents:
229
diff
changeset
|
183 return p; |
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 |