mirror of
https://github.com/cesanta/mongoose.git
synced 2026-10-25 12:04:47 +00:00
Enable mg_fopen_packed in newlib
This commit is contained in:
1 parent
dfc22af10f
commit
55d102e450
5 files changed
+18
-15
No files matched your search
@@ -26,13 +26,13 @@ ssize_t packed_write(void *cookie, const char *buf, size_t size) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
int packed_seek(void *cookie, off64_t *offset, int whence) {
|
||||
int packed_seek(void *cookie, long *offset, int whence) {
|
||||
struct packed_file *fp = (struct packed_file *) cookie;
|
||||
if (whence == SEEK_SET) fp->pos = (size_t) *offset;
|
||||
if (whence == SEEK_END) fp->pos = (size_t)((off64_t) fp->size + *offset);
|
||||
if (whence == SEEK_CUR) fp->pos = (size_t)((off64_t) fp->pos + *offset);
|
||||
if (whence == SEEK_END) fp->pos = (size_t)((long) fp->size + *offset);
|
||||
if (whence == SEEK_CUR) fp->pos = (size_t)((long) fp->pos + *offset);
|
||||
if (fp->pos > fp->size) fp->pos = fp->size;
|
||||
*offset = (off64_t) fp->pos;
|
||||
*offset = (long) fp->pos;
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -50,7 +50,7 @@ FILE *mg_fopen_packed(const char *path, const char *mode) {
|
||||
};
|
||||
struct packed_file *cookie = NULL;
|
||||
size_t size = 0;
|
||||
const char *data = unpack(path, &size);
|
||||
const char *data = mg_unpack(path, &size);
|
||||
if (data == NULL) return NULL;
|
||||
if ((cookie = calloc(1, sizeof(*cookie))) == NULL) return NULL;
|
||||
cookie->data = data;
|
||||
|
||||
Reference in new issue
Block a user