git-svn-id: http://svn2.nishi.boats/svn/milsko/trunk@368 b9cfdab3-6d41-4d17-bbe4-086880011989
This commit is contained in:
Nishi 2025-10-16 12:07:47 +00:00
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 MwCreateWidget(MwClass widget_class, const char* name, MwWidget parent, int x, int y, unsigned int width, unsigned int height) {
MwWidget h = malloc(sizeof(*h)); MwWidget h = malloc(sizeof(*h));
h->name = malloc(strlen(name) + 1); h->name = MwStringDupliacte(name);
strcpy(h->name, name);
h->parent = parent; h->parent = parent;
h->children = NULL; h->children = NULL;
@ -270,8 +269,7 @@ void MwSetText(MwWidget handle, const char* key, const char* value) {
if(strcmp(key, MwNtitle) == 0) { if(strcmp(key, MwNtitle) == 0) {
MwLLSetTitle(handle->lowlevel, value); MwLLSetTitle(handle->lowlevel, value);
} else { } else {
char* v = malloc(strlen(value) + 1); char* v = MwStringDupliacte(value);
strcpy(v, value);
if(shgeti(handle->text, key) != -1) free(shget(handle->text, key)); if(shgeti(handle->text, key) != -1) free(shget(handle->text, key));

View file

@ -64,8 +64,7 @@ MwDirectoryEntry* MwDirectoryRead(void* handle) {
free(entry); free(entry);
return NULL; return NULL;
} }
entry->name = malloc(strlen(dir->ffd.cFileName) + 1); entry->name = MwStringDupliacte(dir->ffd.cFileName);
strcpy(entry->name, dir->ffd.cFileName);
if(dir->ffd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) { if(dir->ffd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) {
entry->type = MwDIRECTORY_DIRECTORY; entry->type = MwDIRECTORY_DIRECTORY;
@ -80,8 +79,7 @@ MwDirectoryEntry* MwDirectoryRead(void* handle) {
free(entry); free(entry);
return NULL; return NULL;
} }
entry->name = malloc(strlen(d->d_name) + 1); entry->name = MwStringDupliacte(d->d_name);
strcpy(entry->name, d->d_name);
p = malloc(strlen(dir->base) + 1 + strlen(d->d_name) + 1); p = malloc(strlen(dir->base) + 1 + strlen(d->d_name) + 1);
strcpy(p, dir->base); 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; MwListBox lb = handle->internal;
MwListBoxEntry entry; MwListBoxEntry entry;
entry.name = malloc(strlen(text) + 1); entry.name = MwStringDupliacte(text);
strcpy(entry.name, text);
entry.pixmap = pixmap; entry.pixmap = pixmap;
@ -272,8 +271,7 @@ void MwListBoxInsertMultiple(MwWidget handle, int index, char** text, MwLLPixmap
for(i = 0; i < count; i++) { for(i = 0; i < count; i++) {
MwListBoxEntry entry; MwListBoxEntry entry;
entry.name = malloc(strlen(text[i]) + 1); entry.name = MwStringDupliacte(text[i]);
strcpy(entry.name, text[i]);
entry.pixmap = NULL; entry.pixmap = NULL;
if(pixmap != NULL) entry.pixmap = pixmap[i]; 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 MwMenuAdd(MwWidget handle, MwMenu menu, const char* name) {
MwMenu m = menu == NULL ? handle->internal : menu; MwMenu m = menu == NULL ? handle->internal : menu;
MwMenu new = malloc(sizeof(*new)); MwMenu new = malloc(sizeof(*new));
new->name = malloc(strlen(name) + 1); new->name = MwStringDupliacte(name);
new->sub = NULL; new->sub = NULL;
new->wsub = NULL; new->wsub = NULL;
new->keep = 0; new->keep = 0;
strcpy(new->name, name);
arrput(m->sub, new); arrput(m->sub, new);
set_xywh(handle); set_xywh(handle);