package flate
import (
+ "bytes";
"bufio";
"compress/flate";
"io";
}
}
}
+
+func TestUncompressedSource(t *testing.T) {
+ decoder := NewInflater(bytes.NewBuffer(
+ []byte{ 0x01, 0x01, 0x00, 0xfe, 0xff, 0x11 }));
+ output := make([]byte, 1);
+ n, error := decoder.Read(output);
+ if n != 1 || error != nil {
+ t.Fatalf("decoder.Read() = %d, %v, want 1, nil", n, error);
+ }
+ if output[0] != 0x11 {
+ t.Errorf("output[0] = %x, want 0x11", output[0]);
+ }
+}
}
n := int(f.buf[0]) | int(f.buf[1])<<8;
nn := int(f.buf[2]) | int(f.buf[3])<<8;
- if nn != ^n {
+ if uint16(nn) != uint16(^n) {
return CorruptInputError(f.roffset);
}