37 uint8_t* bytes = (uint8_t*)buffer;
39 for (
size_t i = 0; i < got; ++i) {
40 bytes[i] ^= source->
key;
61int main(
int argc,
char* argv[]) {
62 (void)argc; (void)argv;
66 static const uint8_t asset[] = {
67 0x62, 0x4F, 0x46, 0x46, 0x45, 0x06, 0x0A, 0x59, 0x5E, 0x58, 0x4F, 0x4B, 0x47, 0x0B,
87 bj_info(
"\"%s\", %u", text, (
unsigned)year);
struct bj_stream bj_stream
const char * bj_error_message(const struct bj_error *error)
Gets the error message from an error object.
void bj_clear_error(struct bj_error **error)
Frees an error and sets the pointer to NULL.
#define bj_info(...)
Log a message using the BJ_LOG_INFO level.
#define bj_err(...)
Log a message using the BJ_LOG_ERROR level.
void bj_destroy_stream(struct bj_stream *stream)
Destroy a stream and release its memory.
bj_bool bj_read_stream_u16_be(struct bj_stream *stream, uint16_t *value)
Reads a big-endian uint16_t.
struct bj_stream * bj_create_stream_from_callbacks(const struct bj_stream_callbacks *callbacks, uint32_t flags, void *user_data, struct bj_error **error)
Create a stream over a source the program supplies.
struct bj_stream * bj_create_stream_from_read_memory(const void *data, size_t length)
Create a read-only stream that reads from an in-memory buffer.
bj_bool bj_stream_is_seekable(const struct bj_stream *stream)
Whether the stream can move its cursor.
bj_stream_status
Why the last read or write of a stream fell short.
size_t bj_read_stream(struct bj_stream *stream, void *dest, size_t count)
Reads data from the stream into a destination buffer.
@ BJ_STREAM_READ
The stream reads.
@ BJ_STREAM_STATUS_END
The data ran out, or a fixed-size stream is full.
@ BJ_STREAM_STATUS_ERROR
The source failed.
The functions of a source the program supplies.
Logging utility functions.
Portable main() replacement with platform-aware entry shim.
Header file for struct bj_stream struct and related functions.
static size_t scrambled_read(void *buffer, size_t count, void *user_data, enum bj_stream_status *status)
static const struct bj_stream_callbacks scrambled_callbacks