Lines Matching refs:tzf

93 static int read_php_preamble(const unsigned char **tzf, timelib_tzinfo *tz)  in read_php_preamble()  argument
98 version = (*tzf)[3] - '0'; in read_php_preamble()
99 *tzf += 4; in read_php_preamble()
102 tz->bc = (**tzf == '\1'); in read_php_preamble()
103 *tzf += 1; in read_php_preamble()
106 memcpy(tz->location.country_code, *tzf, 2); in read_php_preamble()
108 *tzf += 2; in read_php_preamble()
111 *tzf += 13; in read_php_preamble()
116 static int read_tzif_preamble(const unsigned char **tzf, timelib_tzinfo *tz) in read_tzif_preamble() argument
121 switch ((*tzf)[4]) { in read_tzif_preamble()
134 *tzf += 5; in read_tzif_preamble()
143 *tzf += 15; in read_tzif_preamble()
148 static int read_preamble(const unsigned char **tzf, timelib_tzinfo *tz, unsigned int *type) in read_preamble() argument
151 if (memcmp(*tzf, "PHP", 3) == 0) { in read_preamble()
153 return read_php_preamble(tzf, tz); in read_preamble()
154 } else if (memcmp(*tzf, "TZif", 4) == 0) { in read_preamble()
156 return read_tzif_preamble(tzf, tz); in read_preamble()
162 static void read_32bit_header(const unsigned char **tzf, timelib_tzinfo *tz) in read_32bit_header() argument
166 memcpy(&buffer, *tzf, sizeof(buffer)); in read_32bit_header()
174 *tzf += sizeof(buffer); in read_32bit_header()
193 static int read_64bit_transitions(const unsigned char **tzf, timelib_tzinfo *tz) in read_64bit_transitions() argument
204 memcpy(buffer, *tzf, sizeof(int64_t) * tz->bit64.timecnt); in read_64bit_transitions()
205 *tzf += (sizeof(int64_t) * tz->bit64.timecnt); in read_64bit_transitions()
219 memcpy(cbuffer, *tzf, sizeof(unsigned char) * tz->bit64.timecnt); in read_64bit_transitions()
220 *tzf += sizeof(unsigned char) * tz->bit64.timecnt; in read_64bit_transitions()
229 static void skip_32bit_transitions(const unsigned char **tzf, timelib_tzinfo *tz) in skip_32bit_transitions() argument
232 *tzf += (sizeof(int32_t) * tz->_bit32.timecnt); in skip_32bit_transitions()
233 *tzf += sizeof(unsigned char) * tz->_bit32.timecnt; in skip_32bit_transitions()
237 static int read_64bit_types(const unsigned char **tzf, timelib_tzinfo *tz) in read_64bit_types() argument
248 memcpy(buffer, *tzf, sizeof(unsigned char) * 6 * tz->bit64.typecnt); in read_64bit_types()
249 *tzf += sizeof(unsigned char) * 6 * tz->bit64.typecnt; in read_64bit_types()
271 memcpy(tz->timezone_abbr, *tzf, sizeof(char) * tz->bit64.charcnt); in read_64bit_types()
272 *tzf += sizeof(char) * tz->bit64.charcnt; in read_64bit_types()
280 memcpy(leap_buffer, *tzf, tz->bit64.leapcnt * (sizeof(int64_t) + sizeof(int32_t))); in read_64bit_types()
281 *tzf += tz->bit64.leapcnt * (sizeof(int64_t) + sizeof(int32_t)); in read_64bit_types()
301 memcpy(buffer, *tzf, sizeof(unsigned char) * tz->bit64.ttisstdcnt); in read_64bit_types()
302 *tzf += sizeof(unsigned char) * tz->bit64.ttisstdcnt; in read_64bit_types()
316 memcpy(buffer, *tzf, sizeof(unsigned char) * tz->bit64.ttisgmtcnt); in read_64bit_types()
317 *tzf += sizeof(unsigned char) * tz->bit64.ttisgmtcnt; in read_64bit_types()
328 static void skip_32bit_types(const unsigned char **tzf, timelib_tzinfo *tz) in skip_32bit_types() argument
331 *tzf += sizeof(unsigned char) * 6 * tz->_bit32.typecnt; in skip_32bit_types()
334 *tzf += sizeof(char) * tz->_bit32.charcnt; in skip_32bit_types()
338 *tzf += sizeof(int32_t) * tz->_bit32.leapcnt * 2; in skip_32bit_types()
343 *tzf += sizeof(unsigned char) * tz->_bit32.ttisstdcnt; in skip_32bit_types()
348 *tzf += sizeof(unsigned char) * tz->_bit32.ttisgmtcnt; in skip_32bit_types()
352 static void skip_posix_string(const unsigned char **tzf, timelib_tzinfo *tz) in skip_posix_string() argument
357 if (*tzf[0] == '\n') { in skip_posix_string()
360 (*tzf)++; in skip_posix_string()
364 static void read_location(const unsigned char **tzf, timelib_tzinfo *tz) in read_location() argument
369 memcpy(&buffer, *tzf, sizeof(buffer)); in read_location()
375 *tzf += sizeof(buffer); in read_location()
378 memcpy(tz->location.comments, *tzf, comments_len); in read_location()
380 *tzf += comments_len; in read_location()
383 static void set_default_location_and_comments(const unsigned char **tzf, timelib_tzinfo *tz) in set_default_location_and_comments() argument
438 static int seek_to_tz_position(const unsigned char **tzf, const char *timezone, const timelib_tzdb … in seek_to_tz_position() argument
455 (*tzf) = &(tzdb->data[tzdb->index[mid].pos]); in seek_to_tz_position()
477 const unsigned char *tzf; in timelib_timezone_id_is_valid() local
478 return (seek_to_tz_position(&tzf, timezone, tzdb)); in timelib_timezone_id_is_valid()
481 static int skip_64bit_preamble(const unsigned char **tzf, timelib_tzinfo *tz) in skip_64bit_preamble() argument
483 if (memcmp(*tzf, "TZif2", 5) == 0) { in skip_64bit_preamble()
484 *tzf += 20; in skip_64bit_preamble()
486 } else if (memcmp(*tzf, "TZif3", 5) == 0) { in skip_64bit_preamble()
487 *tzf += 20; in skip_64bit_preamble()
494 static void read_64bit_header(const unsigned char **tzf, timelib_tzinfo *tz) in read_64bit_header() argument
498 memcpy(&buffer, *tzf, sizeof(buffer)); in read_64bit_header()
505 *tzf += sizeof(buffer); in read_64bit_header()
519 const unsigned char *tzf; in timelib_parse_tzfile() local
527 if (seek_to_tz_position(&tzf, timezone, tzdb)) { in timelib_parse_tzfile()
530 version = read_preamble(&tzf, tmp, &type); in timelib_parse_tzfile()
538 read_32bit_header(&tzf, tmp); in timelib_parse_tzfile()
539 skip_32bit_transitions(&tzf, tmp); in timelib_parse_tzfile()
540 skip_32bit_types(&tzf, tmp); in timelib_parse_tzfile()
546 if (!skip_64bit_preamble(&tzf, tmp)) { in timelib_parse_tzfile()
552 read_64bit_header(&tzf, tmp); in timelib_parse_tzfile()
553 if ((transitions_result = read_64bit_transitions(&tzf, tmp)) != 0) { in timelib_parse_tzfile()
559 if ((types_result = read_64bit_types(&tzf, tmp)) != 0) { in timelib_parse_tzfile()
564 skip_posix_string(&tzf, tmp); in timelib_parse_tzfile()
567 read_location(&tzf, tmp); in timelib_parse_tzfile()
569 set_default_location_and_comments(&tzf, tmp); in timelib_parse_tzfile()