不允许指针到数据的赋值运算符重载,因为含义模棱两可
This commit is contained in:
parent
9acf0b8888
commit
4fd949eaaa
|
@ -489,7 +489,7 @@ void TinyClient::DisJoin()
|
|||
// 发送的广播消息,设备类型和系统ID
|
||||
JoinMessage dm;
|
||||
dm.Kind = Type;
|
||||
dm.HardID = Sys.ID;
|
||||
dm.HardID.Set(Sys.ID, 16);
|
||||
dm.TranID = TranID;
|
||||
dm.WriteMessage(msg);
|
||||
dm.Show(true);
|
||||
|
|
|
@ -259,8 +259,7 @@ bool TinyServer::OnJoin(const TinyMessage& msg)
|
|||
dm.Address = dv->Address;
|
||||
dm.Password = dv->Pass;
|
||||
|
||||
dm.HardID.SetLength(6); // 小心不要超长
|
||||
dm.HardID = Sys.ID;
|
||||
dm.HardID.Set(Sys.ID, 6);
|
||||
dm.WriteMessage(rs);
|
||||
|
||||
Reply(rs);
|
||||
|
@ -309,8 +308,7 @@ bool TinyServer::ResetPassword(byte id)
|
|||
dm.Address = dv->Address;
|
||||
dm.Password = dv->Pass;
|
||||
|
||||
dm.HardID.SetLength(6); // 小心不要超长
|
||||
dm.HardID = Sys.ID;
|
||||
dm.HardID.Set(Sys.ID, 6);
|
||||
|
||||
dm.WriteMessage(rs);
|
||||
|
||||
|
|
8
Type.cpp
8
Type.cpp
|
@ -126,12 +126,12 @@ Array& Array::operator=(const Array& arr)
|
|||
}
|
||||
|
||||
// 重载等号运算符,使用外部指针、内部长度,用户自己注意安全
|
||||
Array& Array::operator=(const void* data)
|
||||
/*Array& Array::operator=(const void* data)
|
||||
{
|
||||
if(Length() > 0) Copy(data, Length());
|
||||
|
||||
return *this;
|
||||
}
|
||||
}*/
|
||||
|
||||
// 设置数组长度。容量足够则缩小Length,否则扩容以确保数组容量足够大避免多次分配内存
|
||||
bool Array::SetLength(int length, bool bak)
|
||||
|
@ -367,12 +367,12 @@ ByteArray::ByteArray(const String& str) : TArray(0)
|
|||
}
|
||||
|
||||
// 重载等号运算符,使用外部指针、内部长度,用户自己注意安全
|
||||
ByteArray& ByteArray::operator=(const void* data)
|
||||
/*ByteArray& ByteArray::operator=(const void* data)
|
||||
{
|
||||
if(Length() > 0) Copy(data, Length());
|
||||
|
||||
return *this;
|
||||
}
|
||||
}*/
|
||||
|
||||
// 显示十六进制数据,指定分隔字符
|
||||
String& ByteArray::ToHex(String& str, char sep, int newLine) const
|
||||
|
|
4
Type.h
4
Type.h
|
@ -108,7 +108,7 @@ public:
|
|||
// 重载等号运算符,使用另一个固定数组来初始化
|
||||
Array& operator=(const Array& arr);
|
||||
// 重载等号运算符,使用外部指针、内部长度,用户自己注意安全
|
||||
Array& operator=(const void* data);
|
||||
//Array& operator=(const void* data);
|
||||
|
||||
virtual ~Array();
|
||||
|
||||
|
@ -286,7 +286,7 @@ public:
|
|||
ByteArray(const String& str); // 不允许修改,拷贝
|
||||
|
||||
// 重载等号运算符,使用外部指针、内部长度,用户自己注意安全
|
||||
ByteArray& operator=(const void* data);
|
||||
//ByteArray& operator=(const void* data);
|
||||
|
||||
// 显示十六进制数据,指定分隔字符和换行长度
|
||||
String& ToHex(String& str, char sep = '-', int newLine = 0x10) const;
|
||||
|
|
Loading…
Reference in New Issue