From: Václav Slavík Date: Thu, 26 Dec 2002 23:36:34 +0000 (+0000) Subject: fixed XRCID() lookup of numeric control IDs X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/85452d74963e72780d26102ca002f5e3f09e0aaa fixed XRCID() lookup of numeric control IDs git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@18419 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/contrib/src/xrc/xmlres.cpp b/contrib/src/xrc/xmlres.cpp index 22f6b0a696..e47ea3e254 100644 --- a/contrib/src/xrc/xmlres.cpp +++ b/contrib/src/xrc/xmlres.cpp @@ -1181,10 +1181,21 @@ static XRCID_record *XRCID_Records[XRCID_TABLE_SIZE] = {NULL}; XRCID_record **rec_var = (oldrec == NULL) ? &XRCID_Records[index] : &oldrec->next; *rec_var = new XRCID_record; - (*rec_var)->id = ++XRCID_LastID; (*rec_var)->key = wxStrdup(str_id); (*rec_var)->next = NULL; + wxChar *end; + int asint = wxStrtol(str_id, &end, 10); + if (*str_id && *end == 0) + { + // if str_id was integer, keep it verbosely: + (*rec_var)->id = asint; + } + else + { + (*rec_var)->id = ++XRCID_LastID; + } + return (*rec_var)->id; } diff --git a/src/xrc/xmlres.cpp b/src/xrc/xmlres.cpp index 22f6b0a696..e47ea3e254 100644 --- a/src/xrc/xmlres.cpp +++ b/src/xrc/xmlres.cpp @@ -1181,10 +1181,21 @@ static XRCID_record *XRCID_Records[XRCID_TABLE_SIZE] = {NULL}; XRCID_record **rec_var = (oldrec == NULL) ? &XRCID_Records[index] : &oldrec->next; *rec_var = new XRCID_record; - (*rec_var)->id = ++XRCID_LastID; (*rec_var)->key = wxStrdup(str_id); (*rec_var)->next = NULL; + wxChar *end; + int asint = wxStrtol(str_id, &end, 10); + if (*str_id && *end == 0) + { + // if str_id was integer, keep it verbosely: + (*rec_var)->id = asint; + } + else + { + (*rec_var)->id = ++XRCID_LastID; + } + return (*rec_var)->id; }