修正GCC编译警告

This commit is contained in:
大石头X2 2017-02-14 09:47:23 +08:00
parent 9aacf9d6e7
commit be55364584
11 changed files with 45 additions and 43 deletions

View File

@ -16,12 +16,14 @@
#define btn_printf(format, ...)
#endif
static Button_GrayLevelConfig* ButtonConfig = nullptr;
/******************************** 调光配置 ********************************/
Button_GrayLevelConfig::Button_GrayLevelConfig()
{
_Name = "Gray";
_Start = &OnGrayLevel;
_End = &TagEnd;
_Name = "Gray";
_Start = &OnGrayLevel;
_End = &TagEnd;
Init();
OnGrayLevel = 0xff;

View File

@ -31,7 +31,6 @@ using TAction = Delegate<Button_GrayLevel&>::TAction;
// 这里必须使用_packed关键字生成对齐的代码否则_Value只占一个字节导致后面的成员进行内存操作时错乱
//__packed class Button
// 干脆把_Value挪到最后解决问题
static Button_GrayLevelConfig* ButtonConfig = nullptr;
class Button_GrayLevel : public ByteDataPort
{

View File

@ -3,7 +3,8 @@
#include "Sys.h"
#include "Device\RTC.h"
struct
/*struct
{
byte ClksCount;
byte OldIdx; // 初始值无效
@ -14,7 +15,7 @@ struct
OldIdx = 0xff;
LastClkTim = 0;
};
}ClickStr;
}ClickStr;*/
class BaseBoard
{

View File

@ -359,25 +359,25 @@ short dns_makequery(short op, const String& name, Buffer& bs)
DNS::DNS(NetworkInterface& host, const IPAddress& dns) : Host(host)
{
Socket = host.CreateSocket(NetType::Udp);
_Socket = host.CreateSocket(NetType::Udp);
Socket->Remote.Port = 53;
Socket->Remote.Address = !dns.IsAny() ? dns : host.DNSServer;
_Socket->Remote.Port = 53;
_Socket->Remote.Address = !dns.IsAny() ? dns : host.DNSServer;
auto port = dynamic_cast<ITransport*>(Socket);
auto port = dynamic_cast<ITransport*>(_Socket);
port->Register(OnReceive, this);
}
DNS::~DNS()
{
delete Socket;
delete _Socket;
}
IPAddress DNS::Query(const String& domain, int msTimeout)
{
#if NET_DEBUG
net_printf("DNS::Query %s Timeout: %dms DNS Server : ", domain.GetBuffer(), msTimeout);
Socket->Remote.Address.Show(true);
_Socket->Remote.Address.Show(true);
#endif
auto ip = IPAddress::Parse(domain);
@ -391,7 +391,7 @@ IPAddress DNS::Query(const String& domain, int msTimeout)
_Buffer = &rs;
dns_makequery(0, domain, bs);
Socket->Send(bs);
_Socket->Send(bs);
TimeWheel tw(msTimeout);
tw.Sleep = 100;
@ -420,7 +420,7 @@ uint DNS::OnReceive(ITransport* port, Buffer& bs, void* param, void* param2)
void DNS::Process(Buffer& bs, const IPEndPoint& server)
{
// 只要来自服务器的
if(server.Address != Socket->Remote.Address) return;
if(server.Address != _Socket->Remote.Address) return;
//net_printf("DNS::Process [%d] = 0x%08X [%d] = 0x%08X \r\n", bs.Length(), bs.GetBuffer(), _Buffer->Length(), _Buffer->GetBuffer());
//bs.Show(true);

View File

@ -21,7 +21,7 @@ private:
static uint OnReceive(ITransport* port, Buffer& bs, void* param, void* param2);
void Process(Buffer& bs, const IPEndPoint& server);
Socket* Socket;
Socket* _Socket;
Array* _Buffer;
};

View File

@ -19,11 +19,11 @@
Dhcp::Dhcp(NetworkInterface& host) : Host(host)
{
Socket = host.CreateSocket(NetType::Udp);
_Socket = host.CreateSocket(NetType::Udp);
Socket->Local.Port = 68;
Socket->Remote.Port = 67;
Socket->Remote.Address = IPAddress::Broadcast();
_Socket->Local.Port = 68;
_Socket->Remote.Port = 67;
_Socket->Remote.Address = IPAddress::Broadcast();
IP = host.IP;
@ -35,14 +35,14 @@ Dhcp::Dhcp(NetworkInterface& host) : Host(host)
taskID = 0;
auto port = dynamic_cast<ITransport*>(Socket);
auto port = dynamic_cast<ITransport*>(_Socket);
port->Register(OnReceive, this);
}
Dhcp::~Dhcp()
{
Sys.RemoveTask(taskID);
delete Socket;
delete _Socket;
}
void Dhcp::SendDhcp(byte* buf, uint len)
@ -78,7 +78,7 @@ void Dhcp::SendDhcp(byte* buf, uint len)
Host.Mac.CopyTo(dhcp->ClientMac);
Buffer bs(dhcp, sizeof(DHCP_HEADER) + len);
Socket->Send(bs);
_Socket->Send(bs);
}
// 找服务器
@ -141,7 +141,7 @@ void Dhcp::Start()
}
// 发送网络请求时会自动开始
//auto port = dynamic_cast<ITransport*>(Socket);
//auto port = dynamic_cast<ITransport*>(_Socket);
//if(port) port->Open();
// 创建任务每500ms发送一次Discover
@ -161,7 +161,7 @@ void Dhcp::Stop()
{
if(!Running) return;
auto port = dynamic_cast<ITransport*>(Socket);
auto port = dynamic_cast<ITransport*>(_Socket);
if(port) port->Close();
Running = false;

View File

@ -8,7 +8,7 @@ private:
uint dhcpid; // 事务ID
uint taskID; // 任务ID
UInt64 _expired; // 目标过期时间,毫秒
Socket* Socket;
Socket* _Socket;
void Discover();
void Request();

View File

@ -98,7 +98,7 @@ static TokenController* AddMaster(TokenClient& client)
// 创建连接服务器的控制器
auto ctrl = new TokenController();
ctrl->Socket = socket;
ctrl->_Socket = socket;
// 创建客户端
client.Master = ctrl;
@ -114,7 +114,7 @@ static TokenController* AddControl(TokenClient& client, NetworkInterface* host,
// 创建连接服务器的控制器
auto ctrl = new TokenController();
ctrl->Socket = socket;
ctrl->_Socket = socket;
// 创建客户端
socket->Remote.Address = IPAddress::Broadcast();
@ -141,13 +141,13 @@ void TokenClient::CheckNet()
auto ctrl = AddMaster(*this);
if(!ctrl) return;
debug_printf("TokenClient::CheckNet %s 成功创建主连接\r\n", ctrl->Socket->Host->Name);
debug_printf("TokenClient::CheckNet %s 成功创建主连接\r\n", ctrl->_Socket->Host->Name);
}
// 检测主链接是否已经断开
else if(!mst->Socket->Host->Linked)
else if(!mst->_Socket->Host->Linked)
{
linked = false;
debug_printf("TokenClient::CheckNet %s断开切换主连接\r\n", mst->Socket->Host->Name);
debug_printf("TokenClient::CheckNet %s断开切换主连接\r\n", mst->_Socket->Host->Name);
delete mst;
Master = nullptr;
@ -170,7 +170,7 @@ void TokenClient::CheckNet()
mst->Received = dlg;
mst->Open();
Cfg->ServerIP = mst->Socket->Remote.Address.Value;
Cfg->ServerIP = mst->_Socket->Remote.Address.Value;
}
// 为其它网卡创建本地会话
@ -184,7 +184,7 @@ void TokenClient::CheckNet()
bool flag = false;
for (int i = 0; i < cs.Count(); i++)
{
if(cs[i]->Socket->Host == nis[k])
if(cs[i]->_Socket->Host == nis[k])
{
flag = true;
break;
@ -459,7 +459,7 @@ void TokenClient::SayHello(bool broadcast)
if (cs.Count() > 0)
{
auto ctrl = cs[0];
auto sock = ctrl->Socket;
auto sock = ctrl->_Socket;
//ext.EndPoint.Address = sock->Local.Address;
ext.EndPoint = sock->Local;
ext.Protocol = sock->Protocol == NetType::Udp ? 17 : 6;
@ -482,11 +482,11 @@ void TokenClient::SayHello(bool broadcast)
{
msg.OneWay = true;
//msg.State = &ctrl->Socket->Remote;
//msg.State = &ctrl->_Socket->Remote;
for (int i = 0; i < cs.Count(); i++)
{
auto ctrl = cs[i];
msg.State = &ctrl->Socket->Remote;
msg.State = &ctrl->_Socket->Remote;
if (ctrl->Port != nullptr)
{
Send(msg, ctrl);
@ -584,7 +584,7 @@ bool TokenClient::ChangeIPEndPoint(const NetUri& uri)
uri.Show(true);
auto ctrl = Master;
auto socket = ctrl->Socket;
auto socket = ctrl->_Socket;
if (socket == nullptr) return false;
ctrl->Port->Close();

View File

@ -60,7 +60,7 @@ TokenController::TokenController() : Controller(), Key(0)
MinSize = TokenMessage::MinSize;
Socket = nullptr;
_Socket = nullptr;
Server = nullptr;
ShowRemote = false;
@ -81,8 +81,8 @@ void TokenController::Open()
{
if (Opened) return;
assert(Socket, "还没有Socket呢");
if (!Port) Port = dynamic_cast<ITransport*>(Socket);
assert(_Socket, "还没有Socket呢");
if (!Port) Port = dynamic_cast<ITransport*>(_Socket);
assert(Port, "还没有传输口呢");
debug_printf("TokenNet::Inited 使用传输接口 ");
@ -92,7 +92,7 @@ void TokenController::Open()
//Port->Show(true);
#endif
Server = &Socket->Remote;
Server = &_Socket->Remote;
#if DEBUG
if (!Stat)

View File

@ -24,7 +24,7 @@ protected:
//virtual bool SendInternal(const Buffer& bs, const void* state);
public:
Socket* Socket;
Socket* _Socket;
uint Token; // 令牌
ByteArray Key; // 通信密码

View File

@ -182,7 +182,7 @@ bool TokenSession::OnHello(TokenMessage& msg)
}
ext2.Key = key;
auto sock = Control.Socket;
auto sock = Control._Socket;
//ext2.EndPoint.Address = sock->Host->IP;
ext2.EndPoint = sock->Local;