Lines Matching refs:tzf

94 static int read_php_preamble(const unsigned char **tzf, timelib_tzinfo *tz)  in read_php_preamble()  argument
99 version = (*tzf)[3] - '0'; in read_php_preamble()
100 *tzf += 4; in read_php_preamble()
103 tz->bc = (**tzf == '\1'); in read_php_preamble()
104 *tzf += 1; in read_php_preamble()
107 memcpy(tz->location.country_code, *tzf, 2); in read_php_preamble()
109 *tzf += 2; in read_php_preamble()
112 *tzf += 13; in read_php_preamble()
117 static int read_tzif_preamble(const unsigned char **tzf, timelib_tzinfo *tz) in read_tzif_preamble() argument
122 switch ((*tzf)[4]) { in read_tzif_preamble()
138 *tzf += 5; in read_tzif_preamble()
147 *tzf += 15; in read_tzif_preamble()
152 static int read_preamble(const unsigned char **tzf, timelib_tzinfo *tz, unsigned int *type) in read_preamble() argument
155 if (memcmp(*tzf, "PHP", 3) == 0) { in read_preamble()
157 return read_php_preamble(tzf, tz); in read_preamble()
158 } else if (memcmp(*tzf, "TZif", 4) == 0) { in read_preamble()
160 return read_tzif_preamble(tzf, tz); in read_preamble()
166 static void read_32bit_header(const unsigned char **tzf, timelib_tzinfo *tz) in read_32bit_header() argument
170 memcpy(&buffer, *tzf, sizeof(buffer)); in read_32bit_header()
178 *tzf += sizeof(buffer); in read_32bit_header()
197 static int read_64bit_transitions(const unsigned char **tzf, timelib_tzinfo *tz) in read_64bit_transitions() argument
208 memcpy(buffer, *tzf, sizeof(int64_t) * tz->bit64.timecnt); in read_64bit_transitions()
209 *tzf += (sizeof(int64_t) * tz->bit64.timecnt); in read_64bit_transitions()
223 memcpy(cbuffer, *tzf, sizeof(unsigned char) * tz->bit64.timecnt); in read_64bit_transitions()
224 *tzf += sizeof(unsigned char) * tz->bit64.timecnt; in read_64bit_transitions()
233 static void skip_32bit_transitions(const unsigned char **tzf, timelib_tzinfo *tz) in skip_32bit_transitions() argument
236 *tzf += (sizeof(int32_t) * tz->_bit32.timecnt); in skip_32bit_transitions()
237 *tzf += sizeof(unsigned char) * tz->_bit32.timecnt; in skip_32bit_transitions()
241 static int read_64bit_types(const unsigned char **tzf, timelib_tzinfo *tz) in read_64bit_types() argument
252 memcpy(buffer, *tzf, sizeof(unsigned char) * 6 * tz->bit64.typecnt); in read_64bit_types()
253 *tzf += sizeof(unsigned char) * 6 * tz->bit64.typecnt; in read_64bit_types()
277 memcpy(tz->timezone_abbr, *tzf, sizeof(char) * tz->bit64.charcnt); in read_64bit_types()
278 *tzf += sizeof(char) * tz->bit64.charcnt; in read_64bit_types()
286 memcpy(leap_buffer, *tzf, tz->bit64.leapcnt * (sizeof(int64_t) + sizeof(int32_t))); in read_64bit_types()
287 *tzf += tz->bit64.leapcnt * (sizeof(int64_t) + sizeof(int32_t)); in read_64bit_types()
307 memcpy(buffer, *tzf, sizeof(unsigned char) * tz->bit64.ttisstdcnt); in read_64bit_types()
308 *tzf += sizeof(unsigned char) * tz->bit64.ttisstdcnt; in read_64bit_types()
322 memcpy(buffer, *tzf, sizeof(unsigned char) * tz->bit64.ttisgmtcnt); in read_64bit_types()
323 *tzf += sizeof(unsigned char) * tz->bit64.ttisgmtcnt; in read_64bit_types()
334 static void skip_32bit_types(const unsigned char **tzf, timelib_tzinfo *tz) in skip_32bit_types() argument
337 *tzf += sizeof(unsigned char) * 6 * tz->_bit32.typecnt; in skip_32bit_types()
340 *tzf += sizeof(char) * tz->_bit32.charcnt; in skip_32bit_types()
344 *tzf += sizeof(int32_t) * tz->_bit32.leapcnt * 2; in skip_32bit_types()
349 *tzf += sizeof(unsigned char) * tz->_bit32.ttisstdcnt; in skip_32bit_types()
354 *tzf += sizeof(unsigned char) * tz->_bit32.ttisgmtcnt; in skip_32bit_types()
358 static void read_posix_string(const unsigned char **tzf, timelib_tzinfo *tz) in read_posix_string() argument
363 (*tzf)++; in read_posix_string()
364 begin = *tzf; in read_posix_string()
366 while (*tzf[0] != '\n') { in read_posix_string()
367 (*tzf)++; in read_posix_string()
370 tz->posix_string = timelib_calloc(1, *tzf - begin + 1); in read_posix_string()
371 memcpy(tz->posix_string, begin, *tzf - begin); in read_posix_string()
374 (*tzf)++; in read_posix_string()
446 static void read_location(const unsigned char **tzf, timelib_tzinfo *tz) in read_location() argument
451 memcpy(&buffer, *tzf, sizeof(buffer)); in read_location()
457 *tzf += sizeof(buffer); in read_location()
460 memcpy(tz->location.comments, *tzf, comments_len); in read_location()
462 *tzf += comments_len; in read_location()
465 static void set_default_location_and_comments(const unsigned char **tzf, timelib_tzinfo *tz) in set_default_location_and_comments() argument
580 static int seek_to_tz_position(const unsigned char **tzf, const char *timezone, const timelib_tzdb … in seek_to_tz_position() argument
597 (*tzf) = &(tzdb->data[tzdb->index[mid].pos]); in seek_to_tz_position()
619 const unsigned char *tzf; in timelib_timezone_id_is_valid() local
620 return (seek_to_tz_position(&tzf, timezone, tzdb)); in timelib_timezone_id_is_valid()
623 static int skip_64bit_preamble(const unsigned char **tzf, timelib_tzinfo *tz) in skip_64bit_preamble() argument
625 if (memcmp(*tzf, "TZif2", 5) == 0) { in skip_64bit_preamble()
626 *tzf += 20; in skip_64bit_preamble()
628 } else if (memcmp(*tzf, "TZif3", 5) == 0) { in skip_64bit_preamble()
629 *tzf += 20; in skip_64bit_preamble()
631 } else if (memcmp(*tzf, "TZif4", 5) == 0) { in skip_64bit_preamble()
632 *tzf += 20; in skip_64bit_preamble()
639 static void read_64bit_header(const unsigned char **tzf, timelib_tzinfo *tz) in read_64bit_header() argument
643 memcpy(&buffer, *tzf, sizeof(buffer)); in read_64bit_header()
650 *tzf += sizeof(buffer); in read_64bit_header()
664 const unsigned char *tzf; in timelib_parse_tzfile() local
672 if (seek_to_tz_position(&tzf, timezone, tzdb)) { in timelib_parse_tzfile()
675 version = read_preamble(&tzf, tmp, &type); in timelib_parse_tzfile()
683 read_32bit_header(&tzf, tmp); in timelib_parse_tzfile()
684 skip_32bit_transitions(&tzf, tmp); in timelib_parse_tzfile()
685 skip_32bit_types(&tzf, tmp); in timelib_parse_tzfile()
687 if (!skip_64bit_preamble(&tzf, tmp)) { in timelib_parse_tzfile()
693 read_64bit_header(&tzf, tmp); in timelib_parse_tzfile()
694 if ((transitions_result = read_64bit_transitions(&tzf, tmp)) != 0) { in timelib_parse_tzfile()
700 if ((types_result = read_64bit_types(&tzf, tmp)) != 0) { in timelib_parse_tzfile()
706 read_posix_string(&tzf, tmp); in timelib_parse_tzfile()
716 read_location(&tzf, tmp); in timelib_parse_tzfile()
718 set_default_location_and_comments(&tzf, tmp); in timelib_parse_tzfile()