diff --git a/nuklear.h b/nuklear.h index 784880b..878960d 100644 --- a/nuklear.h +++ b/nuklear.h @@ -613,7 +613,7 @@ NK_API nk_bool nk_init_fixed(struct nk_context*, void *memory, nk_size size, con /// interface to nuklear. Can be useful for cases like monitoring memory consumption. /// /// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c -/// nk_bool nk_init(struct nk_context *ctx, struct nk_allocator *alloc, const struct nk_user_font *font); +/// nk_bool nk_init(struct nk_context *ctx, const struct nk_allocator *alloc, const struct nk_user_font *font); /// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /// /// Parameter | Description @@ -624,7 +624,7 @@ NK_API nk_bool nk_init_fixed(struct nk_context*, void *memory, nk_size size, con /// /// Returns either `false(0)` on failure or `true(1)` on success. */ -NK_API nk_bool nk_init(struct nk_context*, struct nk_allocator*, const struct nk_user_font*); +NK_API nk_bool nk_init(struct nk_context*, const struct nk_allocator*, const struct nk_user_font*); /*/// #### nk_init_custom /// Initializes a `nk_context` struct from two different either fixed or growing /// buffers. The first buffer is for allocating draw commands while the second buffer is @@ -4132,8 +4132,8 @@ NK_API const nk_rune *nk_font_korean_glyph_ranges(void); #ifdef NK_INCLUDE_DEFAULT_ALLOCATOR NK_API void nk_font_atlas_init_default(struct nk_font_atlas*); #endif -NK_API void nk_font_atlas_init(struct nk_font_atlas*, struct nk_allocator*); -NK_API void nk_font_atlas_init_custom(struct nk_font_atlas*, struct nk_allocator *persistent, struct nk_allocator *transient); +NK_API void nk_font_atlas_init(struct nk_font_atlas*, const struct nk_allocator*); +NK_API void nk_font_atlas_init_custom(struct nk_font_atlas*, const struct nk_allocator *persistent, const struct nk_allocator *transient); NK_API void nk_font_atlas_begin(struct nk_font_atlas*); NK_API struct nk_font_config nk_font_config(float pixel_height); NK_API struct nk_font *nk_font_atlas_add(struct nk_font_atlas*, const struct nk_font_config*); @@ -4410,7 +4410,7 @@ NK_API nk_bool nk_filter_binary(const struct nk_text_edit*, nk_rune unicode); #ifdef NK_INCLUDE_DEFAULT_ALLOCATOR NK_API void nk_textedit_init_default(struct nk_text_edit*); #endif -NK_API void nk_textedit_init(struct nk_text_edit*, struct nk_allocator*, nk_size size); +NK_API void nk_textedit_init(struct nk_text_edit*, const struct nk_allocator*, nk_size size); NK_API void nk_textedit_init_fixed(struct nk_text_edit*, void *memory, nk_size size); NK_API void nk_textedit_free(struct nk_text_edit*); NK_API void nk_textedit_text(struct nk_text_edit*, const char*, int total_len); @@ -5970,7 +5970,7 @@ NK_LIB struct nk_vec2 nk_text_calculate_text_bounds(const struct nk_user_font *f NK_LIB int nk_strfmt(char *buf, int buf_size, const char *fmt, va_list args); #endif #ifdef NK_INCLUDE_STANDARD_IO -NK_LIB char *nk_file_load(const char* path, nk_size* siz, struct nk_allocator *alloc); +NK_LIB char *nk_file_load(const char* path, nk_size* siz, const struct nk_allocator *alloc); #endif /* buffer */ @@ -6015,7 +6015,7 @@ NK_LIB struct nk_window *nk_find_window(struct nk_context *ctx, nk_hash hash, co NK_LIB void nk_insert_window(struct nk_context *ctx, struct nk_window *win, enum nk_window_insert_location loc); /* pool */ -NK_LIB void nk_pool_init(struct nk_pool *pool, struct nk_allocator *alloc, unsigned int capacity); +NK_LIB void nk_pool_init(struct nk_pool *pool, const struct nk_allocator *alloc, unsigned int capacity); NK_LIB void nk_pool_free(struct nk_pool *pool); NK_LIB void nk_pool_init_fixed(struct nk_pool *pool, void *memory, nk_size size); NK_LIB struct nk_page_element *nk_pool_alloc(struct nk_pool *pool); @@ -7492,7 +7492,7 @@ nk_murmur_hash(const void * key, int len, nk_hash seed) } #ifdef NK_INCLUDE_STANDARD_IO NK_LIB char* -nk_file_load(const char* path, nk_size* siz, struct nk_allocator *alloc) +nk_file_load(const char* path, nk_size* siz, const struct nk_allocator *alloc) { char *buf; FILE *fd; @@ -16681,7 +16681,7 @@ nk_font_baker_memory(nk_size *temp, int *glyph_count, *temp += nk_build_align + nk_baker_align; } NK_INTERN struct nk_font_baker* -nk_font_baker(void *memory, int glyph_count, int count, struct nk_allocator *alloc) +nk_font_baker(void *memory, int glyph_count, int count, const struct nk_allocator *alloc) { struct nk_font_baker *baker; if (!memory) return 0; @@ -16698,7 +16698,7 @@ NK_INTERN int nk_font_bake_pack(struct nk_font_baker *baker, nk_size *image_memory, int *width, int *height, struct nk_recti *custom, const struct nk_font_config *config_list, int count, - struct nk_allocator *alloc) + const struct nk_allocator *alloc) { NK_STORAGE const nk_size max_height = 1024 * 32; const struct nk_font_config *config_iter, *it; @@ -17428,7 +17428,7 @@ nk_font_atlas_init_default(struct nk_font_atlas *atlas) } #endif NK_API void -nk_font_atlas_init(struct nk_font_atlas *atlas, struct nk_allocator *alloc) +nk_font_atlas_init(struct nk_font_atlas *atlas, const struct nk_allocator *alloc) { NK_ASSERT(atlas); NK_ASSERT(alloc); @@ -17439,7 +17439,7 @@ nk_font_atlas_init(struct nk_font_atlas *atlas, struct nk_allocator *alloc) } NK_API void nk_font_atlas_init_custom(struct nk_font_atlas *atlas, - struct nk_allocator *permanent, struct nk_allocator *temporary) + const struct nk_allocator *permanent, const struct nk_allocator *temporary) { NK_ASSERT(atlas); NK_ASSERT(permanent); @@ -19091,7 +19091,7 @@ nk_init_custom(struct nk_context *ctx, struct nk_buffer *cmds, return 1; } NK_API nk_bool -nk_init(struct nk_context *ctx, struct nk_allocator *alloc, +nk_init(struct nk_context *ctx, const struct nk_allocator *alloc, const struct nk_user_font *font) { NK_ASSERT(alloc); @@ -19380,7 +19380,7 @@ nk__next(struct nk_context *ctx, const struct nk_command *cmd) * * ===============================================================*/ NK_LIB void -nk_pool_init(struct nk_pool *pool, struct nk_allocator *alloc, +nk_pool_init(struct nk_pool *pool, const struct nk_allocator *alloc, unsigned int capacity) { NK_ASSERT(capacity >= 1); @@ -27204,7 +27204,7 @@ nk_textedit_init_fixed(struct nk_text_edit *state, void *memory, nk_size size) nk_str_init_fixed(&state->string, memory, size); } NK_API void -nk_textedit_init(struct nk_text_edit *state, struct nk_allocator *alloc, nk_size size) +nk_textedit_init(struct nk_text_edit *state, const struct nk_allocator *alloc, nk_size size) { NK_ASSERT(state); NK_ASSERT(alloc); diff --git a/src/nuklear.h b/src/nuklear.h index 9fb0be4..034b9d1 100644 --- a/src/nuklear.h +++ b/src/nuklear.h @@ -391,7 +391,7 @@ NK_API nk_bool nk_init_fixed(struct nk_context*, void *memory, nk_size size, con /// interface to nuklear. Can be useful for cases like monitoring memory consumption. /// /// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c -/// nk_bool nk_init(struct nk_context *ctx, struct nk_allocator *alloc, const struct nk_user_font *font); +/// nk_bool nk_init(struct nk_context *ctx, const struct nk_allocator *alloc, const struct nk_user_font *font); /// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /// /// Parameter | Description @@ -402,7 +402,7 @@ NK_API nk_bool nk_init_fixed(struct nk_context*, void *memory, nk_size size, con /// /// Returns either `false(0)` on failure or `true(1)` on success. */ -NK_API nk_bool nk_init(struct nk_context*, struct nk_allocator*, const struct nk_user_font*); +NK_API nk_bool nk_init(struct nk_context*, const struct nk_allocator*, const struct nk_user_font*); /*/// #### nk_init_custom /// Initializes a `nk_context` struct from two different either fixed or growing /// buffers. The first buffer is for allocating draw commands while the second buffer is @@ -3910,8 +3910,8 @@ NK_API const nk_rune *nk_font_korean_glyph_ranges(void); #ifdef NK_INCLUDE_DEFAULT_ALLOCATOR NK_API void nk_font_atlas_init_default(struct nk_font_atlas*); #endif -NK_API void nk_font_atlas_init(struct nk_font_atlas*, struct nk_allocator*); -NK_API void nk_font_atlas_init_custom(struct nk_font_atlas*, struct nk_allocator *persistent, struct nk_allocator *transient); +NK_API void nk_font_atlas_init(struct nk_font_atlas*, const struct nk_allocator*); +NK_API void nk_font_atlas_init_custom(struct nk_font_atlas*, const struct nk_allocator *persistent, const struct nk_allocator *transient); NK_API void nk_font_atlas_begin(struct nk_font_atlas*); NK_API struct nk_font_config nk_font_config(float pixel_height); NK_API struct nk_font *nk_font_atlas_add(struct nk_font_atlas*, const struct nk_font_config*); @@ -4188,7 +4188,7 @@ NK_API nk_bool nk_filter_binary(const struct nk_text_edit*, nk_rune unicode); #ifdef NK_INCLUDE_DEFAULT_ALLOCATOR NK_API void nk_textedit_init_default(struct nk_text_edit*); #endif -NK_API void nk_textedit_init(struct nk_text_edit*, struct nk_allocator*, nk_size size); +NK_API void nk_textedit_init(struct nk_text_edit*, const struct nk_allocator*, nk_size size); NK_API void nk_textedit_init_fixed(struct nk_text_edit*, void *memory, nk_size size); NK_API void nk_textedit_free(struct nk_text_edit*); NK_API void nk_textedit_text(struct nk_text_edit*, const char*, int total_len); diff --git a/src/nuklear_context.c b/src/nuklear_context.c index 727990a..7714496 100644 --- a/src/nuklear_context.c +++ b/src/nuklear_context.c @@ -63,7 +63,7 @@ nk_init_custom(struct nk_context *ctx, struct nk_buffer *cmds, return 1; } NK_API nk_bool -nk_init(struct nk_context *ctx, struct nk_allocator *alloc, +nk_init(struct nk_context *ctx, const struct nk_allocator *alloc, const struct nk_user_font *font) { NK_ASSERT(alloc); diff --git a/src/nuklear_font.c b/src/nuklear_font.c index 836584f..9fcae8f 100644 --- a/src/nuklear_font.c +++ b/src/nuklear_font.c @@ -146,7 +146,7 @@ nk_font_baker_memory(nk_size *temp, int *glyph_count, *temp += nk_build_align + nk_baker_align; } NK_INTERN struct nk_font_baker* -nk_font_baker(void *memory, int glyph_count, int count, struct nk_allocator *alloc) +nk_font_baker(void *memory, int glyph_count, int count, const struct nk_allocator *alloc) { struct nk_font_baker *baker; if (!memory) return 0; @@ -163,7 +163,7 @@ NK_INTERN int nk_font_bake_pack(struct nk_font_baker *baker, nk_size *image_memory, int *width, int *height, struct nk_recti *custom, const struct nk_font_config *config_list, int count, - struct nk_allocator *alloc) + const struct nk_allocator *alloc) { NK_STORAGE const nk_size max_height = 1024 * 32; const struct nk_font_config *config_iter, *it; @@ -893,7 +893,7 @@ nk_font_atlas_init_default(struct nk_font_atlas *atlas) } #endif NK_API void -nk_font_atlas_init(struct nk_font_atlas *atlas, struct nk_allocator *alloc) +nk_font_atlas_init(struct nk_font_atlas *atlas, const struct nk_allocator *alloc) { NK_ASSERT(atlas); NK_ASSERT(alloc); @@ -904,7 +904,7 @@ nk_font_atlas_init(struct nk_font_atlas *atlas, struct nk_allocator *alloc) } NK_API void nk_font_atlas_init_custom(struct nk_font_atlas *atlas, - struct nk_allocator *permanent, struct nk_allocator *temporary) + const struct nk_allocator *permanent, const struct nk_allocator *temporary) { NK_ASSERT(atlas); NK_ASSERT(permanent); diff --git a/src/nuklear_internal.h b/src/nuklear_internal.h index a1c00bc..e0de763 100644 --- a/src/nuklear_internal.h +++ b/src/nuklear_internal.h @@ -138,7 +138,7 @@ NK_LIB struct nk_vec2 nk_text_calculate_text_bounds(const struct nk_user_font *f NK_LIB int nk_strfmt(char *buf, int buf_size, const char *fmt, va_list args); #endif #ifdef NK_INCLUDE_STANDARD_IO -NK_LIB char *nk_file_load(const char* path, nk_size* siz, struct nk_allocator *alloc); +NK_LIB char *nk_file_load(const char* path, nk_size* siz, const struct nk_allocator *alloc); #endif /* buffer */ @@ -183,7 +183,7 @@ NK_LIB struct nk_window *nk_find_window(struct nk_context *ctx, nk_hash hash, co NK_LIB void nk_insert_window(struct nk_context *ctx, struct nk_window *win, enum nk_window_insert_location loc); /* pool */ -NK_LIB void nk_pool_init(struct nk_pool *pool, struct nk_allocator *alloc, unsigned int capacity); +NK_LIB void nk_pool_init(struct nk_pool *pool, const struct nk_allocator *alloc, unsigned int capacity); NK_LIB void nk_pool_free(struct nk_pool *pool); NK_LIB void nk_pool_init_fixed(struct nk_pool *pool, void *memory, nk_size size); NK_LIB struct nk_page_element *nk_pool_alloc(struct nk_pool *pool); diff --git a/src/nuklear_pool.c b/src/nuklear_pool.c index 57419e8..600877a 100644 --- a/src/nuklear_pool.c +++ b/src/nuklear_pool.c @@ -7,7 +7,7 @@ * * ===============================================================*/ NK_LIB void -nk_pool_init(struct nk_pool *pool, struct nk_allocator *alloc, +nk_pool_init(struct nk_pool *pool, const struct nk_allocator *alloc, unsigned int capacity) { NK_ASSERT(capacity >= 1); diff --git a/src/nuklear_text_editor.c b/src/nuklear_text_editor.c index e381857..1517d81 100644 --- a/src/nuklear_text_editor.c +++ b/src/nuklear_text_editor.c @@ -992,7 +992,7 @@ nk_textedit_init_fixed(struct nk_text_edit *state, void *memory, nk_size size) nk_str_init_fixed(&state->string, memory, size); } NK_API void -nk_textedit_init(struct nk_text_edit *state, struct nk_allocator *alloc, nk_size size) +nk_textedit_init(struct nk_text_edit *state, const struct nk_allocator *alloc, nk_size size) { NK_ASSERT(state); NK_ASSERT(alloc); diff --git a/src/nuklear_util.c b/src/nuklear_util.c index 1d1a0ad..50e6d61 100644 --- a/src/nuklear_util.c +++ b/src/nuklear_util.c @@ -984,7 +984,7 @@ nk_murmur_hash(const void * key, int len, nk_hash seed) } #ifdef NK_INCLUDE_STANDARD_IO NK_LIB char* -nk_file_load(const char* path, nk_size* siz, struct nk_allocator *alloc) +nk_file_load(const char* path, nk_size* siz, const struct nk_allocator *alloc) { char *buf; FILE *fd;