summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--src/internal/pe_impl.c12
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;
}