Skip to content

Commit

Permalink
archiveSize -> archiveInfoSize
Browse files Browse the repository at this point in the history
  • Loading branch information
kisielk committed Aug 8, 2013
1 parent 83cc7ed commit 3656c4b
Showing 1 changed file with 6 additions and 9 deletions.
15 changes: 6 additions & 9 deletions whisper/whisper.go
Original file line number Diff line number Diff line change
Expand Up @@ -169,18 +169,15 @@ type reverseArchive struct{ archive }
// sort.Interface
func (r reverseArchive) Less(i, j int) bool { return r.archive.Less(j, i) }

// some sizes used fo
var pointSize, metadataSize, archiveSize uint32
var (
pointSize = uint32(binary.Size(Point{}))
metadataSize = uint32(binary.Size(Metadata{}))
archiveInfoSize = uint32(binary.Size(ArchiveInfo{}))
)

// a regular expression matching a precision string such as 120y
var precisionRegexp = regexp.MustCompile("^(\\d+)([smhdwy]?)")

func init() {
pointSize = uint32(binary.Size(Point{}))
metadataSize = uint32(binary.Size(Metadata{}))
archiveSize = uint32(binary.Size(ArchiveInfo{}))
}

// Read the header of a whisper database
func readHeader(buf io.ReadSeeker) (header Header, err error) {
currentPos, err := buf.Seek(0, 1)
Expand Down Expand Up @@ -331,7 +328,7 @@ func Create(path string, archives []ArchiveInfo, options CreateOptions) (*Whispe
return nil, err
}

headerSize := metadataSize + (archiveSize * uint32(len(archives)))
headerSize := metadataSize + (archiveInfoSize * uint32(len(archives)))
archiveOffsetPointer := headerSize

for _, archive := range archives {
Expand Down

0 comments on commit 3656c4b

Please sign in to comment.