project_files/hwc/rtl/misc.c
changeset 10241 2dc9ff47c5b9
parent 10137 a4537aab4117
child 10242 0ab0d7fa1c62
equal deleted inserted replaced
10240:bfae7354d42f 10241:2dc9ff47c5b9
   106     return result;
   106     return result;
   107 }
   107 }
   108 
   108 
   109 bool fpcrtl_strcompare(string255 str1, string255 str2)
   109 bool fpcrtl_strcompare(string255 str1, string255 str2)
   110 {
   110 {
   111     FIX_STRING(str1);
   111     return memcmp(str1.s, str2.s, str1.len + 1) == 0;
   112     FIX_STRING(str2);
       
   113     if(strncmp(str1.str, str2.str, 256) == 0){
       
   114         return true;
       
   115     }
       
   116 
       
   117     return false;
       
   118 }
   112 }
   119 
   113 
   120 bool fpcrtl_strcomparec(string255 a, char b)
   114 bool fpcrtl_strcomparec(string255 a, char b)
   121 {
   115 {
   122     if(a.len == 1 && a.str[0] == b){
   116     if(a.len == 1 && a.str[0] == b){
   131     return !fpcrtl_strcompare(a, b);
   125     return !fpcrtl_strcompare(a, b);
   132 }
   126 }
   133 
   127 
   134 bool fpcrtl_strncompareA(astring a, astring b)
   128 bool fpcrtl_strncompareA(astring a, astring b)
   135 {
   129 {
   136     return (a.len == b.len) && (strncmp(a.s, b.s, MAX_ANSISTRING_LENGTH) == 0);
   130     return (a.len != b.len) || (memcmp(a.s, b.s, a.len + 1) != 0);
   137 }
   131 }
   138 
   132 
   139 
   133 
   140 string255 fpcrtl_pchar2str(const char *s)
   134 string255 fpcrtl_pchar2str(const char *s)
   141 {
   135 {
   142     string255 result;
   136     string255 result;
   143     
   137 
   144     if(!s)
   138     if(!s)
   145     {
   139     {
   146         result.len = 0;
   140         result.len = 0;
   147     } else
   141     } else
   148     {
   142     {