diff options
author | midipix <writeonce@midipix.org> | 2016-11-19 17:24:43 -0500 |
---|---|---|
committer | midipix <writeonce@midipix.org> | 2016-11-19 17:24:43 -0500 |
commit | 11922297986fd568ad8de61d8d8b131e22bf0142 (patch) | |
tree | 66b9c796e2a84a3cdc24126681c5ebf32bdd6881 /src | |
parent | 7cd10cbc677e5b800bab04b0c7c9a8662359b6c3 (diff) | |
download | pemagine-11922297986fd568ad8de61d8d8b131e22bf0142.tar.bz2 pemagine-11922297986fd568ad8de61d8d8b131e22bf0142.tar.xz |
pe_impl_strlen_utf16(): code maintenance.
Diffstat (limited to 'src')
-rw-r--r-- | src/internal/pe_impl.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/internal/pe_impl.c b/src/internal/pe_impl.c index 3edbe16..2c4e5c9 100644 --- a/src/internal/pe_impl.c +++ b/src/internal/pe_impl.c @@ -26,16 +26,16 @@ int32_t pe_impl_strlen_ansi(const char * str) int32_t pe_impl_strlen_utf16(const wchar16_t * str) { - wchar16_t * wch; - wchar16_t * upper_bound; + const wchar16_t * wch; + const wchar16_t * upper_bound; - /* sanity check */ - upper_bound = (wchar16_t *)str + PE_STR_MAX_SYMBOL_LEN_ALLOWED; + upper_bound = str + PE_STR_MAX_SYMBOL_LEN_ALLOWED; - for (wch = (wchar16_t *)str; (wch < upper_bound) && (*wch); wch++); + for (wch=str; *wch && wch<upper_bound; ) + wch++; if (wch < upper_bound) - return ((uint32_t)(wch - str)) * sizeof(wchar16_t); + return (wch - str) * sizeof(wchar16_t); else return -1; } |