Skip to content

Commit

Permalink
Merge pull request #661 from crowning-/v13-evo
Browse files Browse the repository at this point in the history
v13-evo: compiling + linking errors fixed; version bump
  • Loading branch information
evan82 committed Dec 20, 2015
2 parents 0ee1650 + 9df6e99 commit fd10f4d
Show file tree
Hide file tree
Showing 8 changed files with 80 additions and 85 deletions.
4 changes: 2 additions & 2 deletions configure.ac
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
dnl require autoconf 2.60 (AS_ECHO/AS_ECHO_N)
AC_PREREQ([2.60])
define(_CLIENT_VERSION_MAJOR, 0)
define(_CLIENT_VERSION_MINOR, 12)
define(_CLIENT_VERSION_MINOR, 13)
define(_CLIENT_VERSION_REVISION, 0)
define(_CLIENT_VERSION_BUILD, 55)
define(_CLIENT_VERSION_BUILD, 0)
define(_CLIENT_VERSION_IS_RELEASE, true)
define(_COPYRIGHT_YEAR, 2015)
AC_INIT([Dash Core],[_CLIENT_VERSION_MAJOR._CLIENT_VERSION_MINOR._CLIENT_VERSION_REVISION],[info@dashpay.io],[dash])
Expand Down
4 changes: 2 additions & 2 deletions src/clientversion.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@

//! These need to be macros, as clientversion.cpp's and dash*-res.rc's voodoo requires it
#define CLIENT_VERSION_MAJOR 0
#define CLIENT_VERSION_MINOR 12
#define CLIENT_VERSION_MINOR 13
#define CLIENT_VERSION_REVISION 0
#define CLIENT_VERSION_BUILD 55
#define CLIENT_VERSION_BUILD 0

//! Set to true for release, false for prerelease or test build
#define CLIENT_VERSION_IS_RELEASE true
Expand Down
5 changes: 0 additions & 5 deletions src/evo/dapi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,11 @@
// Distributed under the MIT/X11 software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.


#include "main.h"
#include "core_io.h"
#include "db.h"
#include "init.h"
#include "dapi.h"
#include "file.h"
#include "json/json_spirit.h"
#include "json/json_spirit_value.h"


int nError;
std::string strErrorMessage;
Expand Down
34 changes: 0 additions & 34 deletions src/evo/dapi.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,40 +30,6 @@
using namespace std;
using namespace json_spirit;

std::string GetProfileFile(std::string strUID)
{
boost::filesystem::path filename = GetDataDirectory() / "users" / strUID;
return filename.c_str();
}

std::string GetPrivateDataFile(std::string strUID, int nSlot)
{
std::string strFilename = strUID + "." + boost::lexical_cast<std::string>(nSlot);
boost::filesystem::path filename = GetDataDirectory() / "users" / strFilename;
return filename.c_str();
}


std::string escapeJsonString(const std::string& input) {
std::ostringstream ss;
for (auto iter = input.cbegin(); iter != input.cend(); iter++) {
//C++98/03:
//for (std::string::const_iterator iter = input.begin(); iter != input.end(); iter++) {
switch (*iter) {
case '\\': ss << "\\\\"; break;
case '"': ss << "\\\""; break;
case '/': ss << "\\/"; break;
case '\b': ss << "\\b"; break;
case '\f': ss << "\\f"; break;
case '\n': ss << "\\n"; break;
case '\r': ss << "\\r"; break;
case '\t': ss << "\\t"; break;
default: ss << *iter; break;
}
}
return ss.str();
}

class CDAPI
{
private:
Expand Down
37 changes: 2 additions & 35 deletions src/evo/file.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
#include "compat/sanity.h"
#include "key.h"
#include "main.h"
#include "file.h"

#include <stdint.h>
#include <stdio.h>
Expand All @@ -34,38 +33,6 @@ using namespace std;
// TODO: What include is required for this?
#define CLIENT_VERSION 1

boost::filesystem::path GetDataDirectory()
{
string strDataDir2 = GetArg("-datadir2", "");
if(strDataDir2 != "") return strDataDir2;

namespace fs = boost::filesystem;
// Windows < Vista: C:\Documents and Settings\Username\Application Data\Dash
// Windows >= Vista: C:\Users\Username\AppData\Roaming\Dash
// Mac: ~/Library/Application Support/Dash
// Unix: ~/.dash
#ifdef WIN32
// Windows
return GetSpecialFolderPath(CSIDL_APPDATA) / "Dash";
#else
fs::path pathRet;
char* pszHome = getenv("HOME");
if (pszHome == NULL || strlen(pszHome) == 0)
pathRet = fs::path("/");
else
pathRet = fs::path(pszHome);
#ifdef MAC_OSX
// Mac
pathRet /= "Library/Application Support";
TryCreateDirectory(pathRet);
return pathRet / "DashData";
#else
// Unix
return pathRet / ".dash-data";
#endif
#endif
}

class CDriveFile
{
private:
Expand Down Expand Up @@ -103,7 +70,7 @@ class CDriveFile

ReadResult Read()
{
std::ifstream t(strPath);
std::ifstream t(strPath.c_str());
std::string str((std::istreambuf_iterator<char>(t)),
std::istreambuf_iterator<char>());

Expand All @@ -122,7 +89,7 @@ class CDriveFile
{
LOCK(cs);

ofstream os( strPath );
ofstream os( strPath.c_str() );
json_spirit::write( obj, os );
os.close();

Expand Down
9 changes: 2 additions & 7 deletions src/rpcdapi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,10 @@
#include "rpcserver.h"
#include "utilmoneystr.h"
#include "evo/dapi.h"
#include "evo/file.h"
// #include "evo/file.h"

#include "util.h"

#include <stdint.h>

#include "json/json_spirit_value.h"
#include "univalue/univalue.h"

#include <fstream>
using namespace json_spirit;
using namespace std;
Expand Down Expand Up @@ -87,7 +82,7 @@ Value dapif(const Array& params, bool fHelp)
*/

std::string strPath = params[0].get_str();
std::ifstream t(strPath);
std::ifstream t(strPath.c_str());
std::string str((std::istreambuf_iterator<char>(t)),
std::istreambuf_iterator<char>());

Expand Down
65 changes: 65 additions & 0 deletions src/util.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -414,6 +414,71 @@ void PrintExceptionContinue(std::exception* pex, const char* pszThread)
strMiscWarning = message;
}

boost::filesystem::path GetDataDirectory()
{
string strDataDir2 = GetArg("-datadir2", "");
if(strDataDir2 != "") return strDataDir2;

namespace fs = boost::filesystem;
// Windows < Vista: C:\Documents and Settings\Username\Application Data\Dash
// Windows >= Vista: C:\Users\Username\AppData\Roaming\Dash
// Mac: ~/Library/Application Support/Dash
// Unix: ~/.dash
#ifdef WIN32
// Windows
return GetSpecialFolderPath(CSIDL_APPDATA) / "Dash";
#else
fs::path pathRet;
char* pszHome = getenv("HOME");
if (pszHome == NULL || strlen(pszHome) == 0)
pathRet = fs::path("/");
else
pathRet = fs::path(pszHome);
#ifdef MAC_OSX
// Mac
pathRet /= "Library/Application Support";
TryCreateDirectory(pathRet);
return pathRet / "DashData";
#else
// Unix
return pathRet / ".dash-data";
#endif
#endif
}

std::string GetProfileFile(std::string strUID)
{
boost::filesystem::path filename = GetDataDirectory() / "users" / strUID;
return filename.c_str();
}

std::string GetPrivateDataFile(std::string strUID, int nSlot)
{
std::string strFilename = strUID + "." + boost::lexical_cast<std::string>(nSlot);
boost::filesystem::path filename = GetDataDirectory() / "users" / strFilename;
return filename.c_str();
}

std::string escapeJsonString(const std::string& input) {
std::ostringstream ss;
//for (auto iter = input.cbegin(); iter != input.cend(); iter++) {
//C++98/03:
for (std::string::const_iterator iter = input.begin(); iter != input.end(); iter++) {
switch (*iter) {
case '\\': ss << "\\\\"; break;
case '"': ss << "\\\""; break;
case '/': ss << "\\/"; break;
case '\b': ss << "\\b"; break;
case '\f': ss << "\\f"; break;
case '\n': ss << "\\n"; break;
case '\r': ss << "\\r"; break;
case '\t': ss << "\\t"; break;
default: ss << *iter; break;
}
}
return ss.str();
}

boost::filesystem::path GetDefaultDataDir()
{
namespace fs = boost::filesystem;
Expand Down
7 changes: 7 additions & 0 deletions src/util.h
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,13 @@ void AllocateFileRange(FILE *file, unsigned int offset, unsigned int length);
bool RenameOver(boost::filesystem::path src, boost::filesystem::path dest);
bool TryCreateDirectory(const boost::filesystem::path& p);
boost::filesystem::path GetDefaultDataDir();
boost::filesystem::path GetDataDirectory();

std::string GetProfileFile(std::string strUID);
std::string GetPrivateDataFile(std::string strUID, int nSlot);
std::string escapeJsonString(const std::string& input);


const boost::filesystem::path &GetDataDir(bool fNetSpecific = true);
boost::filesystem::path GetConfigFile();
boost::filesystem::path GetMasternodeConfigFile();
Expand Down

0 comments on commit fd10f4d

Please sign in to comment.