Commit 07017dc1 authored by johan's avatar johan

C++11

parent 4bd40026
......@@ -93,7 +93,7 @@ if(MSVC)
list(APPEND STRICT_OPTIONS_CPP "/WX")
endif()
else()
list(APPEND STRICT_OPTIONS_CXX "-std=c++14 -O2 -g")
list(APPEND STRICT_OPTIONS_CXX "-std=c++11 -O2 -g")
#list(APPEND STRICT_OPTIONS_CPP "-Wall" "-Wuninitialized" "-Wno-error=deprecated-declarations") # turn off deprecated-declaration warning to avoid being flooded by soci.h
list(APPEND STRICT_OPTIONS_CPP "-Wall" "-Wuninitialized" "-Wno-deprecated-declarations")
list(APPEND STRICT_OPTIONS_C "-Wdeclaration-after-statement" "-Wstrict-prototypes" "-Wno-error=strict-prototypes")
......
......@@ -268,7 +268,7 @@ namespace lime {
#endif
/* open DB */
auto localStorage = std::make_unique<lime::Db>(dbFilename); // create as unique ptr, ownership is then passed to the Lime structure when instanciated
auto localStorage = std::unique_ptr<lime::Db>(new lime::Db(dbFilename)); // create as unique ptr, ownership is then passed to the Lime structure when instanciated
try {
//instanciate the correct Lime object
......@@ -318,7 +318,7 @@ namespace lime {
std::shared_ptr<LimeGeneric> load_LimeUser(const std::string &dbFilename, const std::string &userId, belle_http_provider *http_provider) {
/* open DB and load user */
auto localStorage = std::make_unique<lime::Db>(dbFilename); // create as unique ptr, ownership is then passed to the Lime structure when instanciated
auto localStorage = std::unique_ptr<lime::Db>(new lime::Db(dbFilename)); // create as unique ptr, ownership is then passed to the Lime structure when instanciated
auto curve = CurveId::unset;
long int Uid=0;
std::string x3dh_server_url;
......
......@@ -101,7 +101,7 @@ namespace lime {
void ratchetEncrypt(const std::array<uint8_t, 48> &plaintext, std::vector<uint8_t> &&AD, std::vector<uint8_t> &ciphertext);
bool ratchetDecrypt(const std::vector<uint8_t> &cipherText, const std::vector<uint8_t> &AD, std::array<uint8_t, 48> &plaintext);
auto dbSessionId(void) const {return m_dbSessionId;}; // retrieve the session's local storage id
long int dbSessionId(void) const {return m_dbSessionId;}; // retrieve the session's local storage id
};
......
......@@ -93,10 +93,10 @@ namespace lime {
public:
/* data member accessors (read only) */
auto Ns(void) const {return m_Ns;}
auto PN(void) const {return m_PN;}
uint16_t Ns(void) const {return m_Ns;}
uint16_t PN(void) const {return m_PN;}
const X<Curve> &DHs(void) const {return m_DHs;}
auto valid(void) const {return m_valid;}
bool valid(void) const {return m_valid;}
size_t size(void) {return m_size;}
/* ctor/dtor */
......
......@@ -36,6 +36,7 @@
#include <fstream>
#include <sstream>
#include <string>
#include <memory>
using namespace::std;
using namespace::lime;
......@@ -84,8 +85,8 @@ static int http_after_all(void) {
static void managersClean(std::unique_ptr<LimeManager> &alice, std::unique_ptr<LimeManager> &bob, std::string aliceDb, std::string bobDb) {
alice = nullptr;
bob = nullptr;
alice = make_unique<LimeManager>(aliceDb, prov);
bob = make_unique<LimeManager>(bobDb, prov);
alice = unique_ptr<lime::LimeManager>(new lime::LimeManager(aliceDb, prov));
bob = std::unique_ptr<lime::LimeManager>(new lime::LimeManager(bobDb, prov));
bctbx_message("Trash and reload alice and bob LimeManagers");
}
......@@ -117,8 +118,8 @@ static void x3dh_sending_chain_limit_test(const lime::CurveId curve, const std::
});
// create Manager
auto aliceManager = make_unique<LimeManager>(dbFilenameAlice, prov);
auto bobManager = make_unique<LimeManager>(dbFilenameBob, prov);
auto aliceManager = std::unique_ptr<LimeManager>(new LimeManager(dbFilenameAlice, prov));
auto bobManager = std::unique_ptr<LimeManager>(new LimeManager(dbFilenameBob, prov));
// create Random devices names
auto aliceDevice1 = makeRandomDeviceName("alice.d1.");
......@@ -286,8 +287,8 @@ static void x3dh_multiple_DRsessions_test(const lime::CurveId curve, const std::
});
// create Manager
auto aliceManager = make_unique<LimeManager>(dbFilenameAlice, prov);
auto bobManager = make_unique<LimeManager>(dbFilenameBob, prov);
auto aliceManager = std::unique_ptr<LimeManager>(new LimeManager(dbFilenameAlice, prov));
auto bobManager = std::unique_ptr<LimeManager>(new LimeManager(dbFilenameBob, prov));
// create Random devices names
auto aliceDevice1 = makeRandomDeviceName("alice.d1.");
......@@ -516,8 +517,8 @@ static void x3dh_multidev_operation_queue_test(const lime::CurveId curve, const
});
// create Manager
auto aliceManager = make_unique<LimeManager>(dbFilenameAlice, prov);
auto bobManager = make_unique<LimeManager>(dbFilenameBob, prov);
auto aliceManager = std::unique_ptr<LimeManager>(new LimeManager(dbFilenameAlice, prov));
auto bobManager = std::unique_ptr<LimeManager>(new LimeManager(dbFilenameBob, prov));
// create Random devices names
auto aliceDevice1 = makeRandomDeviceName("alice.d1.");
......@@ -749,8 +750,8 @@ static void x3dh_operation_queue_test(const lime::CurveId curve, const std::stri
});
// create Manager
auto aliceManager = make_unique<LimeManager>(dbFilenameAlice, prov);
auto bobManager = make_unique<LimeManager>(dbFilenameBob, prov);
auto aliceManager = std::unique_ptr<LimeManager>(new LimeManager(dbFilenameAlice, prov));
auto bobManager = std::unique_ptr<LimeManager>(new LimeManager(dbFilenameBob, prov));
// create Random devices names
auto aliceDevice1 = makeRandomDeviceName("alice.d1.");
......@@ -887,8 +888,8 @@ static void x3dh_basic_test(const lime::CurveId curve, const std::string &dbBase
});
// create Manager
auto aliceManager = make_unique<LimeManager>(dbFilenameAlice, prov);
auto bobManager = make_unique<LimeManager>(dbFilenameBob, prov);
auto aliceManager = std::unique_ptr<LimeManager>(new LimeManager(dbFilenameAlice, prov));
auto bobManager = std::unique_ptr<LimeManager>(new LimeManager(dbFilenameBob, prov));
// create Random devices names
auto aliceDevice1 = makeRandomDeviceName("alice.d1.");
......@@ -1163,7 +1164,7 @@ static void user_management_test(const lime::CurveId curve, const std::string &d
}
});
// we need a LimeManager
auto Manager = make_unique<LimeManager>(dbFilenameAlice, prov);
auto Manager = std::unique_ptr<LimeManager>(new LimeManager(dbFilenameAlice, prov));
auto aliceDeviceName = makeRandomDeviceName("alice.");
......@@ -1260,7 +1261,7 @@ static void user_management_test(const lime::CurveId curve, const std::string &d
dbFilenameAliceTmp.append(".tmp.sqlite3");
// create a manager and try to create alice again, it shall pass local creation(db is empty) but server shall reject it
auto ManagerTmp = make_unique<LimeManager>(dbFilenameAliceTmp,prov);
auto ManagerTmp = std::unique_ptr<LimeManager>(new LimeManager(dbFilenameAliceTmp, prov));
try {
ManagerTmp->create_user(*aliceDeviceName, x3dh_server_url, curve, callback);
BC_ASSERT_TRUE(wait_for(stack,&counters.operation_failed,counters.operation_failed+1,5000)); // we must get a callback saying all went well
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment