project_files/hwc/rtl/misc.c
changeset 10137 a4537aab4117
parent 10132 701844ed50d3
child 10241 2dc9ff47c5b9
equal deleted inserted replaced
10136:f0da90f58c98 10137:a4537aab4117
   138 
   138 
   139 
   139 
   140 string255 fpcrtl_pchar2str(const char *s)
   140 string255 fpcrtl_pchar2str(const char *s)
   141 {
   141 {
   142     string255 result;
   142     string255 result;
   143     int rlen = strlen(s);
   143     
   144 
   144     if(!s)
   145     if(rlen > 255){
   145     {
   146         rlen = 255;
   146         result.len = 0;
   147     }
   147     } else
   148 
   148     {
   149     result.len = rlen;
   149         int rlen = strlen(s);
   150     memcpy(result.str, s, rlen);
   150 
       
   151         if(rlen > 255){
       
   152             rlen = 255;
       
   153         }
       
   154 
       
   155         result.len = rlen;
       
   156         memcpy(result.str, s, rlen);
       
   157     }
   151 
   158 
   152     return result;
   159     return result;
   153 }
   160 }
   154 
   161 
   155 
   162