Commit 225a2e12 authored by Russ Cox's avatar Russ Cox Committed by Brad Fitzpatrick

time: rename internal type data to dataIO

This allows LoadTimezoneFromTZData to have a parameter named data.

Change-Id: I11c115745c7f697244f806bcd654f697dab73de1
Reviewed-on: https://go-review.googlesource.com/79017
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
parent 1a7ce9dd
...@@ -33,12 +33,12 @@ const ( ...@@ -33,12 +33,12 @@ const (
) )
// Simple I/O interface to binary blob of data. // Simple I/O interface to binary blob of data.
type data struct { type dataIO struct {
p []byte p []byte
error bool error bool
} }
func (d *data) read(n int) []byte { func (d *dataIO) read(n int) []byte {
if len(d.p) < n { if len(d.p) < n {
d.p = nil d.p = nil
d.error = true d.error = true
...@@ -49,7 +49,7 @@ func (d *data) read(n int) []byte { ...@@ -49,7 +49,7 @@ func (d *data) read(n int) []byte {
return p return p
} }
func (d *data) big4() (n uint32, ok bool) { func (d *dataIO) big4() (n uint32, ok bool) {
p := d.read(4) p := d.read(4)
if len(p) < 4 { if len(p) < 4 {
d.error = true d.error = true
...@@ -58,7 +58,7 @@ func (d *data) big4() (n uint32, ok bool) { ...@@ -58,7 +58,7 @@ func (d *data) big4() (n uint32, ok bool) {
return uint32(p[0])<<24 | uint32(p[1])<<16 | uint32(p[2])<<8 | uint32(p[3]), true return uint32(p[0])<<24 | uint32(p[1])<<16 | uint32(p[2])<<8 | uint32(p[3]), true
} }
func (d *data) byte() (n byte, ok bool) { func (d *dataIO) byte() (n byte, ok bool) {
p := d.read(1) p := d.read(1)
if len(p) < 1 { if len(p) < 1 {
d.error = true d.error = true
...@@ -83,7 +83,7 @@ var badData = errors.New("malformed time zone information") ...@@ -83,7 +83,7 @@ var badData = errors.New("malformed time zone information")
// The expected format for Tzinfo is that of a timezone file as they are found in the // The expected format for Tzinfo is that of a timezone file as they are found in the
// the IANA Time Zone database. // the IANA Time Zone database.
func newLocationFromTzinfo(name string, Tzinfo []byte) (*Location, error) { func newLocationFromTzinfo(name string, Tzinfo []byte) (*Location, error) {
d := data{Tzinfo, false} d := dataIO{Tzinfo, false}
// 4-byte magic "TZif" // 4-byte magic "TZif"
if magic := d.read(4); string(magic) != "TZif" { if magic := d.read(4); string(magic) != "TZif" {
...@@ -121,13 +121,13 @@ func newLocationFromTzinfo(name string, Tzinfo []byte) (*Location, error) { ...@@ -121,13 +121,13 @@ func newLocationFromTzinfo(name string, Tzinfo []byte) (*Location, error) {
} }
// Transition times. // Transition times.
txtimes := data{d.read(n[NTime] * 4), false} txtimes := dataIO{d.read(n[NTime] * 4), false}
// Time zone indices for transition times. // Time zone indices for transition times.
txzones := d.read(n[NTime]) txzones := d.read(n[NTime])
// Zone info structures // Zone info structures
zonedata := data{d.read(n[NZone] * 6), false} zonedata := dataIO{d.read(n[NZone] * 6), false}
// Time zone abbreviations. // Time zone abbreviations.
abbrev := d.read(n[NChar]) abbrev := d.read(n[NChar])
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment