Overview
Comment: | of_strptime: Fix parsing of %b |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
99158f978b5516e3c4c1881948a23e2b |
User & Date: | js on 2016-09-12 00:10:47 |
Other Links: | manifest | tags |
Context
2016-09-12
| ||
00:27 | Add OF_DEALLOC_UNSUPPORTED macro check-in: 13f4c6c678 user: js tags: trunk | |
00:10 | of_strptime: Fix parsing of %b check-in: 99158f978b user: js tags: trunk | |
2016-09-11
| ||
22:23 | OFDate: Throw on trailing garbage check-in: 804f222e18 user: js tags: trunk | |
Changes
Modified src/of_strptime.m from [42f8137e1c] to [af4c98bb9d].
︙ | ︙ | |||
110 111 112 113 114 115 116 | j += 3; break; case 'b': if (bufferLen < j + 3) return NULL; if (memcmp(buffer + j, "Jan", 3) == 0) | | | | | | | | | | | | | | 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 | j += 3; break; case 'b': if (bufferLen < j + 3) return NULL; if (memcmp(buffer + j, "Jan", 3) == 0) tm->tm_mon = 0; else if (memcmp(buffer + j, "Feb", 3) == 0) tm->tm_mon = 1; else if (memcmp(buffer + j, "Mar", 3) == 0) tm->tm_mon = 2; else if (memcmp(buffer + j, "Apr", 3) == 0) tm->tm_mon = 3; else if (memcmp(buffer + j, "May", 3) == 0) tm->tm_mon = 4; else if (memcmp(buffer + j, "Jun", 3) == 0) tm->tm_mon = 5; else if (memcmp(buffer + j, "Jul", 3) == 0) tm->tm_mon = 6; else if (memcmp(buffer + j, "Aug", 3) == 0) tm->tm_mon = 7; else if (memcmp(buffer + j, "Sep", 3) == 0) tm->tm_mon = 8; else if (memcmp(buffer + j, "Oct", 3) == 0) tm->tm_mon = 9; else if (memcmp(buffer + j, "Nov", 3) == 0) tm->tm_mon = 10; else if (memcmp(buffer + j, "Dec", 3) == 0) tm->tm_mon = 11; else return NULL; j += 3; break; case 'd': case 'e': |
︙ | ︙ |
Modified tests/OFDateTests.m from [d9a4b150fe] to [01d830b2c1].
︙ | ︙ | |||
37 38 39 40 41 42 43 | OFDate *d1, *d2; struct tm tm; int16_t tz; const char *dstr = "Wed, 09 Jun 2021 +0200x"; TEST(@"of_strptime()", of_strptime(dstr, "%a, %d %b %Y %z", &tm, &tz) == dstr + 22 && | | | 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 | OFDate *d1, *d2; struct tm tm; int16_t tz; const char *dstr = "Wed, 09 Jun 2021 +0200x"; TEST(@"of_strptime()", of_strptime(dstr, "%a, %d %b %Y %z", &tm, &tz) == dstr + 22 && tm.tm_wday == 3 && tm.tm_mday == 9 && tm.tm_mon == 5 && tm.tm_year == 2021 - 1900 && tz == 2 * 60) TEST(@"+[dateWithTimeIntervalSince1970:]", (d1 = [OFDate dateWithTimeIntervalSince1970: 0])) TEST(@"-[dateByAddingTimeInterval:]", (d2 = [d1 dateByAddingTimeInterval: 3600 * 25 + 5.000002])) |
︙ | ︙ |