Skip to content

Commit d5969ab

Browse files
authored
Merge pull request #728 from Immediate-Mode-UI/revert-721-const-correctness
Revert "const correctness in public API"
2 parents f169ee6 + d123122 commit d5969ab

15 files changed

+212
-194
lines changed

nuklear.h

Lines changed: 106 additions & 97 deletions
Large diffs are not rendered by default.

src/nuklear.h

Lines changed: 46 additions & 46 deletions
Large diffs are not rendered by default.

src/nuklear_buffer.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,7 @@ nk_buffer_free(struct nk_buffer *b)
242242
b->pool.free(b->pool.userdata, b->memory.ptr);
243243
}
244244
NK_API void
245-
nk_buffer_info(struct nk_memory_status *s, const struct nk_buffer *b)
245+
nk_buffer_info(struct nk_memory_status *s, struct nk_buffer *b)
246246
{
247247
NK_ASSERT(b);
248248
NK_ASSERT(s);
@@ -268,9 +268,10 @@ nk_buffer_memory_const(const struct nk_buffer *buffer)
268268
return buffer->memory.ptr;
269269
}
270270
NK_API nk_size
271-
nk_buffer_total(const struct nk_buffer *buffer)
271+
nk_buffer_total(struct nk_buffer *buffer)
272272
{
273273
NK_ASSERT(buffer);
274274
if (!buffer) return 0;
275275
return buffer->memory.size;
276276
}
277+

src/nuklear_color.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ nk_parse_hex(const char *p, int length)
2323
return i;
2424
}
2525
NK_API struct nk_color
26-
nk_rgb_factor(struct nk_color col, float factor)
26+
nk_rgb_factor(struct nk_color col, const float factor)
2727
{
2828
if (factor == 1.0f)
2929
return col;
@@ -246,7 +246,7 @@ nk_hsva_colorf(float h, float s, float v, float a)
246246
return out;
247247
}
248248
NK_API struct nk_colorf
249-
nk_hsva_colorfv(const float *c)
249+
nk_hsva_colorfv(float *c)
250250
{
251251
return nk_hsva_colorf(c[0], c[1], c[2], c[3]);
252252
}
@@ -421,3 +421,4 @@ nk_color_hsv_bv(nk_byte *out, struct nk_color in)
421421
out[1] = (nk_byte)tmp[1];
422422
out[2] = (nk_byte)tmp[2];
423423
}
424+

src/nuklear_combo.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -702,7 +702,7 @@ NK_API void nk_combo_close(struct nk_context *ctx)
702702
nk_contextual_close(ctx);
703703
}
704704
NK_API int
705-
nk_combo(struct nk_context *ctx, const char *const *items, int count,
705+
nk_combo(struct nk_context *ctx, const char **items, int count,
706706
int selected, int item_height, struct nk_vec2 size)
707707
{
708708
int i = 0;
@@ -820,7 +820,7 @@ nk_combo_callback(struct nk_context *ctx, void(*item_getter)(void*, int, const c
820820
} return selected;
821821
}
822822
NK_API void
823-
nk_combobox(struct nk_context *ctx, const char *const *items, int count,
823+
nk_combobox(struct nk_context *ctx, const char **items, int count,
824824
int *selected, int item_height, struct nk_vec2 size)
825825
{
826826
*selected = nk_combo(ctx, items, count, *selected, item_height, size);
@@ -845,3 +845,4 @@ nk_combobox_callback(struct nk_context *ctx,
845845
{
846846
*selected = nk_combo_callback(ctx, item_getter, userdata, *selected, count, item_height, size);
847847
}
848+

src/nuklear_draw.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -329,7 +329,7 @@ nk_fill_triangle(struct nk_command_buffer *b, float x0, float y0, float x1,
329329
cmd->color = c;
330330
}
331331
NK_API void
332-
nk_stroke_polygon(struct nk_command_buffer *b, const float *points, int point_count,
332+
nk_stroke_polygon(struct nk_command_buffer *b, float *points, int point_count,
333333
float line_thickness, struct nk_color col)
334334
{
335335
int i;
@@ -350,7 +350,7 @@ nk_stroke_polygon(struct nk_command_buffer *b, const float *points, int point_co
350350
}
351351
}
352352
NK_API void
353-
nk_fill_polygon(struct nk_command_buffer *b, const float *points, int point_count,
353+
nk_fill_polygon(struct nk_command_buffer *b, float *points, int point_count,
354354
struct nk_color col)
355355
{
356356
int i;
@@ -371,7 +371,7 @@ nk_fill_polygon(struct nk_command_buffer *b, const float *points, int point_coun
371371
}
372372
}
373373
NK_API void
374-
nk_stroke_polyline(struct nk_command_buffer *b, const float *points, int point_count,
374+
nk_stroke_polyline(struct nk_command_buffer *b, float *points, int point_count,
375375
float line_thickness, struct nk_color col)
376376
{
377377
int i;
@@ -555,3 +555,4 @@ nk_draw_text(struct nk_command_buffer *b, struct nk_rect r,
555555
NK_MEMCPY(cmd->string, string, (nk_size)length);
556556
cmd->string[length] = '\0';
557557
}
558+

src/nuklear_font.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -504,7 +504,7 @@ nk_font_query_font_glyph(nk_handle handle, float height,
504504
}
505505
#endif
506506
NK_API const struct nk_font_glyph*
507-
nk_font_find_glyph(const struct nk_font *font, nk_rune unicode)
507+
nk_font_find_glyph(struct nk_font *font, nk_rune unicode)
508508
{
509509
int i = 0;
510510
int count;
@@ -1370,3 +1370,4 @@ nk_font_atlas_clear(struct nk_font_atlas *atlas)
13701370
nk_zero_struct(*atlas);
13711371
}
13721372
#endif
1373+

src/nuklear_internal.h

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ enum nk_window_insert_location {
186186
NK_LIB void *nk_create_window(struct nk_context *ctx);
187187
NK_LIB void nk_remove_window(struct nk_context*, struct nk_window*);
188188
NK_LIB void nk_free_window(struct nk_context *ctx, struct nk_window *win);
189-
NK_LIB struct nk_window *nk_find_window(const struct nk_context *ctx, nk_hash hash, const char *name);
189+
NK_LIB struct nk_window *nk_find_window(struct nk_context *ctx, nk_hash hash, const char *name);
190190
NK_LIB void nk_insert_window(struct nk_context *ctx, struct nk_window *win, enum nk_window_insert_location loc);
191191

192192
/* pool */
@@ -206,7 +206,7 @@ NK_LIB void nk_remove_table(struct nk_window *win, struct nk_table *tbl);
206206
NK_LIB void nk_free_table(struct nk_context *ctx, struct nk_table *tbl);
207207
NK_LIB void nk_push_table(struct nk_window *win, struct nk_table *tbl);
208208
NK_LIB nk_uint *nk_add_value(struct nk_context *ctx, struct nk_window *win, nk_hash name, nk_uint value);
209-
NK_LIB nk_uint *nk_find_value(const struct nk_window *win, nk_hash name);
209+
NK_LIB nk_uint *nk_find_value(struct nk_window *win, nk_hash name);
210210

211211
/* panel */
212212
NK_LIB void *nk_create_panel(struct nk_context *ctx);
@@ -227,7 +227,7 @@ NK_LIB void nk_row_layout(struct nk_context *ctx, enum nk_layout_format fmt, flo
227227
NK_LIB void nk_panel_alloc_row(const struct nk_context *ctx, struct nk_window *win);
228228
NK_LIB void nk_layout_widget_space(struct nk_rect *bounds, const struct nk_context *ctx, struct nk_window *win, int modify);
229229
NK_LIB void nk_panel_alloc_space(struct nk_rect *bounds, const struct nk_context *ctx);
230-
NK_LIB void nk_layout_peek(struct nk_rect *bounds, const struct nk_context *ctx);
230+
NK_LIB void nk_layout_peek(struct nk_rect *bounds, struct nk_context *ctx);
231231

232232
/* popup */
233233
NK_LIB nk_bool nk_nonblock_begin(struct nk_context *ctx, nk_flags flags, struct nk_rect body, struct nk_rect header, enum nk_panel_type panel_type);
@@ -375,3 +375,4 @@ nk_stbtt_free(void *ptr, void *user_data) {
375375
#endif /* NK_INCLUDE_FONT_BAKING */
376376

377377
#endif
378+

src/nuklear_layout.c

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ nk_row_layout(struct nk_context *ctx, enum nk_layout_format fmt,
134134
win->layout->row.item_width = (float)width;
135135
}
136136
NK_API float
137-
nk_layout_ratio_from_pixel(const struct nk_context *ctx, float pixel_width)
137+
nk_layout_ratio_from_pixel(struct nk_context *ctx, float pixel_width)
138138
{
139139
struct nk_window *win;
140140
NK_ASSERT(ctx);
@@ -463,7 +463,7 @@ nk_layout_space_push(struct nk_context *ctx, struct nk_rect rect)
463463
layout->row.item = rect;
464464
}
465465
NK_API struct nk_rect
466-
nk_layout_space_bounds(const struct nk_context *ctx)
466+
nk_layout_space_bounds(struct nk_context *ctx)
467467
{
468468
struct nk_rect ret;
469469
struct nk_window *win;
@@ -482,7 +482,7 @@ nk_layout_space_bounds(const struct nk_context *ctx)
482482
return ret;
483483
}
484484
NK_API struct nk_rect
485-
nk_layout_widget_bounds(const struct nk_context *ctx)
485+
nk_layout_widget_bounds(struct nk_context *ctx)
486486
{
487487
struct nk_rect ret;
488488
struct nk_window *win;
@@ -501,7 +501,7 @@ nk_layout_widget_bounds(const struct nk_context *ctx)
501501
return ret;
502502
}
503503
NK_API struct nk_vec2
504-
nk_layout_space_to_screen(const struct nk_context *ctx, struct nk_vec2 ret)
504+
nk_layout_space_to_screen(struct nk_context *ctx, struct nk_vec2 ret)
505505
{
506506
struct nk_window *win;
507507
struct nk_panel *layout;
@@ -517,7 +517,7 @@ nk_layout_space_to_screen(const struct nk_context *ctx, struct nk_vec2 ret)
517517
return ret;
518518
}
519519
NK_API struct nk_vec2
520-
nk_layout_space_to_local(const struct nk_context *ctx, struct nk_vec2 ret)
520+
nk_layout_space_to_local(struct nk_context *ctx, struct nk_vec2 ret)
521521
{
522522
struct nk_window *win;
523523
struct nk_panel *layout;
@@ -533,7 +533,7 @@ nk_layout_space_to_local(const struct nk_context *ctx, struct nk_vec2 ret)
533533
return ret;
534534
}
535535
NK_API struct nk_rect
536-
nk_layout_space_rect_to_screen(const struct nk_context *ctx, struct nk_rect ret)
536+
nk_layout_space_rect_to_screen(struct nk_context *ctx, struct nk_rect ret)
537537
{
538538
struct nk_window *win;
539539
struct nk_panel *layout;
@@ -549,7 +549,7 @@ nk_layout_space_rect_to_screen(const struct nk_context *ctx, struct nk_rect ret)
549549
return ret;
550550
}
551551
NK_API struct nk_rect
552-
nk_layout_space_rect_to_local(const struct nk_context *ctx, struct nk_rect ret)
552+
nk_layout_space_rect_to_local(struct nk_context *ctx, struct nk_rect ret)
553553
{
554554
struct nk_window *win;
555555
struct nk_panel *layout;
@@ -730,7 +730,7 @@ nk_panel_alloc_space(struct nk_rect *bounds, const struct nk_context *ctx)
730730
layout->row.index++;
731731
}
732732
NK_LIB void
733-
nk_layout_peek(struct nk_rect *bounds, const struct nk_context *ctx)
733+
nk_layout_peek(struct nk_rect *bounds, struct nk_context *ctx)
734734
{
735735
float y;
736736
int index;

src/nuklear_popup.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@ nk_popup_end(struct nk_context *ctx)
230230
nk_push_scissor(&win->buffer, win->layout->clip);
231231
}
232232
NK_API void
233-
nk_popup_get_scroll(const struct nk_context *ctx, nk_uint *offset_x, nk_uint *offset_y)
233+
nk_popup_get_scroll(struct nk_context *ctx, nk_uint *offset_x, nk_uint *offset_y)
234234
{
235235
struct nk_window *popup;
236236

0 commit comments

Comments
 (0)