// Copyright (c) 2009-2010 Satoshi Nakamoto
// Copyright (c) 2009-2012 The Bitcoin developers
// Distributed under the MIT/X11 software license, see the accompanying
-// file license.txt or http://www.opensource.org/licenses/mit-license.php.
+// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#include "util.h"
#include "strlcpy.h"
*pend = '\0';
char* p1 = pszBuffer;
char* p2;
- while (p2 = strchr(p1, '\n'))
+ while ((p2 = strchr(p1, '\n')))
{
p2++;
char c = *p2;
va_start(arg_ptr, format);
int ret = _vsnprintf(buffer, limit, format, arg_ptr);
va_end(arg_ptr);
- if (ret < 0 || ret >= limit)
+ if (ret < 0 || ret >= (int)limit)
{
ret = limit - 1;
buffer[limit-1] = 0;
}
-static char phexdigit[256] =
+static signed char phexdigit[256] =
{ -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
{
while (isspace(*psz))
psz++;
- char c = phexdigit[(unsigned char)*psz++];
- if (c == (char)-1)
+ signed char c = phexdigit[(unsigned char)*psz++];
+ if (c == (signed char)-1)
break;
unsigned char n = (c << 4);
c = phexdigit[(unsigned char)*psz++];
- if (c == (char)-1)
+ if (c == (signed char)-1)
break;
n |= c;
vch.push_back(n);
#ifdef MAC_OSX
// Mac
pathRet /= "Library/Application Support";
- filesystem::create_directory(pathRet);
+ fs::create_directory(pathRet);
return pathRet / "Bitcoin";
#else
// Unix
LOCK(csPathCached);
if (mapArgs.count("-datadir")) {
- path = mapArgs["-datadir"];
+ path = fs::system_complete(mapArgs["-datadir"]);
+ if (!fs::is_directory(path)) {
+ path = "";
+ return path;
+ }
} else {
path = GetDefaultDataDir();
}
return pathConfigFile;
}
-bool ReadConfigFile(map<string, string>& mapSettingsRet,
+void ReadConfigFile(map<string, string>& mapSettingsRet,
map<string, vector<string> >& mapMultiSettingsRet)
{
namespace fs = boost::filesystem;
fs::ifstream streamConfig(GetConfigFile());
if (!streamConfig.good())
- return true; // No bitcoin.conf file is OK
+ return; // No bitcoin.conf file is OK
set<string> setOptions;
setOptions.insert("*");
}
mapMultiSettingsRet[strKey].push_back(it->value[0]);
}
- return true;
}
boost::filesystem::path GetPidFile()