project_files/hwc/rtl/misc.c
changeset 14256 fa2e3f123a09
parent 14255 a7320c65f484
child 14261 73d514c0bdf5
equal deleted inserted replaced
14255:a7320c65f484 14256:fa2e3f123a09
   161 
   161 
   162 astring fpcrtl_pchar2astr(const char *s)
   162 astring fpcrtl_pchar2astr(const char *s)
   163 {
   163 {
   164     astring result;
   164     astring result;
   165 
   165 
   166     if(!s) {
   166     if(!s) 
       
   167     {
   167         result.len = 0;
   168         result.len = 0;
   168         return result;
   169     } else
   169     }
   170     {
   170 
   171         int rlen = strlen(s);
   171     int rlen = strlen(s);
   172 
   172 
   173         if(rlen > MAX_ANSISTRING_LENGTH){
   173     if(rlen > MAX_ANSISTRING_LENGTH){
   174             rlen = MAX_ANSISTRING_LENGTH;
   174         rlen = MAX_ANSISTRING_LENGTH;
   175         }
   175     }
   176 
   176 
   177         result.len = rlen;
   177     result.len = rlen;
   178         memcpy(result.str, s, rlen);
   178     memcpy(result.s + 1, s, rlen);
   179     }
   179 
   180 
   180     return result;
   181     return result;
   181 }
   182 }
   182 
   183 
   183 astring fpcrtl_str2astr(const string255 s)
   184 astring fpcrtl_str2astr(const string255 s)