From e2484b13c9d008b0d9e20c22eb214087e440f998 Mon Sep 17 00:00:00 2001 From: mappu Date: Thu, 24 Nov 2016 20:53:45 +1300 Subject: [PATCH] imagequant: fix memmove'd buffer, remove dependency on go1.7.3 --- Result.go | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/Result.go b/Result.go index cd4836a..4e75af8 100644 --- a/Result.go +++ b/Result.go @@ -2,6 +2,7 @@ package imagequant import ( "image/color" + "unsafe" ) /* @@ -62,9 +63,7 @@ func (this *Result) WriteRemappedImage() ([]byte, error) { buff_size := this.im.w * this.im.h buff := make([]byte, buff_size) - // n.b. C.CBytes() added in go1.7.3 - - iqe := C.liq_write_remapped_image(this.p, this.im.p, C.CBytes(buff), C.size_t(buff_size)) + iqe := C.liq_write_remapped_image(this.p, this.im.p, unsafe.Pointer(&buff[0]), C.size_t(buff_size)) if iqe != C.LIQ_OK { return nil, translateError(iqe) }