From 239ee42e5853e09d8e5bb4b9c704f05ce9181c91 Mon Sep 17 00:00:00 2001 From: midipix Date: Sep 26 2015 14:17:06 +0000 Subject: internal string functions: change the return type from size_t to uint32_t. --- diff --git a/src/internal/pe_impl.c b/src/internal/pe_impl.c index 46069e8..2611f6b 100644 --- a/src/internal/pe_impl.c +++ b/src/internal/pe_impl.c @@ -8,7 +8,7 @@ #include #include "pe_impl.h" -size_t pe_impl_strlen_ansi(const char * str) +uint32_t pe_impl_strlen_ansi(const char * str) { char * ch; char * upper_bound; @@ -19,13 +19,13 @@ size_t pe_impl_strlen_ansi(const char * str) for (ch = (char *)str; (ch < upper_bound) && (*ch); ch++); if (ch < upper_bound) - return (size_t)((intptr_t)ch - (intptr_t)str); + return (uint32_t)(ch - str); else return -1; } -size_t pe_impl_strlen_utf16(const wchar16_t * str) +uint32_t pe_impl_strlen_utf16(const wchar16_t * str) { wchar16_t * wch; wchar16_t * upper_bound; @@ -36,7 +36,7 @@ size_t pe_impl_strlen_utf16(const wchar16_t * str) for (wch = (wchar16_t *)str; (wch < upper_bound) && (*wch); wch++); if (wch < upper_bound) - return (size_t)((intptr_t)wch - (intptr_t)str); + return (uint32_t)(wch - str); else return -1; } diff --git a/src/internal/pe_impl.h b/src/internal/pe_impl.h index 09e81c9..392f6b2 100644 --- a/src/internal/pe_impl.h +++ b/src/internal/pe_impl.h @@ -12,6 +12,6 @@ struct pe_block { uint32_t size; }; -size_t pe_impl_strlen_ansi(const char * str); -size_t pe_impl_strlen_utf16(const wchar16_t * str); +uint32_t pe_impl_strlen_ansi(const char * str); +uint32_t pe_impl_strlen_utf16(const wchar16_t * str); wchar16_t pe_impl_utf16_char_to_lower(const wchar16_t c);