Skip to content

Bug of build libui by VS2017 #267

@yanganok

Description

@yanganok

void runMenuEvent(WORD id, uiWindow *w)
{
uiMenu *m;
uiMenuItem *item;
size_t i, j;

// this isn't optimal, but it works, and it should be just fine for most cases
for (i = 0; i < len; i++) {
	m = menus[i];
	for (j = 0; j < m->len; j++) {
		item = m->items[j];
		if (item->id == id)
			goto found;
	}
}
// no match
implbug("unknown menu ID %hu in runMenuEvent()", id);

found:
// first toggle checkboxes, if any
if (item->type == typeCheckbox)
uiMenuItemSetChecked(item, !uiMenuItemChecked(item));

// then run the event
(*(item->onClicked))(item, w, item->onClickedData);

}

C4703 May use uninitialized local pointer variables"item"

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions