# HG changeset patch # User unc0rr # Date 1392320296 -14400 # Node ID a4537aab4117be4433ca4c45ce05c3f102ad1975 # Parent f0da90f58c98763e11ebbb392999a72dda6713b4 NULL PChar is okay diff -r f0da90f58c98 -r a4537aab4117 project_files/hwc/rtl/misc.c --- a/project_files/hwc/rtl/misc.c Thu Feb 13 14:12:04 2014 -0500 +++ b/project_files/hwc/rtl/misc.c Thu Feb 13 23:38:16 2014 +0400 @@ -140,15 +140,22 @@ string255 fpcrtl_pchar2str(const char *s) { string255 result; - int rlen = strlen(s); + + if(!s) + { + result.len = 0; + } else + { + int rlen = strlen(s); - if(rlen > 255){ - rlen = 255; + if(rlen > 255){ + rlen = 255; + } + + result.len = rlen; + memcpy(result.str, s, rlen); } - result.len = rlen; - memcpy(result.str, s, rlen); - return result; } diff -r f0da90f58c98 -r a4537aab4117 project_files/hwc/rtl/sysutils.c --- a/project_files/hwc/rtl/sysutils.c Thu Feb 13 14:12:04 2014 -0500 +++ b/project_files/hwc/rtl/sysutils.c Thu Feb 13 23:38:16 2014 +0400 @@ -163,16 +163,5 @@ string255 fpcrtl_strPas(PChar p) { - string255 s; - int l = strlen(p); - - if(l > 255){ - printf("strPas: source string length > 255\n"); - assert(0); - } - - s.len = l; - strcpy(s.str, p); - - return s; + return fpcrtl_pchar2str(p); }