不能用简写的模板,否则String可能命中自己的构造函数

This commit is contained in:
nnhy 2016-03-19 08:13:35 +00:00
parent be3f101820
commit efa6f926a0
4 changed files with 7 additions and 7 deletions

View File

@ -359,7 +359,7 @@ bool ShunComMessage::Read(Stream& ms)
Length = ms.ReadByte();
Code = ms.ReadUInt16();
Buffer bs(Data);
Buffer bs(Data, sizeof(Data));
if(Length > 4)
{
Kind = ms.ReadUInt16();
@ -387,7 +387,7 @@ void ShunComMessage::Write(Stream& ms) const
ms.Write(Length);
ms.Write(Code);
Buffer bs(Data);
Buffer bs((void*)Data, sizeof(Data));
if(Length > 4)
{
ms.Write(Kind);

View File

@ -214,7 +214,7 @@ void W5500::Init()
_spi = nullptr;
Led = nullptr;
Buffer(_sockets).Clear();
Buffer(_sockets, sizeof(_sockets)).Clear();
PhaseOM = 0x00;

View File

@ -80,15 +80,15 @@ void TestBuffer()
auto str2 = bs4.ToString();
assert(str2 == "AB-34-FE", "String ToString()");
Buffer bs5(cs);
Buffer bs5(cs, sizeof(cs));
debug_printf("Buffer(T (&arr)[N]) => %s\r\n", cs);
assert(bs5.GetBuffer() == (byte*)cs, "Buffer(T (&arr)[N])");
assert(bs5 == cs, "Buffer(void* p = nullptr, int len = 0)");
Buffer bs7(cs);
/*Buffer bs7(cs);
auto type = bs5.GetType();
Buffer bs6(type);
Buffer bs6(type);*/
debug_printf("内存缓冲区单元测试全部通过!\r\n");
}

View File

@ -286,7 +286,7 @@ bool TinyServer::OnJoin(const TinyMessage& msg)
if(!st)
dv->Mac.Copy(0, dv->HardID, 0, -1);
else
dv->Mac.Copy(0, st, 0, -1);
dv->Mac.Copy(0, st, -1);
if(dv->Valid())
{