@@ -419,8 +419,7 @@ bool UnicodeString::operator == (const UnicodeString& toCompare) const
419419 if (length ( ) != toCompare.length ( ))
420420 return false ;
421421
422- return 0 == memcmp (unicode ( ), toCompare.unicode ( ),
423- length ( ) * sizeof (WChar_t));
422+ return 0 == memcmp (unicode ( ), toCompare.unicode ( ), length ( ) * sizeof (WChar_t));
424423} // UnicodeString::operator ==
425424
426425
@@ -889,7 +888,8 @@ void UnicodeString::copy (const UnicodeString& str)
889888 _length = str.length ( );
890889 _string = new WChar_t [_length + 1 ];
891890 CHECK_NULL_PTR_ERROR (_string)
892- memcpy (_string, str.unicode ( ), _length * sizeof (WChar_t));
891+ if (0 != unicode ( )) // v 6.14.1
892+ memcpy (_string, str.unicode ( ), _length * sizeof (WChar_t));
893893 _string [_length] = 0 ;
894894} // UnicodeString::copy
895895
@@ -903,7 +903,8 @@ void UnicodeString::copy (const WChar_t* str)
903903 _length = stringLength (str);
904904 _string = new WChar_t [_length + 1 ];
905905 CHECK_NULL_PTR_ERROR (_string)
906- memcpy (_string, str, _length * sizeof (WChar_t));
906+ if (0 != unicode ( )) // v 6.14.1
907+ memcpy (_string, str, _length * sizeof (WChar_t));
907908 _string [_length] = 0 ;
908909} // UnicodeString::copy
909910
@@ -942,9 +943,10 @@ UnicodeString operator + (const UnicodeString& us1, const UnicodeString& us2)
942943 const size_t length = us1.length ( ) + us2.length ( );
943944 WChar_t* str = new WChar_t [length + 1 ];
944945 CHECK_NULL_PTR_ERROR (str)
945- memcpy (str, us1.unicode ( ), us1.length ( ) * sizeof (WChar_t));
946- memcpy (str + us1.length ( ), us2.unicode ( ),
947- us2.length ( ) * sizeof (WChar_t));
946+ if (0 != us1.unicode ( )) // v 6.14.1
947+ memcpy (str, us1.unicode ( ), us1.length ( ) * sizeof (WChar_t));
948+ if (0 != us2.unicode ( )) // v 6.14.1
949+ memcpy (str + us1.length ( ), us2.unicode ( ), us2.length ( ) * sizeof (WChar_t));
948950 str [length] = 0 ;
949951
950952 UnicodeString us (str);
0 commit comments