Skip to content

Commit

Permalink
Merge pull request #5 from fourschaft/master
Browse files Browse the repository at this point in the history
OSX compilation fixed
  • Loading branch information
amjuarez committed Apr 26, 2014
2 parents 3f29e75 + 1e14796 commit ce3a6f7
Show file tree
Hide file tree
Showing 14 changed files with 43 additions and 23 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
.DS_Store
/build
/tags
/tags
14 changes: 12 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,22 @@ cmake_minimum_required(VERSION 2.8.6)
set(VERSION "0.1")
# $Format:Packaged from commit %H%nset(COMMIT %h)%nset(REFS "%d")$

function(set_static_flags)
if (NOT APPLE)
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -static-libgcc -static-libstdc++")
endif()
endfunction(set_static_flags)

set_property(GLOBAL PROPERTY USE_FOLDERS ON)
set(CMAKE_CONFIGURATION_TYPES "Debug;Release")
enable_testing()

include_directories(src contrib/epee/include external "${CMAKE_BINARY_DIR}/version")

if(APPLE)
include_directories(SYSTEM /usr/include/malloc)
endif()

set(STATIC ${MSVC} CACHE BOOL "Link libraries statically")

if(MSVC)
Expand Down Expand Up @@ -65,7 +75,7 @@ else()
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} ${RELEASE_FLAGS}")
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} ${RELEASE_FLAGS}")
if(STATIC)
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -static-libgcc -static-libstdc++")
set_static_flags()
endif()
endif()

Expand All @@ -81,7 +91,7 @@ include_directories(SYSTEM ${Boost_INCLUDE_DIRS})
if(MINGW)
set(Boost_LIBRARIES "${Boost_LIBRARIES};ws2_32;mswsock")
elseif(NOT MSVC)
set(Boost_LIBRARIES "${Boost_LIBRARIES};rt")
set(Boost_LIBRARIES "${Boost_LIBRARIES}")
endif()

set(COMMIT_ID_IN_VERSION ON CACHE BOOL "Include commit ID in version")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ namespace epee
}
};
template<class t_storage>
struct base_serializable_types: public boost::mpl::vector<uint64_t, uint32_t, uint16_t, uint8_t, int64_t, int32_t, int16_t, int8_t, double, bool, std::string, typename t_storage::meta_entry>::type
struct base_serializable_types: public boost::mpl::vector<uint64_t, uint32_t, uint16_t, uint8_t, int64_t, int32_t, int16_t, int8_t, double, bool, std::string, typename t_storage::meta_entry>::type
{};
//-------------------------------------------------------------------------------------------------------------------
template<bool> struct selector;
Expand Down Expand Up @@ -365,4 +365,4 @@ namespace epee
return kv_serialization_overloads_impl_is_base_serializable_types<boost::mpl::contains<base_serializable_types<t_storage>, typename std::remove_const<t_type>::type>::value>::kv_unserialize(d, stg, hparent_section, pname);
}
}
}
}
4 changes: 2 additions & 2 deletions contrib/epee/include/storages/portable_storage.h
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ namespace epee
template<class t_value>
bool portable_storage::get_value(const std::string& value_name, t_value& val, hsection hparent_section)
{
BOOST_MPL_ASSERT(( boost::mpl::contains<storage_entry::types, t_value> ));
//BOOST_MPL_ASSERT(( boost::mpl::contains<storage_entry::types, t_value> ));
//TRY_ENTRY();
if(!hparent_section) hparent_section = &m_root;
storage_entry* pentry = find_storage_entry(value_name, hparent_section);
Expand Down Expand Up @@ -476,4 +476,4 @@ namespace epee
}
//---------------------------------------------------------------------------------------------------------------
}
}
}
1 change: 1 addition & 0 deletions src/crypto/oaes_lib.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ static const char _NR[] = {
#include <malloc.h>
#include <string.h>
#include <stdlib.h>
#include <stdio.h>

#ifdef WIN32
#include <process.h>
Expand Down
2 changes: 1 addition & 1 deletion src/cryptonote_core/cryptonote_format_utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ namespace cryptonote
typedef std::pair<uint64_t, crypto::public_key> output_entry;

std::vector<output_entry> outputs; //index + key
uint64_t real_output; //index in outputs vector of real output_entry
size_t real_output; //index in outputs vector of real output_entry
crypto::public_key real_out_tx_key; //incoming real tx public key
size_t real_output_in_tx_index; //index in transaction outputs vector
uint64_t amount; //money
Expand Down
4 changes: 3 additions & 1 deletion src/p2p/net_node.inl
Original file line number Diff line number Diff line change
Expand Up @@ -753,7 +753,9 @@ namespace nodetool
template<class t_payload_net_handler>
bool node_server<t_payload_net_handler>::get_local_node_data(basic_node_data& node_data)
{
time(&node_data.local_time);
time_t local_time;
time(&local_time);
node_data.local_time = local_time;
node_data.peer_id = m_config.m_peer_id;
if(!m_hide_my_port)
node_data.my_port = m_external_port ? m_external_port : m_listenning_port;
Expand Down
4 changes: 2 additions & 2 deletions src/p2p/p2p_protocol_defs.h
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ namespace nodetool
struct basic_node_data
{
uuid network_id;
time_t local_time;
uint64_t local_time;
uint32_t my_port;
peerid_type peer_id;

Expand Down Expand Up @@ -153,7 +153,7 @@ namespace nodetool

struct response
{
time_t local_time;
uint64_t local_time;
t_playload_type payload_data;
std::list<peerlist_entry> local_peerlist;

Expand Down
3 changes: 1 addition & 2 deletions src/rpc/core_rpc_server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
// Distributed under the MIT/X11 software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.


#include <boost/foreach.hpp>
#include "include_base_utils.h"
using namespace epee;
Expand Down Expand Up @@ -536,7 +535,7 @@ namespace cryptonote
if (!have_block)
{
error_resp.code = CORE_RPC_ERROR_CODE_INTERNAL_ERROR;
error_resp.message = "Internal error: can't get block by height. Height = " + req.height + '.';
error_resp.message = "Internal error: can't get block by height. Height = " + std::to_string(req.height) + '.';
return false;
}
bool responce_filled = fill_block_header_responce(blk, false, req.height, block_hash, res.block_header);
Expand Down
2 changes: 1 addition & 1 deletion src/simplewallet/simplewallet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -469,7 +469,7 @@ bool simple_wallet::refresh(const std::vector<std::string>& args)
return true;

message_writer() << "Starting refresh...";
uint64_t fetched_blocks = 0;
size_t fetched_blocks = 0;
bool ok = false;
std::ostringstream ss;
try
Expand Down
1 change: 1 addition & 0 deletions tests/core_tests/chaingen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -425,6 +425,7 @@ bool fill_tx_sources(std::vector<tx_source_entry>& sources, const std::vector<te
ts.amount = oi.amount;
ts.real_output_in_tx_index = oi.out_no;
ts.real_out_tx_key = get_tx_pub_key_from_extra(*oi.p_tx); // incoming tx public key

if (!fill_output_entries(outs[o.first], sender_out, nmix, ts.real_output, ts.outputs))
continue;

Expand Down
2 changes: 2 additions & 0 deletions tests/gtest/include/gtest/internal/gtest-port.h
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,8 @@
#define GTEST_NAME_ "Google Test"
#define GTEST_PROJECT_URL_ "http://code.google.com/p/googletest/"

# define GTEST_HAS_TR1_TUPLE 0

// Determines the version of gcc that is used to compile this.
#ifdef __GNUC__
// 40302 means version 4.3.2.
Expand Down
14 changes: 7 additions & 7 deletions tests/net_load_tests/net_load_tests.h
Original file line number Diff line number Diff line change
Expand Up @@ -212,8 +212,8 @@ namespace net_load_tests

struct request
{
size_t open_request_target;
size_t max_opened_conn_count;
uint64_t open_request_target;
uint64_t max_opened_conn_count;

BEGIN_KV_SERIALIZE_MAP()
KV_SERIALIZE(open_request_target)
Expand All @@ -240,9 +240,9 @@ namespace net_load_tests

struct response
{
size_t opened_connections_count;
size_t new_connection_counter;
size_t close_connection_counter;
uint64_t opened_connections_count;
uint64_t new_connection_counter;
uint64_t close_connection_counter;

BEGIN_KV_SERIALIZE_MAP()
KV_SERIALIZE(opened_connections_count)
Expand Down Expand Up @@ -295,7 +295,7 @@ namespace net_load_tests

struct request
{
size_t request_size;
uint64_t request_size;

BEGIN_KV_SERIALIZE_MAP()
KV_SERIALIZE(request_size)
Expand All @@ -310,7 +310,7 @@ namespace net_load_tests
struct request
{
std::string data;
size_t response_size;
uint64_t response_size;

BEGIN_KV_SERIALIZE_MAP()
KV_SERIALIZE(data)
Expand Down
8 changes: 6 additions & 2 deletions tests/performance_tests/performance_utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@

void set_process_affinity(int core)
{
#if defined(BOOST_WINDOWS)
#if defined (__APPLE__)
return;
#elif defined(BOOST_WINDOWS)
DWORD_PTR mask = 1;
for (int i = 0; i < core; ++i)
{
Expand All @@ -34,7 +36,9 @@ void set_process_affinity(int core)

void set_thread_high_priority()
{
#if defined(BOOST_WINDOWS)
#if defined(__APPLE__)
return;
#elif defined(BOOST_WINDOWS)
::SetPriorityClass(::GetCurrentProcess(), HIGH_PRIORITY_CLASS);
#elif defined(BOOST_HAS_PTHREADS)
pthread_attr_t attr;
Expand Down

0 comments on commit ce3a6f7

Please sign in to comment.