diff --git a/go/cb.go b/go/cb.go index 2fd404d..8c076ae 100644 --- a/go/cb.go +++ b/go/cb.go @@ -144,10 +144,10 @@ func hcl_go_cci_handler(c *C.hcl_t, cmd C.hcl_io_cmd_t, arg unsafe.Pointer) C.in ioarg.is_bytes = 0 if unsafe.Sizeof(buf[0]) == unsafe.Sizeof(dummy) { - C.memcpy ( + C.memcpy( unsafe.Pointer(&ioarg.buf[0]), unsafe.Pointer(&buf[0]), - C.size_t(unsafe.Sizeof(buf[0]) * uintptr(n))) + C.size_t(unsafe.Sizeof(buf[0])*uintptr(n))) } else { var dst uintptr // work around cgo's union issue. not able to access individual union @@ -155,7 +155,7 @@ func hcl_go_cci_handler(c *C.hcl_t, cmd C.hcl_io_cmd_t, arg unsafe.Pointer) C.in dst = uintptr(unsafe.Pointer(&ioarg.buf[0])) for i = 0; i < n; i++ { //ioarg.buf.c[i] = C.hcl_uch_t(buf[i]) - *(*C.hcl_uch_t)(unsafe.Pointer(dst)) = C.hcl_uch_t(buf[i]); + *(*C.hcl_uch_t)(unsafe.Pointer(dst)) = C.hcl_uch_t(buf[i]) dst += unsafe.Sizeof(dummy) } } diff --git a/pas/hcl.pas b/pas/hcl.pas index 889cf6e..dd6ed6a 100644 --- a/pas/hcl.pas +++ b/pas/hcl.pas @@ -347,7 +347,7 @@ label begin f := SysUtils.FileOpen(filename, SysUtils.fmOpenRead); if f = System.THandle(-1) then begin - errmsg := 'failed to open file - ' + filename; + errmsg := 'failed to open ' + filename + ' - ' + SysUtils.SysErrorMessage(SysUtils.GetLastOSError()); goto oops; end; @@ -367,7 +367,7 @@ begin while true do begin len := SysUtils.FileRead(f, buf, System.SizeOf(buf)); if len <= -1 then begin - errmsg := 'failed to read file - ' + filename; + errmsg := 'failed to read ' + filename + ' - ' + SysUtils.SysErrorMessage(SysUtils.GetLastOSError()); goto oops; end; if len = 0 then break; @@ -395,7 +395,7 @@ oops: if feed_ongoing then hcl_endfeed(self.handle); if attached then hcl_detachccio(self.handle); self.basefile := ''; - if f >= -1 then SysUtils.FileClose(f); + if f <> System.THandle(-1) then SysUtils.FileClose(f); raise Exception.Create(errmsg); end;