Serialize and deserialize matrix representation
diff --git a/datok.go b/datok.go
index 4f7ac6f..7812981 100644
--- a/datok.go
+++ b/datok.go
@@ -39,7 +39,7 @@
const (
DEBUG = false
- MAGIC = "DATOK"
+ DAMAGIC = "DATOK"
VERSION = uint16(1)
FIRSTBIT uint32 = 1 << 31
SECONDBIT uint32 = 1 << 30
@@ -489,7 +489,7 @@
defer wb.Flush()
// Store magical header
- all, err := wb.Write([]byte(MAGIC))
+ all, err := wb.Write([]byte(DAMAGIC))
if err != nil {
log.Println(err)
return int64(all), err
@@ -614,7 +614,7 @@
r := bufio.NewReader(ior)
buf := make([]byte, 1024)
- buf = buf[0:len(MAGIC)]
+ buf = buf[0:len(DAMAGIC)]
_, err := r.Read(buf)
@@ -623,7 +623,7 @@
return nil
}
- if string(MAGIC) != string(buf) {
+ if string(DAMAGIC) != string(buf) {
log.Println("Not a datok file")
return nil
}
@@ -907,7 +907,8 @@
}
buffi -= buffo
- epsilonOffset -= buffo
+ // epsilonOffset -= buffo
+ epsilonOffset = buffo
buffo = 0
if DEBUG {
fmt.Println("Remaining:", showBuffer(buffer, buffo, buffi))