Lines Matching refs:tzf

87 static int read_php_preamble(const unsigned char **tzf, timelib_tzinfo *tz)  in read_php_preamble()  argument
92 version = (*tzf)[3] - '0'; in read_php_preamble()
93 *tzf += 4; in read_php_preamble()
96 tz->bc = (**tzf == '\1'); in read_php_preamble()
97 *tzf += 1; in read_php_preamble()
100 memcpy(tz->location.country_code, *tzf, 2); in read_php_preamble()
102 *tzf += 2; in read_php_preamble()
105 *tzf += 13; in read_php_preamble()
110 static int read_tzif_preamble(const unsigned char **tzf, timelib_tzinfo *tz) in read_tzif_preamble() argument
115 switch ((*tzf)[4]) { in read_tzif_preamble()
128 *tzf += 5; in read_tzif_preamble()
137 *tzf += 15; in read_tzif_preamble()
142 static int read_preamble(const unsigned char **tzf, timelib_tzinfo *tz, unsigned int *type) in read_preamble() argument
145 if (memcmp(*tzf, "PHP", 3) == 0) { in read_preamble()
147 return read_php_preamble(tzf, tz); in read_preamble()
148 } else if (memcmp(*tzf, "TZif", 4) == 0) { in read_preamble()
150 return read_tzif_preamble(tzf, tz); in read_preamble()
156 static void read_32bit_header(const unsigned char **tzf, timelib_tzinfo *tz) in read_32bit_header() argument
160 memcpy(&buffer, *tzf, sizeof(buffer)); in read_32bit_header()
168 *tzf += sizeof(buffer); in read_32bit_header()
171 static int read_64bit_transitions(const unsigned char **tzf, timelib_tzinfo *tz) in read_64bit_transitions() argument
182 memcpy(buffer, *tzf, sizeof(int64_t) * tz->bit64.timecnt); in read_64bit_transitions()
183 *tzf += (sizeof(int64_t) * tz->bit64.timecnt); in read_64bit_transitions()
197 memcpy(cbuffer, *tzf, sizeof(unsigned char) * tz->bit64.timecnt); in read_64bit_transitions()
198 *tzf += sizeof(unsigned char) * tz->bit64.timecnt; in read_64bit_transitions()
207 static void skip_32bit_transitions(const unsigned char **tzf, timelib_tzinfo *tz) in skip_32bit_transitions() argument
210 *tzf += (sizeof(int32_t) * tz->_bit32.timecnt); in skip_32bit_transitions()
211 *tzf += sizeof(unsigned char) * tz->_bit32.timecnt; in skip_32bit_transitions()
215 static int read_64bit_types(const unsigned char **tzf, timelib_tzinfo *tz) in read_64bit_types() argument
226 memcpy(buffer, *tzf, sizeof(unsigned char) * 6 * tz->bit64.typecnt); in read_64bit_types()
227 *tzf += sizeof(unsigned char) * 6 * tz->bit64.typecnt; in read_64bit_types()
249 memcpy(tz->timezone_abbr, *tzf, sizeof(char) * tz->bit64.charcnt); in read_64bit_types()
250 *tzf += sizeof(char) * tz->bit64.charcnt; in read_64bit_types()
258 memcpy(leap_buffer, *tzf, tz->bit64.leapcnt * (sizeof(int64_t) + sizeof(int32_t))); in read_64bit_types()
259 *tzf += tz->bit64.leapcnt * (sizeof(int64_t) + sizeof(int32_t)); in read_64bit_types()
279 memcpy(buffer, *tzf, sizeof(unsigned char) * tz->bit64.ttisstdcnt); in read_64bit_types()
280 *tzf += sizeof(unsigned char) * tz->bit64.ttisstdcnt; in read_64bit_types()
294 memcpy(buffer, *tzf, sizeof(unsigned char) * tz->bit64.ttisgmtcnt); in read_64bit_types()
295 *tzf += sizeof(unsigned char) * tz->bit64.ttisgmtcnt; in read_64bit_types()
306 static void skip_32bit_types(const unsigned char **tzf, timelib_tzinfo *tz) in skip_32bit_types() argument
309 *tzf += sizeof(unsigned char) * 6 * tz->_bit32.typecnt; in skip_32bit_types()
312 *tzf += sizeof(char) * tz->_bit32.charcnt; in skip_32bit_types()
316 *tzf += sizeof(int32_t) * tz->_bit32.leapcnt * 2; in skip_32bit_types()
321 *tzf += sizeof(unsigned char) * tz->_bit32.ttisstdcnt; in skip_32bit_types()
326 *tzf += sizeof(unsigned char) * tz->_bit32.ttisgmtcnt; in skip_32bit_types()
330 static void skip_posix_string(const unsigned char **tzf, timelib_tzinfo *tz) in skip_posix_string() argument
335 if (*tzf[0] == '\n') { in skip_posix_string()
338 (*tzf)++; in skip_posix_string()
342 static void read_location(const unsigned char **tzf, timelib_tzinfo *tz) in read_location() argument
347 memcpy(&buffer, *tzf, sizeof(buffer)); in read_location()
353 *tzf += sizeof(buffer); in read_location()
356 memcpy(tz->location.comments, *tzf, comments_len); in read_location()
358 *tzf += comments_len; in read_location()
361 static void set_default_location_and_comments(const unsigned char **tzf, timelib_tzinfo *tz) in set_default_location_and_comments() argument
415 static int seek_to_tz_position(const unsigned char **tzf, char *timezone, const timelib_tzdb *tzdb) in seek_to_tz_position() argument
432 (*tzf) = &(tzdb->data[tzdb->index[mid].pos]); in seek_to_tz_position()
454 const unsigned char *tzf; in timelib_timezone_id_is_valid() local
455 return (seek_to_tz_position(&tzf, timezone, tzdb)); in timelib_timezone_id_is_valid()
458 static int skip_64bit_preamble(const unsigned char **tzf, timelib_tzinfo *tz) in skip_64bit_preamble() argument
460 if (memcmp(*tzf, "TZif2", 5) == 0) { in skip_64bit_preamble()
461 *tzf += 20; in skip_64bit_preamble()
463 } else if (memcmp(*tzf, "TZif3", 5) == 0) { in skip_64bit_preamble()
464 *tzf += 20; in skip_64bit_preamble()
471 static void read_64bit_header(const unsigned char **tzf, timelib_tzinfo *tz) in read_64bit_header() argument
475 memcpy(&buffer, *tzf, sizeof(buffer)); in read_64bit_header()
482 *tzf += sizeof(buffer); in read_64bit_header()
496 const unsigned char *tzf; in timelib_parse_tzfile() local
502 if (seek_to_tz_position(&tzf, timezone, tzdb)) { in timelib_parse_tzfile()
505 version = read_preamble(&tzf, tmp, &type); in timelib_parse_tzfile()
513 read_32bit_header(&tzf, tmp); in timelib_parse_tzfile()
514 skip_32bit_transitions(&tzf, tmp); in timelib_parse_tzfile()
515 skip_32bit_types(&tzf, tmp); in timelib_parse_tzfile()
517 if (!skip_64bit_preamble(&tzf, tmp)) { in timelib_parse_tzfile()
523 read_64bit_header(&tzf, tmp); in timelib_parse_tzfile()
524 if ((transitions_result = read_64bit_transitions(&tzf, tmp)) != 0) { in timelib_parse_tzfile()
530 if ((types_result = read_64bit_types(&tzf, tmp)) != 0) { in timelib_parse_tzfile()
535 skip_posix_string(&tzf, tmp); in timelib_parse_tzfile()
538 read_location(&tzf, tmp); in timelib_parse_tzfile()
540 set_default_location_and_comments(&tzf, tmp); in timelib_parse_tzfile()