mirror of
https://github.com/thepigeongenerator/mcaselector-lite
synced 2026-02-08 17:42:45 +01:00
create a custom definition for size_t and ssize_t, which is ssize and usize, for conveinience.
This commit is contained in:
@@ -9,7 +9,7 @@
|
||||
|
||||
/* contains chunk metadata */
|
||||
struct mcx_chunk {
|
||||
size_t idx; // byte offset for start of chunk data
|
||||
usize idx; // byte offset for start of chunk data
|
||||
u32 len; // byte length of chunk (+ padding)
|
||||
u32 time; // modification time in epoch seconds
|
||||
};
|
||||
@@ -18,20 +18,20 @@ struct mcx_chunk {
|
||||
* The chunk's location data shall become `0`, and timestamp data the current time.
|
||||
* All succeeding chunks shall be moved back, freeing space.
|
||||
* Returns the amount of bytes removed. */
|
||||
size_t mcx_delchunk(u8 *restrict buf, int chunk) NONNULL((1));
|
||||
usize mcx_delchunk(u8 *restrict buf, int chunk) NONNULL((1));
|
||||
|
||||
/* Deletes the range defined by `start`—`end` (inclusive) of chunks out of `buf`.
|
||||
* The chunk's location data shall become `0`, and timestamp data the current time.
|
||||
* All succeeding chunks shall be moved back, freeing space.
|
||||
* Returns the amount of bytes removed */
|
||||
size_t mcx_delchunk_range(u8 *restrict buf, int start, int end) NONNULL((1));
|
||||
usize mcx_delchunk_range(u8 *restrict buf, int start, int end) NONNULL((1));
|
||||
|
||||
/* Deletes a `chunkc` chunks from `chunks` out of `buf`.
|
||||
* If the `chunks` indices are known to be sequential, i.e. have a constant difference of `1`, `mcx_delchunk_range` should be preferred.
|
||||
* The chunk's location data shall become `0`, and timestamp data the current time.
|
||||
* All succeeding chunks shall be moved back, freeing space.
|
||||
* Returns the amount of bytes removed */
|
||||
size_t mcx_delchunk_bulk(u8 *restrict buf, const u16 *restrict chunks, int chunkc) NONNULL((1, 2));
|
||||
usize mcx_delchunk_bulk(u8 *restrict buf, const u16 *restrict chunks, int chunkc) NONNULL((1, 2));
|
||||
|
||||
/* Computes the byte size of the `*.mcX` file in `buf` and returns it. */
|
||||
size_t mcx_calcsize(const u8 *restrict buf) NONNULL((1)) PURE;
|
||||
usize mcx_calcsize(const u8 *restrict buf) NONNULL((1)) PURE;
|
||||
|
||||
Reference in New Issue
Block a user