--- 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;
}
--- 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);
}