diff --git a/other/mysqlclient_main.cpp b/other/mysqlclient_main.cpp index d4a398c..2977683 100644 --- a/other/mysqlclient_main.cpp +++ b/other/mysqlclient_main.cpp @@ -40,7 +40,7 @@ void setUpArgs(ArgParse &argParse) } -void getArgs( int argc, char* argv[], +void getArgs( int argc, const char* argv[], ArgParse &argParse, std::string &host, std::string &user, @@ -61,7 +61,7 @@ void getArgs( int argc, char* argv[], } -bool checkArgs( int argc, char* argv[], +bool checkArgs( int argc, const char* argv[], ArgParse &argParse, std::string &host, std::string &user, @@ -108,7 +108,7 @@ void printResults(std::list &results) } -int main(int argc, char* argv[] ) +int main(int argc, const char* argv[] ) { Logger::createInstance(); Logger::init(std::cout); diff --git a/other/sslclient_main.cpp b/other/sslclient_main.cpp index 1bfc02f..24511ae 100644 --- a/other/sslclient_main.cpp +++ b/other/sslclient_main.cpp @@ -1,12 +1,12 @@ -// gpp sslclient_main.cpp -o sslclient -I../include ../src/Logger.cpp ../src/Thread.cpp ../src/Socket.cpp -lpthread ../src/SocketClient.cpp ../src/Poll.cpp ../src/Connection.cpp ../src/SslConnection.cpp -lssl -lcrypto ../src/TcpConnection.cpp ../src/Addrinfo.cpp - - #include "Logger.hpp" #include "Message.hpp" #include "SslConnection.hpp" #include "SocketClient.hpp" +#include "../test/SimpleMessage.hpp" + +#include #include #include @@ -15,53 +15,6 @@ #include - - -class SimpleMessage : public Message -{ -public: - - SimpleMessage( void *msgParam = 0) - : Message(msgParam) - { - TRACE; - } - - bool buildMessage( const void *msgPart, - const size_t msgLen ) - { - TRACE; - m_buffer = std::string( (const char*) msgPart, msgLen ); - onMessageReady(); - return true; - } - - void onMessageReady() - { - TRACE; - - LOG( Logger::INFO, std::string("Got reply from server: "). - append(m_buffer).c_str() ); - - *( static_cast(m_param) ) = true; - } - - Message* clone() - { - TRACE; - return new SimpleMessage(m_param); - } - -protected: - - size_t getExpectedLength() - { - TRACE; - return 0; - } -}; - - int main(int argc, char* argv[] ) { if ( argc != 4 ) { diff --git a/other/tcpclient_main.cpp b/other/tcpclient_main.cpp index 5f44188..de34472 100644 --- a/other/tcpclient_main.cpp +++ b/other/tcpclient_main.cpp @@ -1,6 +1,3 @@ -// gpp tcpclient_main.cpp -o client -I../include ../src/Logger.cpp ../src/Thread.cpp ../src/Socket.cpp -lpthread ../src/SocketClient.cpp ../src/Poll.cpp ../src/SocketConnection.cpp ../src/TcpConnection.cpp - - #include "Logger.hpp" #include "Common.hpp" @@ -76,7 +73,6 @@ int main(int argc, char* argv[] ) Logger::setLogLevel(Logger::FINEST); bool finished = false; - SimpleMessage msg(&finished); TcpConnection conn(argv[1], argv[2], &msg); diff --git a/other/tcpserver_main.cpp b/other/tcpserver_main.cpp index 4744ee8..3579f13 100644 --- a/other/tcpserver_main.cpp +++ b/other/tcpserver_main.cpp @@ -1,6 +1,3 @@ -// gpp tcpserver_main.cpp -o server -I../include ../src/Logger.cpp ../src/Socket.cpp -ggdb ../src/SocketServer.cpp ../src/SocketConnection.cpp ../src/Poll.cpp ../src/TcpConnection.cpp - - #include "Logger.hpp" #include "Common.hpp" diff --git a/src/ArgParse.cpp b/src/ArgParse.cpp index b1822fc..c6cb325 100644 --- a/src/ArgParse.cpp +++ b/src/ArgParse.cpp @@ -72,7 +72,7 @@ void ArgParse::addArgument(const std::string arg, void ArgParse::parseArgs(int argc, - char* argv[]) + const char* argv[]) { std::list argList; for (int i = 0; i < argc; ++i ) diff --git a/test/test_ArgParse.hpp b/test/test_ArgParse.hpp index 1323044..40cdaf1 100644 --- a/test/test_ArgParse.hpp +++ b/test/test_ArgParse.hpp @@ -61,9 +61,9 @@ public: ArgParse::STRING ); int argc = 3; - char *argv[] = { (char*)"test", - (char*)"-u", - (char*)"username" }; + const char *argv[] = { "test", + "-u", + "username" }; argParse.parseArgs(argc, argv); @@ -102,12 +102,12 @@ public: argParse.addArgument("-b", "bool", ArgParse::BOOL); int argc = 10; - char *argv[] = { (char*)"test", - (char*)"-i", (char*)"12", - (char*)"-f", (char*)"12.12", - (char*)"-n", - (char*)"-s", (char*)"forever", - (char*)"-b", (char*)"false" }; + const char *argv[] = { "test", + "-i", "12", + "-f", "12.12", + "-n", + "-s", "forever", + "-b", "false" }; argParse.parseArgs(argc, argv);