# HG changeset patch # User unc0rr # Date 1400015263 -14400 # Node ID 2dc9ff47c5b9592d8bb60359f1f587867e8ef89c # Parent bfae7354d42fa5cd7444bb4ba66b937721224514 Fix fpcrtl_strncompareA, also replace strncmp with memcmp for more efficiency diff -r bfae7354d42f -r 2dc9ff47c5b9 project_files/hwc/rtl/misc.c --- a/project_files/hwc/rtl/misc.c Fri May 09 22:36:15 2014 +0400 +++ b/project_files/hwc/rtl/misc.c Wed May 14 01:07:43 2014 +0400 @@ -108,13 +108,7 @@ bool fpcrtl_strcompare(string255 str1, string255 str2) { - FIX_STRING(str1); - FIX_STRING(str2); - if(strncmp(str1.str, str2.str, 256) == 0){ - return true; - } - - return false; + return memcmp(str1.s, str2.s, str1.len + 1) == 0; } bool fpcrtl_strcomparec(string255 a, char b) @@ -133,14 +127,14 @@ bool fpcrtl_strncompareA(astring a, astring b) { - return (a.len == b.len) && (strncmp(a.s, b.s, MAX_ANSISTRING_LENGTH) == 0); + return (a.len != b.len) || (memcmp(a.s, b.s, a.len + 1) != 0); } string255 fpcrtl_pchar2str(const char *s) { string255 result; - + if(!s) { result.len = 0;