Re: [PATCH v3 08/10] reg: Add wchar/raw data conversion functions
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Hi, The first 7 patches look worthy of Alexandre's review. Don't resend this yet, I'd suggest to wait for Alexandre's opinion first. Am 2014-11-08 11:26, schrieb Jonathan Vollebregt:
+ static const WCHAR empty = 0; You could make this on the global scope, call it empty_wchar (or empty_string or something similar) and use it to replace the RegDeleteKeyA with RegDeleteKeyW. That's only a minor style suggestion though, not a requriement.
+ FIXME("Check for integer overflow.\n"); Print this only if i == UINT_MAX. If i is smaller you know no overflow has happened.
+ if (0) + return ERROR_ARITHMETIC_OVERFLOW; ... + case ERROR_NOT_NUMBER: + reg_message(STRING_NOT_INT_OR_NEG); + return; + case ERROR_ARITHMETIC_OVERFLOW: + reg_message(STRING_ERANGE); + return; I don't like the dead code. It also seems that native prints the same error message in both cases, so you don't need to separate between underflows, overflows and strings that are not numbers.
-----BEGIN PGP SIGNATURE----- Version: GnuPG v2 Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQIcBAEBAgAGBQJUXiejAAoJEN0/YqbEcdMwWTsP/2HaBgIt6J3EqvC+jpj42MPs tgHXaZ/lhLxUTtHCcnSzsrVt5zmVN7AOnET54KQFHjbY2OoEcT9PpDDjW/9LVGTc dj0ciXNpOLuo6MdYWbjmTMtIFVBPMISSYJks2FxvZ1peYa5g+dQQZ6blHWzlcA1k dLK7UHPeh5kyHACgbr3i0wdL9CNeQ9pafWCUtpnZwxHbXVWlOB1XRZZumKg7snz8 QyLDJylKzYZEJ6CBjU5YxZKl/NXrCoiHplhkF8Tddl8Xmh+AqpWnvMwsWBbiFgXC ZybdSnHY0vvCojJPb9dYpscbY2uy2Xjap2t8a61xlI288/Tz+8tvnm3qkd99i13w S9Tf2TGmhHKN1DG/ljnvALRh9JTYH20jFf/lvgZOApew4iyuHWHsLKdjp9LvpwGW ogIpBHT+kpNPSHuPgbHm9lK/k2OAYBGUZqbH2c0bznQdVWUqEABdR/cMM/wVjYbs LpUdstKs2oLbhr2gxvLkX0C3f4zdowetYnlnynuL1S+krcAKeQgPxE14MtwKeX49 rYeT931uOvhYi9Dh8a0DU8FTVfI9DKAbRfcBRt81AgJ6zymDC050s2MkELZTyDod WhPrkpXV/FUOsn2Sef0yxI78XtgbaaGEUIdBz9rThVvJNy4Wrw7zA2MICUhgEQe1 S5rqOajVwtKqqjX0JeJJ =CJwM -----END PGP SIGNATURE-----
+ static const WCHAR empty = 0; You could make this on the global scope, call it empty_wchar (or empty_string or something similar) and use it to replace the RegDeleteKeyA with RegDeleteKeyW. That's only a minor style suggestion though, not a requriement.
Or perhaps I could just replace it entirely with `(WCHAR *) "\0"` but it feels a bit hacky. Would that be allowed?
+ if (0) + return ERROR_ARITHMETIC_OVERFLOW; ... + case ERROR_NOT_NUMBER: + reg_message(STRING_NOT_INT_OR_NEG); + return; + case ERROR_ARITHMETIC_OVERFLOW: + reg_message(STRING_ERANGE); + return; I don't like the dead code. It also seems that native prints the same error message in both cases, so you don't need to separate between underflows, overflows and strings that are not numbers.
Is the error message generic enough that I could just return ERROR_INVALID_DATA and let the default case handle it? (That error message is "The data is invalid." by the way)
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Am 2014-11-08 15:46, schrieb Jonathan Vollebregt:
Or perhaps I could just replace it entirely with `(WCHAR *) "\0"` but it feels a bit hacky. Would that be allowed? I don't like it. Defining a static const WCHAR would be consistent with the other WCHAR strings.
Is the error message generic enough that I could just return ERROR_INVALID_DATA and let the default case handle it? (That error message is "The data is invalid." by the way) I have a German Windows here. The message is something like "Error: Invalid Syntax. Enter a valid numerical value for '/d'."
Original German: "Fehler: ungültige Syntax. Geben Sie einen gültigen numerischen Wert für '/d' ein." -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQIcBAEBAgAGBQJUX2epAAoJEN0/YqbEcdMwcV8P/13JY9H4638twh1RoauSdhh2 IFhs6kCQ99iZ8x8EOw4fmvKh/HX91JLdCMxPtv++wXlEfIAp1NF3XACuohmFr2en KDc/+Hn5NE2VDjvKzrV3yiE/AxcFLT5ZmIVfQuC0kq1muHib04n1fegEsikA+KgE 1lP5xIshWn3h9ZFeMfmysrY8o/Em/Ry8j8wlV8KXYyS9vFN484P8uDM6/xvuOgIw EpEORAcgS94uUCL9EVGs1gQAgowGeRfyvBDuatRhAdM+bY2/6Qic2iC5+hcxaNDu 1ujZAJKeW/VMlZ1cjyduwMDtiJWwBAdZTWmsO54Y3AqZR5CKyLbihDXluv6UBW2T G0gWq7sLC2s86CQO8w1zvmlh9iXnqwe/W4xamcNJpqGwjHp9TYKVzvm0Sa+e3Eq9 r0iNScsi9wO6nhnPd+HHy5/+ylcAR76PomCXbDCcl5damsz2XPiaO9VOvWuzIuEO QDQHP/VJ14ncDLEjZoQmeWHauUHkvL2KUftGJYUqKO8lPrOB8ve43DTc+5Qe//dO uaFSNdDNbBVRbQ3ueq/Mw+uaJ2Cy7EkaFs/Wx1e3XyGkYN6DycMIkvAXH/5IyJqp kUEhePYN+D7HgI1oyi/owCzsK9xZOoZtgqL3blt/Xi0P6zDSgjQxcpLTLnHR9Rep 2RAvHAVNa+XkIPrCshHq =w2dP -----END PGP SIGNATURE-----
participants (2)
-
Jonathan Vollebregt -
Stefan Dösinger