Go to the documentation of this file.
51 size_t needed = length + 1;
53 br->
buf =
static_cast<char *
>(realloc(br->
buf, needed));
66 FILE *
file = fopen(filepath,
"rb");
68 LOG(failureLevel, failureMessage, filepath, strerror(errno));
75 fseek(
file, 0L, SEEK_END);
77 fseek(
file, 0, SEEK_SET);
128 size_t cp =
MIN(length, (
size_t)(newline - curr + 1));
130 strncpy(buffer, curr, cp);
133 strncpy(buffer, curr, length);
char * bufferreader_data(BufferReader *br)
size_t bufferreader_current_line(BufferReader *br)
void LOG(LogLevel logLevel, const char *format,...)
void bufferreader_destroy(BufferReader *br)
size_t bufferreader_data_length(BufferReader *br)
char * bufferreader_get_line(BufferReader *br, char *buffer, size_t length)
static void bufferreader_init_for_length(BufferReader *br, size_t length)
BufferReader * bufferreader_init_from_file(BufferReader *br, const char *filepath, const char *failureMessage, LogLevel failureLevel)
void fatal(enum fatal_error err)
BufferReader * bufferreader_init_from_memory(BufferReader *br, const char *data, size_t length)
void bufferreader_init_from_tar_file(BufferReader *br, mtar_t *tar, mtar_header_t *h)
BufferReader * bufferreader_create()
char * bufferreader_next_line(BufferReader *br)
int mtar_read_data(mtar_t *tar, void *ptr, unsigned size)