-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvirtual.c
More file actions
39 lines (33 loc) · 1.03 KB
/
virtual.c
File metadata and controls
39 lines (33 loc) · 1.03 KB
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
#include "virtual.h"
//#include <stdio.h>
#include <stdlib.h>
#include "_obj/_cgo_export.h"
sf_count_t gocall_get_filelen (void *user_data) {
// printf("filelen %p\n", gsfLen);
return gsfLen(user_data);
}
sf_count_t gocall_seek (sf_count_t offset, int whence, void *user_data) {
// printf("seek %p\n", gsfSeek);
return gsfSeek(offset, whence, user_data);
}
sf_count_t gocall_read (void *ptr, sf_count_t count, void *user_data) {
// printf("read %p\n", gsfWrite);
return gsfRead(ptr, count, user_data);
}
sf_count_t gocall_write (const void *ptr, sf_count_t count, void *user_data) {
// printf("write %p\n", gsfWrite);
return gsfWrite((void *)ptr, count, user_data);
}
sf_count_t gocall_tell (void *user_data) {
// printf("tell %p\n", gsfTell);
return gsfTell(user_data);
}
SF_VIRTUAL_IO* virtualio() {
SF_VIRTUAL_IO *svi = malloc(sizeof(SF_VIRTUAL_IO));
svi->get_filelen = gocall_get_filelen;
svi->seek = gocall_seek;
svi->read = gocall_read;
svi->write = gocall_write;
svi->tell = gocall_tell;
return svi;
}