On 05/18/2015 09:17 AM, Alex Henrie wrote:
- WCHAR objectW[50]; /* should be enough*/
In the past I was told to always allocate memory in multiplies of 8 bytes,[1] and I personally have started to prefer powers of 2 in particular. Alexandre seems to prefer allocating at least 64 characters for short strings like this, judging from how he amended a proposed patch of mine several years ago.[2]
- if (!LoadStringW(OLEDLG_hInstance, IDS_VERBMENU_OBJECT, objectW, sizeof(objectW)/sizeof(WCHAR))) {
static const WCHAR enobjectW[] = {'&','O','b','j','e','c','t',0};
strcpyW(objectW, enobjectW);
- }
Is this really necessary? How could LoadString fail? I recently submitted a very similar patch [3] and didn't have to provide a special fallback.
It can fail if resource is not found for example.
Just to be clear, I do really appreciate you taking the time to make sure that Wine is properly localized :-) I just don't want to see the codebase made unnecessarily complicated or inefficient.
Sure, thanks for commenting, I just sent next iteration.
-Alex
[1] https://www.winehq.org/pipermail/wine-devel/2011-December/093516.html [2] https://source.winehq.org/git/wine.git/commitdiff/6e5bba1b60f97fce34415ea30e... [3] https://www.winehq.org/pipermail/wine-patches/2015-May/139132.html