11 #ifndef libmobi_buffer_h
12 #define libmobi_buffer_h
bool mobi_buffer_match_magic(MOBIBuffer *buf, const char *magic)
Check if buffer data header contains magic signature.
Definition: buffer.c:543
void mobi_buffer_add32(MOBIBuffer *buf, const uint32_t data)
Adds 32-bit value to MOBIBuffer.
Definition: buffer.c:126
void mobi_buffer_add8(MOBIBuffer *buf, const uint8_t data)
Adds 8-bit value to MOBIBuffer.
Definition: buffer.c:93
void mobi_buffer_addraw(MOBIBuffer *buf, const unsigned char *data, const size_t len)
Adds raw data to MOBIBuffer.
Definition: buffer.c:147
void mobi_buffer_getstring(char *str, MOBIBuffer *buf, const size_t len)
Reads raw data from MOBIBuffer and pads it with zero character.
Definition: buffer.c:327
void mobi_buffer_copy8(MOBIBuffer *dest, MOBIBuffer *source)
Copy 8-bit value from one MOBIBuffer into another.
Definition: buffer.c:476
void mobi_buffer_addzeros(MOBIBuffer *buf, const size_t count)
Adds count of zeroes to MOBIBuffer.
Definition: buffer.c:174
uint32_t mobi_buffer_get_varlen(MOBIBuffer *buf, size_t *len)
Reads variable length value from MOBIBuffer.
Definition: buffer.c:299
void mobi_buffer_move(MOBIBuffer *buf, const int offset, const size_t len)
Copy raw value within one MOBIBuffer.
Definition: buffer.c:514
void mobi_buffer_free(MOBIBuffer *buf)
Free pointer to MOBIBuffer structure and pointer to data.
Definition: buffer.c:618
unsigned char * mobi_buffer_getpointer(MOBIBuffer *buf, const size_t len)
Get pointer to MOBIBuffer data at offset.
Definition: buffer.c:394
void mobi_buffer_setpos(MOBIBuffer *buf, const size_t pos)
Set buffer offset to pos position.
Definition: buffer.c:602
uint32_t mobi_buffer_get_varlen_dec(MOBIBuffer *buf, size_t *len)
Reads variable length value from MOBIBuffer going backwards.
Definition: buffer.c:316
void mobi_buffer_dup8(uint8_t **val, MOBIBuffer *buf)
Read 8-bit value from MOBIBuffer into allocated memory.
Definition: buffer.c:414
void mobi_buffer_appendstring(char *str, MOBIBuffer *buf, const size_t len)
Reads raw data from MOBIBuffer, appends it to a string and pads it with zero character.
Definition: buffer.c:350
uint16_t mobi_buffer_get16(MOBIBuffer *buf)
Reads 16-bit value from MOBIBuffer.
Definition: buffer.c:205
void mobi_buffer_free_null(MOBIBuffer *buf)
Free pointer to MOBIBuffer structure.
Definition: buffer.c:634
void mobi_buffer_seek(MOBIBuffer *buf, const int diff)
Move current buffer offset by diff bytes.
Definition: buffer.c:579
void mobi_buffer_copy(MOBIBuffer *dest, MOBIBuffer *source, const size_t len)
Copy raw value from one MOBIBuffer into another.
Definition: buffer.c:487
void mobi_buffer_add16(MOBIBuffer *buf, const uint16_t data)
Adds 16-bit value to MOBIBuffer.
Definition: buffer.c:108
MOBIBuffer * mobi_buffer_init(const size_t len)
Initializer for MOBIBuffer structure.
Definition: buffer.c:26
uint32_t mobi_buffer_get32(MOBIBuffer *buf)
Reads 32-bit value from MOBIBuffer.
Definition: buffer.c:223
uint8_t mobi_buffer_get8(MOBIBuffer *buf)
Reads 8-bit value from MOBIBuffer.
Definition: buffer.c:190
void mobi_buffer_resize(MOBIBuffer *buf, const size_t newlen)
Resize buffer.
Definition: buffer.c:71
MOBIBuffer * mobi_buffer_init_null(unsigned char *data, const size_t len)
Initializer for MOBIBuffer structure.
Definition: buffer.c:50
bool mobi_buffer_match_magic_offset(MOBIBuffer *buf, const char *magic, const size_t offset)
Check if buffer contains magic signature at given offset.
Definition: buffer.c:562
void mobi_buffer_dup32(uint32_t **val, MOBIBuffer *buf)
Read 32-bit value from MOBIBuffer into allocated memory.
Definition: buffer.c:458
void mobi_buffer_getraw(void *data, MOBIBuffer *buf, const size_t len)
Reads raw data from MOBIBuffer.
Definition: buffer.c:373
void mobi_buffer_dup16(uint16_t **val, MOBIBuffer *buf)
Read 16-bit value from MOBIBuffer into allocated memory.
Definition: buffer.c:436
void mobi_buffer_addstring(MOBIBuffer *buf, const char *str)
Adds string to MOBIBuffer without null terminator.
Definition: buffer.c:163
MOBI_RET
Error codes returned by functions.
Definition: mobi.h:59
Libmobi main header file.
Buffer to read to/write from.
Definition: buffer.h:20
size_t maxlen
Definition: buffer.h:22
size_t offset
Definition: buffer.h:21
unsigned char * data
Definition: buffer.h:23
MOBI_RET error
Definition: buffer.h:24