Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/SoftEtherVPN/SoftEtherVPN_Stable.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaiyuu Nobori <da.git@softether.co.jp>2016-11-27 11:25:03 +0300
committerGitHub <noreply@github.com>2016-11-27 11:25:03 +0300
commit5cae447c79119509bdf2ccdd64bee839bf2d3013 (patch)
tree9381127b64a4ad86ef6df4861a9c63f7437ff3d7
parent36591082c457f0c8c1f8813f0fd5716ec7b51776 (diff)
parentd1ea47eb66e87a25d821a81af780ca30c0963929 (diff)
Merge pull request #229 from chipitsine/master
cppcheck issues
-rw-r--r--src/Cedar/Admin.c8
-rw-r--r--src/Cedar/Client.c4
-rw-r--r--src/Cedar/Connection.c4
-rw-r--r--src/Cedar/SM.c2
-rw-r--r--src/Cedar/UdpAccel.c2
-rw-r--r--src/Cedar/Virtual.c6
-rw-r--r--src/Cedar/WebUI.c2
-rw-r--r--src/Mayaqua/FileIO.c2
-rw-r--r--src/Mayaqua/TcpIp.c4
9 files changed, 17 insertions, 17 deletions
diff --git a/src/Cedar/Admin.c b/src/Cedar/Admin.c
index 5e2ea80a..4dfe3ac1 100644
--- a/src/Cedar/Admin.c
+++ b/src/Cedar/Admin.c
@@ -11840,12 +11840,12 @@ void InRpcHubEnumCa(RPC_HUB_ENUM_CA *t, PACK *p)
void OutRpcHubEnumCa(PACK *p, RPC_HUB_ENUM_CA *t)
{
UINT i;
- PackAddStr(p, "HubName", t->HubName);
// Validate arguments
if (t == NULL || p == NULL)
{
return;
}
+ PackAddStr(p, "HubName", t->HubName);
for (i = 0;i < t->NumCa;i++)
{
@@ -12313,12 +12313,12 @@ void InRpcEnumAccessList(RPC_ENUM_ACCESS_LIST *a, PACK *p)
void OutRpcEnumAccessList(PACK *p, RPC_ENUM_ACCESS_LIST *a)
{
UINT i;
- PackAddStr(p, "HubName", a->HubName);
// Validate arguments
if (a == NULL || p == NULL)
{
return;
}
+ PackAddStr(p, "HubName", a->HubName);
for (i = 0;i < a->NumAccess;i++)
{
@@ -12573,12 +12573,12 @@ void InRpcEnumUser(RPC_ENUM_USER *t, PACK *p)
void OutRpcEnumUser(PACK *p, RPC_ENUM_USER *t)
{
UINT i;
- PackAddStr(p, "HubName", t->HubName);
// Validate arguments
if (t == NULL || p == NULL)
{
return;
}
+ PackAddStr(p, "HubName", t->HubName);
for (i = 0;i < t->NumUser;i++)
{
@@ -12787,12 +12787,12 @@ void InRpcEnumSession(RPC_ENUM_SESSION *t, PACK *p)
void OutRpcEnumSession(PACK *p, RPC_ENUM_SESSION *t)
{
UINT i;
- PackAddStr(p, "HubName", t->HubName);
// Validate arguments
if (t == NULL || p == NULL)
{
return;
}
+ PackAddStr(p, "HubName", t->HubName);
for (i = 0;i < t->NumSession;i++)
{
diff --git a/src/Cedar/Client.c b/src/Cedar/Client.c
index d4dd39be..00baa32b 100644
--- a/src/Cedar/Client.c
+++ b/src/Cedar/Client.c
@@ -2181,13 +2181,13 @@ BUF *CiAccountToCfg(RPC_CLIENT_CREATE_ACCOUNT *t)
// RPC dispatch routine
PACK *CiRpcDispatch(RPC *rpc, char *name, PACK *p)
{
- CLIENT *c = rpc->Param;
PACK *ret;
// Validate arguments
if (rpc == NULL || name == NULL || p == NULL)
{
return NULL;
}
+ CLIENT *c = rpc->Param;
ret = NewPack();
@@ -6029,11 +6029,11 @@ L_TRY:
ReleaseSock(s);
ret = ZeroMalloc(sizeof(REMOTE_CLIENT));
- ret->Rpc = rpc;
rpc->Param = ret;
if (ret != NULL)
{
+ ret->Rpc = rpc;
RPC_CLIENT_VERSION t;
Zero(&t, sizeof(t));
CcGetClientVersion(ret, &t);
diff --git a/src/Cedar/Connection.c b/src/Cedar/Connection.c
index ada6ecc2..517096e4 100644
--- a/src/Cedar/Connection.c
+++ b/src/Cedar/Connection.c
@@ -1030,7 +1030,7 @@ void ConnectionSend(CONNECTION *c, UINT64 now)
UINT size;
SESSION *s;
HUB *hub = NULL;
- bool use_qos;
+ bool use_qos = false;
// Validate arguments
if (c == NULL)
{
@@ -1038,11 +1038,11 @@ void ConnectionSend(CONNECTION *c, UINT64 now)
}
s = c->Session;
- use_qos = s->QoS;
if (s != NULL)
{
hub = s->Hub;
+ use_qos = s->QoS;
}
// Protocol
diff --git a/src/Cedar/SM.c b/src/Cedar/SM.c
index a45213b4..92471e24 100644
--- a/src/Cedar/SM.c
+++ b/src/Cedar/SM.c
@@ -872,7 +872,6 @@ UINT SmDDnsDlg(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param)
// Get the ddns key from the server configuration file
static UINT SmDdnsGetKey(char *key, SM_DDNS *d){
- RPC *rpc = d->s->Rpc;
RPC_CONFIG config;
UINT err;
BUF *buf;
@@ -882,6 +881,7 @@ static UINT SmDdnsGetKey(char *key, SM_DDNS *d){
if(d == NULL || d->s == NULL || key == NULL){
return ERR_INTERNAL_ERROR;
}
+ RPC *rpc = d->s->Rpc;
Zero(&config, sizeof(config));
err = ScGetConfig(d->s->Rpc, &config);
diff --git a/src/Cedar/UdpAccel.c b/src/Cedar/UdpAccel.c
index 8b5b595f..58d1a621 100644
--- a/src/Cedar/UdpAccel.c
+++ b/src/Cedar/UdpAccel.c
@@ -116,7 +116,6 @@
// Polling process
void UdpAccelPoll(UDP_ACCEL *a)
{
- UCHAR *tmp = a->TmpBuf;
IP nat_t_ip;
UINT num_ignore_errors = 0;
// Validate arguments
@@ -124,6 +123,7 @@ void UdpAccelPoll(UDP_ACCEL *a)
{
return;
}
+ UCHAR *tmp = a->TmpBuf;
Lock(a->NatT_Lock);
{
diff --git a/src/Cedar/Virtual.c b/src/Cedar/Virtual.c
index e2d06723..a17892e0 100644
--- a/src/Cedar/Virtual.c
+++ b/src/Cedar/Virtual.c
@@ -2386,7 +2386,6 @@ bool NnTestConnectivity(NATIVE_STACK *a, TUBE *halt_tube)
UINT64 next_send_tick = 0;
UINT64 giveup_time;
IPC *ipc;
- UINT src_port = NnGenSrcPort(a->IsIpRawMode);
INTERRUPT_MANAGER *interrupt;
TUBE *tubes[3];
UINT num_tubes = 0;
@@ -2399,6 +2398,7 @@ bool NnTestConnectivity(NATIVE_STACK *a, TUBE *halt_tube)
{
return false;
}
+ UINT src_port = NnGenSrcPort(a->IsIpRawMode);
Copy(&using_dns, &a->DnsServerIP, sizeof(IP));
@@ -3997,7 +3997,6 @@ bool NatTransactIcmp(VH *v, NAT_ENTRY *n)
void *buf;
UINT recv_size;
BLOCK *block;
- UINT dest_port = n->DestPort;
IP dest_ip;
UINT num_ignore_errors = 0;
// Validate arguments
@@ -4005,6 +4004,7 @@ bool NatTransactIcmp(VH *v, NAT_ENTRY *n)
{
return true;
}
+ UINT dest_port = n->DestPort;
if (n->DisconnectNow)
{
@@ -4200,7 +4200,6 @@ bool NatTransactUdp(VH *v, NAT_ENTRY *n)
void *buf;
UINT recv_size;
BLOCK *block;
- UINT dest_port = n->DestPort;
IP dest_ip;
UINT num_ignore_errors;
// Validate arguments
@@ -4208,6 +4207,7 @@ bool NatTransactUdp(VH *v, NAT_ENTRY *n)
{
return true;
}
+ UINT dest_port = n->DestPort;
if (n->DisconnectNow)
{
diff --git a/src/Cedar/WebUI.c b/src/Cedar/WebUI.c
index e488835f..f71c385f 100644
--- a/src/Cedar/WebUI.c
+++ b/src/Cedar/WebUI.c
@@ -1725,12 +1725,12 @@ static wchar_t *WuUniReadFile(char *filename)
static void WuUniReplace(wchar_t **buf, wchar_t *from, wchar_t *to)
{
UINT dstsize;
- wchar_t *oldbuf = *buf;
if(buf == NULL || from == NULL || to == NULL)
{
return;
}
+ wchar_t *oldbuf = *buf;
dstsize = (UniCalcReplaceStrEx(*buf, from, to, true) + 1) * sizeof(wchar_t);
*buf = (wchar_t*)Malloc(dstsize);
diff --git a/src/Mayaqua/FileIO.c b/src/Mayaqua/FileIO.c
index 49fbec95..02abafb0 100644
--- a/src/Mayaqua/FileIO.c
+++ b/src/Mayaqua/FileIO.c
@@ -380,13 +380,13 @@ void ZipAddFileStart(ZIP_PACKER *p, char *name, UINT size, UINT64 dt, UINT attri
// Add data to the file
UINT ZipAddFileData(ZIP_PACKER *p, void *data, UINT pos, UINT len)
{
- UINT total_size = p->CurrentFile->CurrentSize + len;
UINT ret;
// Validate arguments
if (p == NULL)
{
return 0;
}
+ UINT total_size = p->CurrentFile->CurrentSize + len;
if (total_size > p->CurrentFile->Size)
{
return 0;
diff --git a/src/Mayaqua/TcpIp.c b/src/Mayaqua/TcpIp.c
index 39c43c09..5bed26a7 100644
--- a/src/Mayaqua/TcpIp.c
+++ b/src/Mayaqua/TcpIp.c
@@ -1834,9 +1834,9 @@ PKT *ParsePacketEx4(UCHAR *buf, UINT size, bool no_l3, UINT vlan_type_id, bool b
if ((p->TypeL3 == L3_IPV4 || p->TypeL3 == L3_IPV6) && p->TypeL4 == L4_TCP)
{
TCP_HEADER *tcp = p->L4.TCPHeader;
- if (tcp->DstPort == port_raw || tcp->DstPort == port_raw2)
+ if (tcp != NULL && (!((tcp->Flag & TCP_SYN) || (tcp->Flag & TCP_RST) || (tcp->Flag & TCP_FIN))))
{
- if (tcp != NULL && (!((tcp->Flag & TCP_SYN) || (tcp->Flag & TCP_RST) || (tcp->Flag & TCP_FIN))))
+ if (tcp->DstPort == port_raw || tcp->DstPort == port_raw2)
{
if (p->PayloadSize >= 1)
{