Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fix a build linux pb with memcpy

  • Loading branch information...
commit a935664ab50ac0cbf1db362cbcbb60e55d6305c1 1 parent a98e470
@cumulusdev cumulusdev authored
View
8 CumulusLib/CumulusLib.vcproj
@@ -248,10 +248,6 @@
>
</File>
<File
- RelativePath=".\sources\Entity.cpp"
- >
- </File>
- <File
RelativePath=".\include\Entity.h"
>
</File>
@@ -284,10 +280,6 @@
>
</File>
<File
- RelativePath=".\sources\Group.cpp"
- >
- </File>
- <File
RelativePath=".\include\Group.h"
>
</File>
View
2  CumulusLib/CumulusLib.vcxproj
@@ -129,8 +129,6 @@
<ClCompile Include="sources\TaskHandler.cpp" />
<ClCompile Include="sources\Util.cpp" />
<ClCompile Include="sources\AESEngine.cpp" />
- <ClCompile Include="sources\Entity.cpp" />
- <ClCompile Include="sources\Group.cpp" />
<ClCompile Include="sources\Peer.cpp" />
<ClCompile Include="sources\RTMFP.cpp" />
<ClCompile Include="sources\RTMFPServer.cpp" />
View
2  CumulusLib/Makefile
@@ -1,5 +1,5 @@
# source files.
-OBJECTS = Address AESEngine AMFObjectWriter AMFReader AMFSimpleObject AMFWriter BinaryReader BinaryStream BinaryWriter Client CookieComputing Cookie Cumulus Entity Flow FlowConnection FlowGroup FlowNull FlowStream FlowWriter Group Handshake Invoker Listener Logs MemoryStream Message Middle PacketReader PacketWriter Peer PoolThread PoolThreads Publication Publications QualityOfService RTMFP RTMFPReceiving RTMFPSending RTMFPServer ServerSession Session Sessions SocketManager Startable Streams Target Task TaskHandler Trigger Util
+OBJECTS = Address AESEngine AMFObjectWriter AMFReader AMFSimpleObject AMFWriter BinaryReader BinaryStream BinaryWriter Client CookieComputing Cookie Cumulus Flow FlowConnection FlowGroup FlowNull FlowStream FlowWriter Handshake Invoker Listener Logs MemoryStream Message Middle PacketReader PacketWriter Peer PoolThread PoolThreads Publication Publications QualityOfService RTMFP RTMFPReceiving RTMFPSending RTMFPServer ServerSession Session Sessions SocketManager Startable Streams Target Task TaskHandler Trigger Util
CC=g++
ifeq ($(shell uname -s),Darwin)
View
4 CumulusLib/include/Entities.h
@@ -18,7 +18,7 @@
#pragma once
#include "Cumulus.h"
-#include "string.h"
+#include <cstring>
#include <map>
namespace Cumulus {
@@ -28,7 +28,7 @@ class Entities {
public:
struct Compare {
bool operator()(const Poco::UInt8* a,const Poco::UInt8* b) const {
- return memcmp(a,b,ID_SIZE)<0;
+ return std::memcmp(a,b,ID_SIZE)<0;
}
};
View
18 CumulusLib/include/Entity.h
@@ -18,6 +18,7 @@
#pragma once
#include "Cumulus.h"
+#include <cstring>
namespace Cumulus {
@@ -25,8 +26,8 @@ namespace Cumulus {
class Entity {
public:
- Entity();
- virtual ~Entity();
+ Entity():id(){}
+ virtual ~Entity(){}
bool operator==(const Entity& other) const;
bool operator==(const Poco::UInt8* id) const;
@@ -36,5 +37,18 @@ class Entity {
const Poco::UInt8 id[ID_SIZE];
};
+inline bool Entity::operator==(const Entity& other) const {
+ return std::memcmp(id,other.id,ID_SIZE)==0;
+}
+inline bool Entity::operator==(const Poco::UInt8* id) const {
+ return std::memcmp(this->id,id,ID_SIZE)==0;
+}
+inline bool Entity::operator!=(const Entity& other) const {
+ return std::memcmp(id,other.id,ID_SIZE)!=0;
+}
+inline bool Entity::operator!=(const Poco::UInt8* id) const {
+ return std::memcmp(this->id,id,ID_SIZE)!=0;
+}
+
} // namespace Cumulus
View
16 CumulusLib/include/Group.h
@@ -20,6 +20,7 @@
#include "Cumulus.h"
#include "Peer.h"
#include <map>
+#include <cstring>
namespace Cumulus {
@@ -45,8 +46,10 @@ class GroupIterator {
class Group : public Entity {
friend class Peer;
public:
- Group(const Poco::UInt8* id);
- virtual ~Group();
+ Group(const Poco::UInt8* id) {
+ std::memcpy((Poco::UInt8*)this->id,id,ID_SIZE);
+ }
+ virtual ~Group(){}
typedef GroupIterator Iterator;
@@ -74,5 +77,14 @@ inline Poco::UInt32 Group::size() {
return _peers.size();
}
+inline Poco::UInt32 Group::Distance(Iterator& it0,Iterator& it1) {
+ return distance(it0._it,it1._it);
+}
+
+inline void Group::Advance(Iterator& it,Poco::UInt32 count) {
+ advance(it._it,count);
+}
+
+
} // namespace Cumulus
View
2  CumulusLib/include/Handshake.h
@@ -54,7 +54,7 @@ class Handshake : public ServerSession {
struct CompareCookies {
bool operator()(const Poco::UInt8* a,const Poco::UInt8* b) const {
- return memcmp(a,b,COOKIE_SIZE)<0;
+ return std::memcmp(a,b,COOKIE_SIZE)<0;
}
};
View
2  CumulusLib/include/Util.h
@@ -18,7 +18,7 @@
#include "Cumulus.h"
#include "Poco/NullStream.h"
#include "Poco/Net/SocketAddress.h"
-#include "string.h"
+#include <cstring>
#include <vector>
#include <map>
View
47 CumulusLib/sources/Entity.cpp
@@ -1,47 +0,0 @@
-/*
- Copyright 2010 OpenRTMFP
-
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License received along this program for more
- details (or else see http://www.gnu.org/licenses/).
-
- This file is a part of Cumulus.
-*/
-
-#include "Entity.h"
-#include "string.h"
-
-using namespace Poco;
-
-namespace Cumulus {
-
-Entity::Entity():id() {
-}
-
-Entity::~Entity() {
-}
-
-bool Entity::operator==(const Entity& other) const {
- return memcmp(id,other.id,ID_SIZE)==0;
-}
-bool Entity::operator==(const UInt8* id) const {
- return memcmp(this->id,id,ID_SIZE)==0;
-}
-
-bool Entity::operator!=(const Entity& other) const {
- return memcmp(id,other.id,ID_SIZE)!=0;
-}
-bool Entity::operator!=(const UInt8* id) const {
- return memcmp(this->id,id,ID_SIZE)!=0;
-}
-
-
-
-} // namespace Cumulus
View
2  CumulusLib/sources/Flow.cpp
@@ -19,7 +19,7 @@
#include "Logs.h"
#include "Util.h"
#include "Poco/NumberFormatter.h"
-#include "string.h"
+#include <cstring>
using namespace std;
using namespace Poco;
View
2  CumulusLib/sources/FlowWriter.cpp
@@ -19,7 +19,7 @@
#include "Util.h"
#include "Logs.h"
#include "Poco/NumberFormatter.h"
-#include "string.h"
+#include <cstring>
using namespace std;
using namespace Poco;
View
43 CumulusLib/sources/Group.cpp
@@ -1,43 +0,0 @@
-/*
- Copyright 2010 OpenRTMFP
-
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License received along this program for more
- details (or else see http://www.gnu.org/licenses/).
-
- This file is a part of Cumulus.
-*/
-
-#include "Group.h"
-#include "string.h"
-
-using namespace std;
-using namespace Poco;
-
-namespace Cumulus {
-
-UInt32 Group::Distance(Iterator& it0,Iterator& it1) {
- return distance(it0._it,it1._it);
-}
-
-void Group::Advance(Iterator& it,UInt32 count) {
- advance(it._it,count);
-}
-
-Group::Group(const UInt8* id) {
- memcpy((UInt8*)this->id,id,ID_SIZE);
-}
-
-Group::~Group() {
-
-}
-
-
-} // namespace Cumulus
View
2  CumulusLib/sources/Handshake.cpp
@@ -20,7 +20,7 @@
#include "Util.h"
#include "Poco/RandomStream.h"
#include "Poco/Format.h"
-#include "string.h"
+#include <cstring>
using namespace std;
using namespace Poco;
View
2  CumulusLib/sources/Invoker.cpp
@@ -16,7 +16,7 @@
*/
#include "Invoker.h"
-#include "string.h"
+#include <cstring>
using namespace std;
using namespace Poco;
View
2  CumulusLib/sources/Logs.cpp
@@ -17,7 +17,7 @@
#include "Logs.h"
#include "Util.h"
-#include "string.h"
+#include <cstring>
using namespace std;
using namespace Poco;
View
2  CumulusLib/sources/Message.cpp
@@ -16,7 +16,7 @@
*/
#include "Message.h"
-#include "string.h"
+#include <cstring>
using namespace std;
using namespace Poco;
View
2  CumulusLib/sources/Middle.cpp
@@ -24,7 +24,7 @@
#include "Poco/RandomStream.h"
#include <openssl/evp.h>
#include <openssl/hmac.h>
-#include "string.h"
+#include <cstring>
using namespace std;
using namespace Poco;
View
2  CumulusLib/sources/Publication.cpp
@@ -17,7 +17,7 @@
#include "Publication.h"
#include "Logs.h"
-#include "string.h"
+#include <cstring>
using namespace std;
using namespace Poco;
View
5 CumulusLib/sources/RTMFPServer.cpp
@@ -23,7 +23,7 @@
#include "Util.h"
#include "Logs.h"
#include "Poco/Format.h"
-#include "string.h"
+#include <cstring>
using namespace std;
@@ -276,10 +276,11 @@ UInt8 RTMFPServer::p2pHandshake(const string& tag,PacketWriter& response,const S
if(result==0x00) {
+
/// Udp hole punching normal process
UInt32 times = pSessionWanted->helloAttempt(tag);
pSessionWanted->p2pHandshake(address,tag,times,(times>0 || address.host()==pSessionWanted->peer.address.host()) ? _sessions.find(address) : NULL);
-
+
bool first=true;
list<Address>::const_iterator it2;
for(it2=pSessionWanted->peer.addresses.begin();it2!=pSessionWanted->peer.addresses.end();++it2) {
View
2  CumulusLib/sources/ServerSession.cpp
@@ -24,7 +24,7 @@
#include "Poco/URI.h"
#include "Poco/Format.h"
#include "Poco/NumberFormatter.h"
-#include "string.h"
+#include <cstring>
using namespace std;
using namespace Poco;
View
2  CumulusLib/sources/Target.cpp
@@ -19,7 +19,7 @@
#include "RTMFP.h"
#include "Cookie.h"
#include <openssl/evp.h>
-#include "string.h"
+#include <cstring>
using namespace Poco;
using namespace Net;
View
2  CumulusLib/sources/Util.cpp
@@ -20,7 +20,7 @@
#include "Poco/URI.h"
#include "Poco/FileStream.h"
#include "Poco/HexBinaryEncoder.h"
-#include "string.h"
+#include <cstring>
#include <sstream>
#include "math.h"
View
2  CumulusServer/sources/Script.h
@@ -23,7 +23,7 @@
#include "Logs.h"
#include "Poco/Format.h"
#include "Poco/NumberFormatter.h"
-#include "string.h"
+#include <cstring>
extern "C" {
View
2  CumulusServer/sources/TCPClient.cpp
@@ -19,7 +19,7 @@
#include "SocketManager.h"
#include "Logs.h"
#include "Poco/Format.h"
-#include "string.h"
+#include <cstring>
using namespace std;
View
2  CumulusServer/sources/UDPSocket.cpp
@@ -20,7 +20,7 @@
#include "Logs.h"
#include "Poco/Buffer.h"
#include "Poco/Format.h"
-#include "string.h"
+#include <cstring>
using namespace std;
Please sign in to comment.
Something went wrong with that request. Please try again.