forked from davidbyttow/govips
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathutil.go
More file actions
55 lines (46 loc) · 740 Bytes
/
util.go
File metadata and controls
55 lines (46 loc) · 740 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
package vips
// #cgo pkg-config: vips
// #include "bridge.h"
import "C"
import (
"log"
"unsafe"
)
func byteArrayPointer(b []byte) unsafe.Pointer {
return unsafe.Pointer(&b[0])
}
func freeCString(s *C.char) {
C.free(unsafe.Pointer(s))
}
func boolToInt(b bool) int {
if b {
return 1
}
return 0
}
func toGboolean(b bool) C.gboolean {
if b {
return C.gboolean(1)
}
return C.gboolean(0)
}
func fromGboolean(b C.gboolean) bool {
if b != 0 {
return true
}
return false
}
func fixedString(size int) string {
b := make([]byte, size)
for i := range b {
b[i] = '0'
}
return string(b)
}
func debug(fmt string, values ...interface{}) {
if len(values) > 0 {
log.Printf(fmt, values...)
} else {
log.Print(fmt)
}
}