diff options
Diffstat (limited to 'src/internal')
-rw-r--r-- | src/internal/pe_impl.c | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/src/internal/pe_impl.c b/src/internal/pe_impl.c index c586b63..3edbe16 100644 --- a/src/internal/pe_impl.c +++ b/src/internal/pe_impl.c @@ -10,18 +10,17 @@ int32_t pe_impl_strlen_ansi(const char * str) { - char * ch; - char * upper_bound; + const char * ch; + const char * upper_bound; - /* sanity check */ - upper_bound = (char *)str + PE_STR_MAX_SYMBOL_LEN_ALLOWED; + upper_bound = str + PE_STR_MAX_SYMBOL_LEN_ALLOWED; - for (ch = (char *)str; (ch < upper_bound) && (*ch); ch++); + for (ch=str; *ch && ch<upper_bound; ) + ch++; - if (ch < upper_bound) - return (uint32_t)(ch - str); - else - return -1; + return (ch < upper_bound) + ? ch - str + : -1; } |