fix build issues on newer compilers
This commit is contained in:
parent
8652af728d
commit
ad0a63e275
|
@ -392,7 +392,7 @@ unsigned long Database::getIntValue(string& p_sql)
|
||||||
|
|
||||||
if(NULL==result)
|
if(NULL==result)
|
||||||
throw SQLException("SQL: "+p_sql+" didn't return any data, SQL query may be wrong",__FILE__,__LINE__);
|
throw SQLException("SQL: "+p_sql+" didn't return any data, SQL query may be wrong",__FILE__,__LINE__);
|
||||||
if('\0'==result[ncolumn])
|
if('\0'==result[ncolumn][0])
|
||||||
value=0; //why sqlite doesn't return 0 when there are no rows?
|
value=0; //why sqlite doesn't return 0 when there are no rows?
|
||||||
else
|
else
|
||||||
value=strtoul(result[ncolumn],NULL,10);
|
value=strtoul(result[ncolumn],NULL,10);
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
INCLUDES = $(OpenSSL_CFLAGS) $(SQLite3_CFLAGS)
|
INCLUDES = $(OpenSSL_CFLAGS) $(SQLite3_CFLAGS)
|
||||||
LIBS = $(OpenSSL_LIBS) $(SQLite3_LIBS)
|
LIBS = $(OpenSSL_LIBS) $(SQLite3_LIBS)
|
||||||
CXXFLAGS += -Wall -ansi -pedantic -Wshadow -pthread
|
CXXFLAGS += -Wall -ansi -pedantic -Wshadow -pthread -Werror --std=c++11
|
||||||
|
|
||||||
bin_PROGRAMS = hermes
|
bin_PROGRAMS = hermes
|
||||||
nodist_hermes_SOURCES = Configfile.cpp
|
nodist_hermes_SOURCES = Configfile.cpp
|
||||||
|
|
|
@ -19,6 +19,7 @@
|
||||||
*/
|
*/
|
||||||
#include "Socket.h"
|
#include "Socket.h"
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
#include <cstring>
|
||||||
|
|
||||||
int Socket::created_sockets=0;
|
int Socket::created_sockets=0;
|
||||||
|
|
||||||
|
@ -309,6 +310,10 @@ string Socket::readLine()
|
||||||
{
|
{
|
||||||
char c=0;
|
char c=0;
|
||||||
stringstream s;
|
stringstream s;
|
||||||
|
string ssl_debug_string="";
|
||||||
|
#ifdef HAVE_SSL
|
||||||
|
if (ssl_enabled) ssl_debug_string = "s";
|
||||||
|
#endif //HAVE_SSL
|
||||||
|
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
|
@ -319,11 +324,7 @@ string Socket::readLine()
|
||||||
}
|
}
|
||||||
while(c!=10&&!isClosed());
|
while(c!=10&&!isClosed());
|
||||||
|
|
||||||
LDEB(string("r") +
|
LDEB(string("r") + ssl_debug_string + ">" + s.str());
|
||||||
#ifdef HAVE_SSL
|
|
||||||
string(ssl_enabled?"s":"") +
|
|
||||||
#endif //HAVE_SSL
|
|
||||||
">" + s.str());
|
|
||||||
|
|
||||||
return s.str();
|
return s.str();
|
||||||
}
|
}
|
||||||
|
@ -372,12 +373,12 @@ void Socket::writeByte(char c)
|
||||||
|
|
||||||
void Socket::writeLine(string s)
|
void Socket::writeLine(string s)
|
||||||
{
|
{
|
||||||
|
string ssl_debug_string="";
|
||||||
LDEB(string("w") +
|
|
||||||
#ifdef HAVE_SSL
|
#ifdef HAVE_SSL
|
||||||
string(ssl_enabled?"s":"") +
|
if (ssl_enabled) ssl_debug_string = "s";
|
||||||
#endif //HAVE_SSL
|
#endif //HAVE_SSL
|
||||||
">" + s);
|
|
||||||
|
LDEB(string("w") + ssl_debug_string + ">" + s);
|
||||||
s+="\r\n";
|
s+="\r\n";
|
||||||
|
|
||||||
writeBytes((void *)s.c_str(),s.length());
|
writeBytes((void *)s.c_str(),s.length());
|
||||||
|
|
|
@ -39,6 +39,7 @@ void UnixLogger::addMessage(string file,int line,int loglevel,string logmessage)
|
||||||
|
|
||||||
if(loglevel<=cfg.getLogLevel())
|
if(loglevel<=cfg.getLogLevel())
|
||||||
{
|
{
|
||||||
|
sloglevel = LOG_INFO;
|
||||||
switch(loglevel)
|
switch(loglevel)
|
||||||
{
|
{
|
||||||
case HERMES_LOG_INFO: sloglevel=LOG_INFO;break;
|
case HERMES_LOG_INFO: sloglevel=LOG_INFO;break;
|
||||||
|
|
|
@ -20,6 +20,7 @@
|
||||||
#include "Utils.h"
|
#include "Utils.h"
|
||||||
|
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
#include <cstring>
|
||||||
|
|
||||||
extern Configfile cfg;
|
extern Configfile cfg;
|
||||||
extern LOGGER_CLASS hermes_log;
|
extern LOGGER_CLASS hermes_log;
|
||||||
|
@ -617,7 +618,7 @@ string Utils::gethostname()
|
||||||
if('\0'==buf[0])
|
if('\0'==buf[0])
|
||||||
{
|
{
|
||||||
if(cfg.getHostname()!="")
|
if(cfg.getHostname()!="")
|
||||||
strncpy(buf,cfg.getHostname().c_str(),HOST_NAME_MAX);
|
strncpy(buf,cfg.getHostname().c_str(),HOST_NAME_MAX - 1);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if(-1==::gethostname(buf,HOST_NAME_MAX))
|
if(-1==::gethostname(buf,HOST_NAME_MAX))
|
||||||
|
|
|
@ -17,6 +17,8 @@
|
||||||
*
|
*
|
||||||
* @author Juan José Gutiérrez de Quevedo <juanjo@gutierrezdequevedo.com>
|
* @author Juan José Gutiérrez de Quevedo <juanjo@gutierrezdequevedo.com>
|
||||||
*/
|
*/
|
||||||
|
#include "config.h"
|
||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <list>
|
#include <list>
|
||||||
#include <stack>
|
#include <stack>
|
||||||
|
@ -63,12 +65,12 @@ __thread unsigned long connection_id;
|
||||||
list<unsigned long> children;
|
list<unsigned long> children;
|
||||||
|
|
||||||
#ifdef HAVE_SSL
|
#ifdef HAVE_SSL
|
||||||
pthread_mutex_t ssl_locks[CRYPTO_NUM_LOCKS]={PTHREAD_MUTEX_INITIALIZER};
|
pthread_mutex_t ssl_locks[CRYPTO_num_locks()]={PTHREAD_MUTEX_INITIALIZER};
|
||||||
|
|
||||||
void ssl_locking_function(int mode,int n,const char *file,int line)
|
void ssl_locking_function(int mode,int n,const char *file,int line)
|
||||||
{
|
{
|
||||||
if(n>CRYPTO_NUM_LOCKS)
|
if(n>CRYPTO_num_locks())
|
||||||
throw Exception(_("Error, "+Utils::inttostr(n)+" is bigger than CRYPTO_NUM_LOCKS("+Utils::inttostr(CRYPTO_NUM_LOCKS)+")"),__FILE__,__LINE__);
|
throw Exception(_("Error, "+Utils::inttostr(n)+" is bigger than CRYPTO_num_locks()("+Utils::inttostr(CRYPTO_num_locks())+")"),__FILE__,__LINE__);
|
||||||
if(mode&CRYPTO_LOCK)
|
if(mode&CRYPTO_LOCK)
|
||||||
pthread_mutex_lock(&ssl_locks[n]);
|
pthread_mutex_lock(&ssl_locks[n]);
|
||||||
else
|
else
|
||||||
|
|
Loading…
Reference in a new issue