commit ac14707c5384ded3c6021063937a11e01a74b30e
parent 2b22ff489d607ff42609e456ca2622e9596d4ea3
Author: bsandro <email@bsandro.tech>
Date: Sun, 5 Jan 2025 22:38:20 +0200
Build error fixes (Fedora 41, gcc 14.2.1)
Diffstat:
2 files changed, 13 insertions(+), 11 deletions(-)
diff --git a/gui/spritesheet.c b/gui/spritesheet.c
@@ -1,3 +1,5 @@
+#include <stdlib.h>
+#include <string.h>
#include <assert.h>
#include "spritesheet.h"
diff --git a/gui/ui.c b/gui/ui.c
@@ -86,7 +86,7 @@ int ButtonDialogSaveEvent(UIElement *element, UIMessage msg, int di, void *dp) {
WebpWrite(out_name, img, cols);
// printf("save dialog window close\n");
assert(element->window==modal_win);
- UIElementDestroy(element->window);
+ UIElementDestroy(&element->window->e);
}
return 0;
}
@@ -99,7 +99,7 @@ int ButtonDialogOpenEvent(UIElement *element, UIMessage msg, int di, void *dp) {
// printf("path_input: %p\nfilename_input: %p\n", path_input, filename_input);
// printf("path_input: %s(%d)\nfilename_input: %s(%d)\n", path_input->string, strlen(path_input->string), filename_input->string, strlen(filename_input->string));
- UIElementDestroy(element->window);
+ UIElementDestroy(&element->window->e);
int path_len = path_input->bytes + filename_input->bytes + 2; // DIR_SEPARATOR and '\0'
char filepath[path_len];
@@ -158,7 +158,7 @@ int TableEvent(UIElement *element, UIMessage msg, int di, void *dp) {
UITextbox *path_input = (UITextbox *)panel_top->e.children;
UITextboxClear(path_input, false);
UITextboxReplace(path_input, (char *)element->cp, -1, false);
- UIElementRepaint(path_input, NULL);
+ UIElementRepaint(&path_input->e, NULL);
UITableEnsureVisible(table, -1);
}
} else {
@@ -177,8 +177,8 @@ int TableEvent(UIElement *element, UIMessage msg, int di, void *dp) {
UITextboxClear(file_input, false);
UITextboxReplace(path_input, (char *)element->cp, -1, false);
UITextboxReplace(file_input, filelist[hit]->d_name, -1, false);
- UIElementRepaint(path_input, NULL);
- UIElementRepaint(file_input, NULL);
+ UIElementRepaint(&path_input->e, NULL);
+ UIElementRepaint(&file_input->e, NULL);
}
}
} else if (msg==UI_MSG_DESTROY) {
@@ -198,7 +198,7 @@ int TableEvent(UIElement *element, UIMessage msg, int di, void *dp) {
int ButtonCloseEvent(UIElement *element, UIMessage msg, int di, void *dp) {
if (msg == UI_MSG_CLICKED) {
- UIElementDestroy(element->window);
+ UIElementDestroy(&element->window->e);
}
return 0;
}
@@ -206,9 +206,9 @@ int ButtonCloseEvent(UIElement *element, UIMessage msg, int di, void *dp) {
void ShowModalWindow(UIWindow *parent, const char *def_dir, const char *def_file, CallbackFn cb) {
if (modal_win == NULL) {
// printf("create modal window\n");
- int w = UIElementMessage(parent, UI_MSG_GET_WIDTH, 0, 0);
- int h = UIElementMessage(parent, UI_MSG_GET_HEIGHT, 0, 0);
- modal_win = UIWindowCreate(parent, NULL, def_file?"Save File":"Open File", w, h);
+ int w = UIElementMessage(&parent->e, UI_MSG_GET_WIDTH, 0, 0);
+ int h = UIElementMessage(&parent->e, UI_MSG_GET_HEIGHT, 0, 0);
+ modal_win = UIWindowCreate(parent, 0, def_file?"Save File":"Open File", w, h);
modal_win->e.messageUser = WinModalEvent;
UIPanel *panel_out = UIPanelCreate(&modal_win->e, UI_PANEL_GRAY|UI_PANEL_EXPAND);
UILabel *lbl_title = UILabelCreate(&panel_out->e, 0, def_file?"Save File":"Open File", -1);
@@ -241,7 +241,7 @@ void ShowModalWindow(UIWindow *parent, const char *def_dir, const char *def_file
table->e.messageUser = TableEvent;
UITableResizeColumns(table);
} else {
- UIElementFocus(modal_win);
+ UIElementFocus(&modal_win->e);
}
}
@@ -310,7 +310,7 @@ void PreviewUpdate(Animation *img, UIImageDisplay *img_disp) {
UILabel *label = (UILabel *)img_disp->e.cp;
char label_text[256] = {0};
- snprintf(&label_text, 255, "Size: %4dx%4dpx", ss.width, ss.height);
+ snprintf((char * restrict)&label_text, 255, "Size: %4dx%4dpx", ss.width, ss.height);
UILabelSetContent(label, label_text, -1);
UIElementRefresh(label->e.parent);
}