fix cookie return vals

ffi
Avril 3 years ago
parent 3e94e78442
commit f8dc3de398
Signed by: flanchan
GPG Key ID: 284488987C31F630

@ -18,7 +18,8 @@ static ssize_t cc20c_read(void* cookie, char* buffer, size_t size)
static ssize_t cc20c_write(void* cookie, const char* buffer, size_t size) static ssize_t cc20c_write(void* cookie, const char* buffer, size_t size)
{ {
return cc20_write(buffer, 1, size, cookie); register int c = cc20_write(buffer, 1, size, cookie);
return c < 0 ? 0 : c;
} }
static int cc20c_seek(void* cookie, off64_t* pos, int w) static int cc20c_seek(void* cookie, off64_t* pos, int w)
@ -32,10 +33,10 @@ static int cc20c_seek(void* cookie, off64_t* pos, int w)
static int cc20c_close(void* cookie) static int cc20c_close(void* cookie)
{ {
struct cc20_metadata meta; struct cc20_metadata meta ={0};
cc20_close_sink(cookie, &meta); cc20_close_sink(cookie, &meta);
if(meta.backing) fclose(meta.backing); if(meta.backing) fclose(meta.backing);
else return 1; else return -1;
return 0; return 0;
} }

Loading…
Cancel
Save