MCPcopy Create free account
hub / github.com/imgproxy/imgproxy / imgproxyReaderRead

Function imgproxyReaderRead

vips/source.go:53–71  ·  view source on GitHub ↗

calls read() on the async reader via it's handle from the C side export imgproxyReaderRead

(handle C.uintptr_t, pointer unsafe.Pointer, size C.int64_t)

Source from the content-addressed store, hash-verified

51//
52//export imgproxyReaderRead
53func imgproxyReaderRead(handle C.uintptr_t, pointer unsafe.Pointer, size C.int64_t) C.int64_t {
54 h := cgo.Handle(handle)
55 r, ok := h.Value().(io.ReadSeeker)
56 if !ok {
57 vipsError("imgproxyReaderRead", "invalid reader handle")
58 return -1
59 }
60
61 buf := unsafe.Slice((*byte)(pointer), size)
62 n, err := r.Read(buf)
63 if errors.Is(err, io.EOF) {
64 return 0
65 } else if err != nil {
66 vipsError("imgproxyReaderRead", "error reading from imgproxy source: %v", err)
67 return -1
68 }
69
70 return C.int64_t(n)
71}

Callers

nothing calls this directly

Calls 3

vipsErrorFunction · 0.85
HandleMethod · 0.45
ReadMethod · 0.45

Tested by

no test coverage detected