From a42d65095896cb92fa0bbe87289b53cab38fcd8e Mon Sep 17 00:00:00 2001
From: xj qian <qianxj15@sina.com>
Date: 星期四, 27 六月 2024 18:09:25 +0800
Subject: [PATCH] update set arg
---
jrj/xframe/src/xstring.cpp | 15 ++++++++++++---
1 files changed, 12 insertions(+), 3 deletions(-)
diff --git a/jrj/xframe/src/xstring.cpp b/jrj/xframe/src/xstring.cpp
index 23f1c2c..3bc27b1 100644
--- a/jrj/xframe/src/xstring.cpp
+++ b/jrj/xframe/src/xstring.cpp
@@ -284,8 +284,13 @@
xstring& xstring::operator =(const xstring& rhs)
{
if (data)((KStringBlock<wchar_t>*)data)->Release();
- ((KStringBlock<wchar_t>*)rhs.data)->AddRef();
- data = rhs.data;
+ if (rhs.data)
+ {
+ ((KStringBlock<wchar_t>*)rhs.data)->AddRef();
+ data = rhs.data;
+ }
+ else
+ data = nullptr;
return *this;
}
xstring& xstring::operator =(const wchar_t* rhs)
@@ -590,7 +595,11 @@
return false;
}
-xstring xstring::replace(wchar_t* from, wchar_t* to, int pos)
+xstring xstring::replace(const wchar_t* from, const wchar_t* to)
+{
+ return replace(from, to, 0);
+}
+xstring xstring::replace(const wchar_t* from, const wchar_t* to, int pos)
{
const wchar_t* pstr = c_str();
if (!pstr) return 0;
--
Gitblit v1.9.3