Lines Matching refs:tzf

66 static int read_php_preamble(const unsigned char **tzf, timelib_tzinfo *tz)  in read_php_preamble()  argument
71 version = (*tzf)[3] - '0'; in read_php_preamble()
72 *tzf += 4; in read_php_preamble()
75 tz->bc = (**tzf == '\1'); in read_php_preamble()
76 *tzf += 1; in read_php_preamble()
79 memcpy(tz->location.country_code, *tzf, 2); in read_php_preamble()
81 *tzf += 2; in read_php_preamble()
84 *tzf += 13; in read_php_preamble()
89 static int read_tzif_preamble(const unsigned char **tzf, timelib_tzinfo *tz) in read_tzif_preamble() argument
94 switch ((*tzf)[4]) { in read_tzif_preamble()
107 *tzf += 5; in read_tzif_preamble()
116 *tzf += 15; in read_tzif_preamble()
121 static int read_preamble(const unsigned char **tzf, timelib_tzinfo *tz, unsigned int *type) in read_preamble() argument
124 if (memcmp(*tzf, "PHP", 3) == 0) { in read_preamble()
126 return read_php_preamble(tzf, tz); in read_preamble()
127 } else if (memcmp(*tzf, "TZif", 4) == 0) { in read_preamble()
129 return read_tzif_preamble(tzf, tz); in read_preamble()
135 static void read_header(const unsigned char **tzf, timelib_tzinfo *tz) in read_header() argument
139 memcpy(&buffer, *tzf, sizeof(buffer)); in read_header()
146 *tzf += sizeof(buffer); in read_header()
149 static void skip_64bit_transitions(const unsigned char **tzf, timelib_tzinfo *tz) in skip_64bit_transitions() argument
152 *tzf += (sizeof(int64_t) * tz->bit64.timecnt); in skip_64bit_transitions()
153 *tzf += (sizeof(unsigned char) * tz->bit64.timecnt); in skip_64bit_transitions()
157 static int read_transitions(const unsigned char **tzf, timelib_tzinfo *tz) in read_transitions() argument
168 memcpy(buffer, *tzf, sizeof(int32_t) * tz->bit32.timecnt); in read_transitions()
169 *tzf += (sizeof(int32_t) * tz->bit32.timecnt); in read_transitions()
183 memcpy(cbuffer, *tzf, sizeof(unsigned char) * tz->bit32.timecnt); in read_transitions()
184 *tzf += sizeof(unsigned char) * tz->bit32.timecnt; in read_transitions()
193 static void skip_64bit_types(const unsigned char **tzf, timelib_tzinfo *tz) in skip_64bit_types() argument
195 *tzf += sizeof(unsigned char) * 6 * tz->bit64.typecnt; in skip_64bit_types()
196 *tzf += sizeof(char) * tz->bit64.charcnt; in skip_64bit_types()
198 *tzf += sizeof(int64_t) * tz->bit64.leapcnt * 2; in skip_64bit_types()
201 *tzf += sizeof(unsigned char) * tz->bit64.ttisstdcnt; in skip_64bit_types()
204 *tzf += sizeof(unsigned char) * tz->bit64.ttisgmtcnt; in skip_64bit_types()
208 static int read_types(const unsigned char **tzf, timelib_tzinfo *tz) in read_types() argument
218 memcpy(buffer, *tzf, sizeof(unsigned char) * 6 * tz->bit32.typecnt); in read_types()
219 *tzf += sizeof(unsigned char) * 6 * tz->bit32.typecnt; in read_types()
240 memcpy(tz->timezone_abbr, *tzf, sizeof(char) * tz->bit32.charcnt); in read_types()
241 *tzf += sizeof(char) * tz->bit32.charcnt; in read_types()
248 memcpy(leap_buffer, *tzf, sizeof(int32_t) * tz->bit32.leapcnt * 2); in read_types()
249 *tzf += sizeof(int32_t) * tz->bit32.leapcnt * 2; in read_types()
268 memcpy(buffer, *tzf, sizeof(unsigned char) * tz->bit32.ttisstdcnt); in read_types()
269 *tzf += sizeof(unsigned char) * tz->bit32.ttisstdcnt; in read_types()
282 memcpy(buffer, *tzf, sizeof(unsigned char) * tz->bit32.ttisgmtcnt); in read_types()
283 *tzf += sizeof(unsigned char) * tz->bit32.ttisgmtcnt; in read_types()
294 static void skip_posix_string(const unsigned char **tzf, timelib_tzinfo *tz) in skip_posix_string() argument
299 if (*tzf[0] == '\n') { in skip_posix_string()
302 (*tzf)++; in skip_posix_string()
306 static void read_location(const unsigned char **tzf, timelib_tzinfo *tz) in read_location() argument
311 memcpy(&buffer, *tzf, sizeof(buffer)); in read_location()
317 *tzf += sizeof(buffer); in read_location()
320 memcpy(tz->location.comments, *tzf, comments_len); in read_location()
322 *tzf += comments_len; in read_location()
325 static void set_default_location_and_comments(const unsigned char **tzf, timelib_tzinfo *tz) in set_default_location_and_comments() argument
377 static int seek_to_tz_position(const unsigned char **tzf, char *timezone, const timelib_tzdb *tzdb) in seek_to_tz_position() argument
405 (*tzf) = &(tzdb->data[tzdb->index[mid].pos]); in seek_to_tz_position()
435 const unsigned char *tzf; in timelib_timezone_id_is_valid() local
436 return (seek_to_tz_position(&tzf, timezone, tzdb)); in timelib_timezone_id_is_valid()
439 static int skip_64bit_preamble(const unsigned char **tzf, timelib_tzinfo *tz) in skip_64bit_preamble() argument
441 if (memcmp(*tzf, "TZif2", 5) == 0) { in skip_64bit_preamble()
442 *tzf += 20; in skip_64bit_preamble()
444 } else if (memcmp(*tzf, "TZif3", 5) == 0) { in skip_64bit_preamble()
445 *tzf += 20; in skip_64bit_preamble()
452 static void read_64bit_header(const unsigned char **tzf, timelib_tzinfo *tz) in read_64bit_header() argument
456 memcpy(&buffer, *tzf, sizeof(buffer)); in read_64bit_header()
463 *tzf += sizeof(buffer); in read_64bit_header()
477 const unsigned char *tzf; in timelib_parse_tzfile() local
483 if (seek_to_tz_position(&tzf, timezone, tzdb)) { in timelib_parse_tzfile()
486 version = read_preamble(&tzf, tmp, &type); in timelib_parse_tzfile()
494 read_header(&tzf, tmp); in timelib_parse_tzfile()
495 if ((transitions_result = read_transitions(&tzf, tmp)) != 0) { in timelib_parse_tzfile()
501 if ((types_result = read_types(&tzf, tmp)) != 0) { in timelib_parse_tzfile()
507 if (!skip_64bit_preamble(&tzf, tmp)) { in timelib_parse_tzfile()
512 read_64bit_header(&tzf, tmp); in timelib_parse_tzfile()
513 skip_64bit_transitions(&tzf, tmp); in timelib_parse_tzfile()
514 skip_64bit_types(&tzf, tmp); in timelib_parse_tzfile()
515 skip_posix_string(&tzf, tmp); in timelib_parse_tzfile()
519 read_location(&tzf, tmp); in timelib_parse_tzfile()
521 set_default_location_and_comments(&tzf, tmp); in timelib_parse_tzfile()