git-svn-id: http://svn2.nishi.boats/svn/milsko/trunk@368 b9cfdab3-6d41-4d17-bbe4-086880011989
This commit is contained in:
NishiOwO
2025-10-16 12:07:47 +00:00
parent 1b98baa677
commit d496403c6a
4 changed files with 7 additions and 15 deletions

View File

@@ -93,8 +93,7 @@ static void llkeyrelhandler(MwLL handle, void* data) {
MwWidget MwCreateWidget(MwClass widget_class, const char* name, MwWidget parent, int x, int y, unsigned int width, unsigned int height) {
MwWidget h = malloc(sizeof(*h));
h->name = malloc(strlen(name) + 1);
strcpy(h->name, name);
h->name = MwStringDupliacte(name);
h->parent = parent;
h->children = NULL;
@@ -270,8 +269,7 @@ void MwSetText(MwWidget handle, const char* key, const char* value) {
if(strcmp(key, MwNtitle) == 0) {
MwLLSetTitle(handle->lowlevel, value);
} else {
char* v = malloc(strlen(value) + 1);
strcpy(v, value);
char* v = MwStringDupliacte(value);
if(shgeti(handle->text, key) != -1) free(shget(handle->text, key));

View File

@@ -64,8 +64,7 @@ MwDirectoryEntry* MwDirectoryRead(void* handle) {
free(entry);
return NULL;
}
entry->name = malloc(strlen(dir->ffd.cFileName) + 1);
strcpy(entry->name, dir->ffd.cFileName);
entry->name = MwStringDupliacte(dir->ffd.cFileName);
if(dir->ffd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) {
entry->type = MwDIRECTORY_DIRECTORY;
@@ -80,8 +79,7 @@ MwDirectoryEntry* MwDirectoryRead(void* handle) {
free(entry);
return NULL;
}
entry->name = malloc(strlen(d->d_name) + 1);
strcpy(entry->name, d->d_name);
entry->name = MwStringDupliacte(d->d_name);
p = malloc(strlen(dir->base) + 1 + strlen(d->d_name) + 1);
strcpy(p, dir->base);

View File

@@ -248,8 +248,7 @@ void MwListBoxInsert(MwWidget handle, int index, const char* text, MwLLPixmap pi
MwListBox lb = handle->internal;
MwListBoxEntry entry;
entry.name = malloc(strlen(text) + 1);
strcpy(entry.name, text);
entry.name = MwStringDupliacte(text);
entry.pixmap = pixmap;
@@ -272,8 +271,7 @@ void MwListBoxInsertMultiple(MwWidget handle, int index, char** text, MwLLPixmap
for(i = 0; i < count; i++) {
MwListBoxEntry entry;
entry.name = malloc(strlen(text[i]) + 1);
strcpy(entry.name, text[i]);
entry.name = MwStringDupliacte(text[i]);
entry.pixmap = NULL;
if(pixmap != NULL) entry.pixmap = pixmap[i];

View File

@@ -193,13 +193,11 @@ MwClass MwMenuClass = &MwMenuClassRec;
MwMenu MwMenuAdd(MwWidget handle, MwMenu menu, const char* name) {
MwMenu m = menu == NULL ? handle->internal : menu;
MwMenu new = malloc(sizeof(*new));
new->name = malloc(strlen(name) + 1);
new->name = MwStringDupliacte(name);
new->sub = NULL;
new->wsub = NULL;
new->keep = 0;
strcpy(new->name, name);
arrput(m->sub, new);
set_xywh(handle);