Fix some C++ (not C) compile errors

This commit is contained in:
Nigel Tao committed 2018-06-30 13:31:52 +10:00
1 parent 52e7fe0709
commit e43aa62d1c
7 files changed
+70 -37

No files matched your search

+4 -2
View File
@@ -353,7 +353,8 @@ pri func decoder.decode_gc?(src base.io_reader)() {
if this.seen_graphic_control {
return error "bad graphic control"
}
if in.src.read_u8?() != 4 {
var c base.u8 = in.src.read_u8?()
if c != 4 {
return error "bad graphic control"
}
@@ -382,7 +383,8 @@ pri func decoder.decode_gc?(src base.io_reader)() {
this.gc_duration = (in.src.read_u16le?() as base.u64) * 7056000
this.gc_transparent_index = in.src.read_u8?()
if in.src.read_u8?() != 0 {
c = in.src.read_u8?()
if c != 0 {
return error "bad graphic control"
}
this.seen_graphic_control = true
+6 -4
View File
@@ -34,19 +34,21 @@ pub func decoder.set_ignore_checksum!(ic base.bool)() {
pub func decoder.decode?(dst base.io_writer, src base.io_reader)() {
// Read the header.
if in.src.read_u8?() != 0x1F {
var c base.u8 = in.src.read_u8?()
if c != 0x1F {
return error "bad header"
}
if in.src.read_u8?() != 0x8B {
c = in.src.read_u8?()
if c != 0x8B {
return error "bad header"
}
if in.src.read_u8?() != 0x08 {
c = in.src.read_u8?()
if c != 0x08 {
return error "bad compression method"
}
var flags base.u8 = in.src.read_u8?()
// TODO: API for returning the header's MTIME field.
in.src.skip32?(n:6)
var c base.u8
// Handle FEXTRA.
if (flags & 0x04) != 0 {