![]() |
Nilorea Library
C utilities for networking, threading, graphics
|
Data Structures | |
| struct | N_ZIP_MEMBER |
| What n_zip_find() says about a member. More... | |
Functions | |
| int | n_zip_extract (const char *path, const char *name, const char *out) |
| write a member out to a file, checking its CRC-32 | |
| int | n_zip_find (const char *path, const char *name, N_ZIP_MEMBER *member) |
| find a member by its full name in an archive's central directory | |
| int | n_zip_find_ending (const char *path, const char *ending, char *name, size_t name_len) |
| find the first member whose name ends with a given text, as a PyTorch checkpoint's "archive/data.pkl" whose folder name varies | |
| int | n_zip_read (const char *path, const char *name, size_t max_size, unsigned char **data, size_t *len) |
| read a member into memory, checking its CRC-32 | |
| struct N_ZIP_MEMBER |
| int n_zip_extract | ( | const char * | path, |
| const char * | name, | ||
| const char * | out ) |
write a member out to a file, checking its CRC-32
| path | the archive |
| name | the member's name as stored |
| out | the file to write; replaced, and removed again on any failure |
Definition at line 267 of file n_zip.c.
References ZIP_SINK::file, n_zip_find(), and zip_unpack().
Referenced by main().
| int n_zip_find | ( | const char * | path, |
| const char * | name, | ||
| N_ZIP_MEMBER * | member ) |
find a member by its full name in an archive's central directory
| path | the archive |
| name | the member's name as stored, "dir/file.ext" |
| member | receives what it is, may be NULL |
Definition at line 152 of file n_zip.c.
References zip_scan().
Referenced by main(), n_zip_extract(), and n_zip_read().
| int n_zip_find_ending | ( | const char * | path, |
| const char * | ending, | ||
| char * | name, | ||
| size_t | name_len ) |
find the first member whose name ends with a given text, as a PyTorch checkpoint's "archive/data.pkl" whose folder name varies
| path | the archive |
| ending | how the name ends |
| name | receives the member's whole name |
| name_len | size of name |
Definition at line 156 of file n_zip.c.
References zip_scan().
Referenced by main(), and n_pth_load().
| int n_zip_read | ( | const char * | path, |
| const char * | name, | ||
| size_t | max_size, | ||
| unsigned char ** | data, | ||
| size_t * | len ) |
read a member into memory, checking its CRC-32
| path | the archive |
| name | the member's name as stored |
| max_size | the largest member accepted, a guard against an archive that claims gigabytes |
| data | receives the bytes, allocated with malloc() and ended by one zero byte past len; freed by the caller with free(); NULL on failure |
| len | receives how many |
Definition at line 282 of file n_zip.c.
References ZIP_SINK::buffer, LOG_ERR, n_log, n_zip_find(), N_ZIP_MEMBER::size, ZIP_SINK::size, ZIP_SINK::used, and zip_unpack().
Referenced by main(), n_pth_load(), and tensor_read().