Priorize OpenSSL 1.0 in cmake, warning fixes

This commit is contained in:
Eduardo Bart 2017-11-04 09:03:57 -02:00
parent 696610bba7
commit 8b161e1a07
9 changed files with 21 additions and 13 deletions

View File

@ -24,7 +24,7 @@
#include "map.h"
#include <framework/core/eventdispatcher.h>
void Effect::draw(const Point& dest, float scaleFactor, bool animate, int offsetX, int offsetY, LightView *lightView)
void Effect::drawEffect(const Point& dest, float scaleFactor, bool animate, int offsetX, int offsetY, LightView *lightView)
{
if(m_id == 0)
return;

View File

@ -35,7 +35,7 @@ class Effect : public Thing
};
public:
void draw(const Point& dest, float scaleFactor, bool animate, int offsetX = 0, int offsetY = 0, LightView *lightView = nullptr);
void drawEffect(const Point& dest, float scaleFactor, bool animate, int offsetX = 0, int offsetY = 0, LightView *lightView = nullptr);
void setId(uint32 id);
uint32 getId() { return m_id; }

View File

@ -1351,7 +1351,7 @@ void ProtocolGame::parsePlayerStats(const InputMessagePtr& msg)
double level = msg->getU16();
double levelPercent = msg->getU8();
if(g_game.getFeature(Otc::GameExperienceBonus))
if(g_game.getFeature(Otc::GameExperienceBonus)) {
if(g_game.getClientVersion() <= 1096) {
double experienceBonus = msg->getDouble();
} else {
@ -1361,6 +1361,7 @@ void ProtocolGame::parsePlayerStats(const InputMessagePtr& msg)
int storeBoostAddend = msg->getU16();
int huntingBoostFactor = msg->getU16();
}
}
double mana;
double maxMana;

View File

@ -155,7 +155,7 @@ void Tile::draw(const Point& dest, float scaleFactor, int drawFlags, LightView *
// effects
if(drawFlags & Otc::DrawEffects)
for(const EffectPtr& effect : m_effects)
effect->draw(dest - m_drawElevation*scaleFactor, scaleFactor, animate, m_position.x - g_map.getCentralPosition().x, m_position.y - g_map.getCentralPosition().y, lightView);
effect->drawEffect(dest - m_drawElevation*scaleFactor, scaleFactor, animate, m_position.x - g_map.getCentralPosition().x, m_position.y - g_map.getCentralPosition().y, lightView);
// top items
if(drawFlags & Otc::DrawOnTop)

View File

@ -160,7 +160,7 @@ endif()
include(FindCXX11)
# gcc compile flags
set(WARNS_FLAGS "-Wall -Wextra -Wno-unused-parameter -Wno-unused-variable -Wno-unused-result")
set(WARNS_FLAGS "-Wall -Wextra -Wno-unused -Wno-unused-parameter")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${WARNS_FLAGS} ${ARCH_FLAGS} ${CPP2011_FLAGS} -pipe")
set(CMAKE_CXX_FLAGS_COMPILESPEED "-O0")
set(CMAKE_CXX_FLAGS_DEBUG "-O0 -g")
@ -234,7 +234,7 @@ set(framework_INCLUDE_DIRS ${framework_INCLUDE_DIRS}
${Boost_INCLUDE_DIRS}
${LUA_INCLUDE_DIR}
${PHYSFS_INCLUDE_DIR}
${OpenSSL_INCLUDE_DIR}
${OPENSSL_INCLUDE_DIR}
${framework_INCLUDE_DIRS}
)

View File

@ -3,17 +3,17 @@
# OPENSSL_INCLUDE_DIR - the OpenSSL include directory
# OPENSSL_LIBRARY - the OpenSSL library
FIND_PATH(OPENSSL_INCLUDE_DIR NAMES openssl/ssl.h)
FIND_PATH(OPENSSL_INCLUDE_DIR NAMES openssl/ssl.h PATH_SUFFIXES openssl-1.0)
SET(_OPENSSL_STATIC_LIBS libssl.a)
SET(_OPENSSL_SHARED_LIBS libssl.dll.a ssl)
SET(_OPENSSL_CRYPTO_STATIC_LIBS libcrypto.a)
SET(_OPENSSL_CRYPTO_SHARED_LIBS libcrypto.dll.a crypto)
IF(USE_STATIC_LIBS)
FIND_LIBRARY(OPENSSL_LIBRARY NAMES ${_OPENSSL_STATIC_LIBS} ${_OPENSSL_SHARED_LIBS})
FIND_LIBRARY(OPENSSL_CRYPTO_LIBRARY NAMES ${_OPENSSL_CRYPTO_STATIC_LIBS} ${_OPENSSL_CRYPTO_SHARED_LIBS})
FIND_LIBRARY(OPENSSL_LIBRARY NAMES ${_OPENSSL_STATIC_LIBS} ${_OPENSSL_SHARED_LIBS} PATH_SUFFIXES openssl-1.0)
FIND_LIBRARY(OPENSSL_CRYPTO_LIBRARY NAMES ${_OPENSSL_CRYPTO_STATIC_LIBS} ${_OPENSSL_CRYPTO_SHARED_LIBS} PATH_SUFFIXES openssl-1.0)
ELSE()
FIND_LIBRARY(OPENSSL_LIBRARY NAMES ${_OPENSSL_SHARED_LIBS} ${_OPENSSL_STATIC_LIBS})
FIND_LIBRARY(OPENSSL_CRYPTO_LIBRARY NAMES ${_OPENSSL_CRYPTO_SHARED_LIBS} ${_OPENSSL_CRYPTO_STATIC_LIBS})
FIND_LIBRARY(OPENSSL_LIBRARY NAMES ${_OPENSSL_SHARED_LIBS} ${_OPENSSL_STATIC_LIBS} PATH_SUFFIXES openssl-1.0)
FIND_LIBRARY(OPENSSL_CRYPTO_LIBRARY NAMES ${_OPENSSL_CRYPTO_SHARED_LIBS} ${_OPENSSL_CRYPTO_STATIC_LIBS} PATH_SUFFIXES openssl-1.0)
ENDIF()
SET(OPENSSL_LIBRARIES ${OPENSSL_LIBRARY} ${OPENSSL_CRYPTO_LIBRARY})
INCLUDE(FindPackageHandleStandardArgs)

View File

@ -30,7 +30,7 @@
namespace stdext {
uint32_t adler32(const uint8_t *buffer, size_t size) {
register size_t a = 1, b = 0, tlen;
size_t a = 1, b = 0, tlen;
while(size > 0) {
tlen = size > 5552 ? 5552 : size;
size -= tlen;

View File

@ -143,7 +143,7 @@ std::string Crypt::xorCrypt(const std::string& buffer, const std::string& key)
{
std::string out;
out.resize(buffer.size());
register size_t i, j=0;
size_t i, j=0;
for(i=0;i<buffer.size();++i) {
out[i] = buffer[i] ^ key[j++];
if(j >= key.size())
@ -307,6 +307,8 @@ std::string Crypt::sha512Encode(const std::string& decoded_string, bool upperCas
void Crypt::rsaGenerateKey(int bits, int e)
{
// disabled because new OpenSSL changes broke
/*
RSA *rsa = RSA_new();
BIGNUM *ebn = BN_new();
BN_set_word(ebn, e);
@ -319,6 +321,7 @@ void Crypt::rsaGenerateKey(int bits, int e)
g_logger.info(std::string("e = ") + BN_bn2dec(m_rsa->e));
BN_clear_free(ebn);
RSA_free(rsa);
*/
}
void Crypt::rsaSetPublicKey(const std::string& n, const std::string& e)

View File

@ -107,18 +107,22 @@ void TiXmlBase::ConvertUTF32ToUTF8( unsigned long input, char* output, int* leng
// Scary scary fall throughs.
switch (*length)
{
/* FALLTHROUGH */
case 4:
--output;
*output = (char)((input | BYTE_MARK) & BYTE_MASK);
input >>= 6;
/* FALLTHROUGH */
case 3:
--output;
*output = (char)((input | BYTE_MARK) & BYTE_MASK);
input >>= 6;
/* FALLTHROUGH */
case 2:
--output;
*output = (char)((input | BYTE_MARK) & BYTE_MASK);
input >>= 6;
/* FALLTHROUGH */
case 1:
--output;
*output = (char)(input | FIRST_BYTE_MARK[*length]);