Fix warnings, fix crash when ctrl+click opening a save

This commit is contained in:
jacob1 2016-04-02 20:47:50 -04:00
parent 0b1ffbcfd6
commit 1171c308e1
5 changed files with 20 additions and 18 deletions

View File

@ -1964,7 +1964,7 @@ Json::Value Client::GetPref(Json::Value root, std::string prop, Json::Value defa
{ {
try try
{ {
int dot = prop.find('.'); size_t dot = prop.find('.');
if (dot == prop.npos) if (dot == prop.npos)
return root.get(prop, defaultValue); return root.get(prop, defaultValue);
else else
@ -2042,7 +2042,7 @@ std::vector<std::string> Client::GetPrefStringArray(std::string prop)
{ {
std::vector<std::string> ret; std::vector<std::string> ret;
Json::Value arr = GetPref(preferences, prop); Json::Value arr = GetPref(preferences, prop);
for (int i = 0; i < arr.size(); i++) for (int i = 0; i < (int)arr.size(); i++)
ret.push_back(arr[i].asString()); ret.push_back(arr[i].asString());
return ret; return ret;
} }
@ -2059,7 +2059,7 @@ std::vector<double> Client::GetPrefNumberArray(std::string prop)
{ {
std::vector<double> ret; std::vector<double> ret;
Json::Value arr = GetPref(preferences, prop); Json::Value arr = GetPref(preferences, prop);
for (int i = 0; i < arr.size(); i++) for (int i = 0; i < (int)arr.size(); i++)
ret.push_back(arr[i].asDouble()); ret.push_back(arr[i].asDouble());
return ret; return ret;
} }
@ -2076,7 +2076,7 @@ std::vector<int> Client::GetPrefIntegerArray(std::string prop)
{ {
std::vector<int> ret; std::vector<int> ret;
Json::Value arr = GetPref(preferences, prop); Json::Value arr = GetPref(preferences, prop);
for (int i = 0; i < arr.size(); i++) for (int i = 0; i < (int)arr.size(); i++)
ret.push_back(arr[i].asInt()); ret.push_back(arr[i].asInt());
return ret; return ret;
} }
@ -2093,7 +2093,7 @@ std::vector<unsigned int> Client::GetPrefUIntegerArray(std::string prop)
{ {
std::vector<unsigned int> ret; std::vector<unsigned int> ret;
Json::Value arr = GetPref(preferences, prop); Json::Value arr = GetPref(preferences, prop);
for (int i = 0; i < arr.size(); i++) for (int i = 0; i < (int)arr.size(); i++)
ret.push_back(arr[i].asUInt()); ret.push_back(arr[i].asUInt());
return ret; return ret;
} }
@ -2110,7 +2110,7 @@ std::vector<bool> Client::GetPrefBoolArray(std::string prop)
{ {
std::vector<bool> ret; std::vector<bool> ret;
Json::Value arr = GetPref(preferences, prop); Json::Value arr = GetPref(preferences, prop);
for (int i = 0; i < arr.size(); i++) for (int i = 0; i < (int)arr.size(); i++)
ret.push_back(arr[i].asBool()); ret.push_back(arr[i].asBool());
return ret; return ret;
} }
@ -2128,7 +2128,7 @@ std::vector<bool> Client::GetPrefBoolArray(std::string prop)
// and return it to SetPref to do the actual setting // and return it to SetPref to do the actual setting
Json::Value Client::SetPrefHelper(Json::Value root, std::string prop, Json::Value value) Json::Value Client::SetPrefHelper(Json::Value root, std::string prop, Json::Value value)
{ {
int dot = prop.find("."); size_t dot = prop.find(".");
if (dot == prop.npos) if (dot == prop.npos)
root[prop] = value; root[prop] = value;
else else
@ -2144,7 +2144,7 @@ void Client::SetPref(std::string prop, Json::Value value)
{ {
try try
{ {
int dot = prop.find("."); size_t dot = prop.find(".");
if (dot == prop.npos) if (dot == prop.npos)
preferences[prop] = value; preferences[prop] = value;
else else
@ -2163,7 +2163,7 @@ void Client::SetPref(std::string prop, std::vector<Json::Value> value)
try try
{ {
Json::Value arr; Json::Value arr;
for (int i = 0; i < value.size(); i++) for (int i = 0; i < (int)value.size(); i++)
{ {
arr.append(value[i]); arr.append(value[i]);
} }

View File

@ -9,13 +9,13 @@ Download::Download(std::string uri_, bool keepAlive):
downloadData(NULL), downloadData(NULL),
downloadSize(0), downloadSize(0),
downloadStatus(0), downloadStatus(0),
downloadFinished(false),
downloadCanceled(false),
downloadStarted(false),
postData(""), postData(""),
postDataBoundary(""), postDataBoundary(""),
userID(""), userID(""),
userSession("") userSession(""),
downloadFinished(false),
downloadCanceled(false),
downloadStarted(false)
{ {
uri = std::string(uri_); uri = std::string(uri_);
DownloadManager::Ref().AddDownload(this); DownloadManager::Ref().AddDownload(this);

View File

@ -9,8 +9,8 @@ DownloadManager::DownloadManager():
lastUsed(time(NULL)), lastUsed(time(NULL)),
managerRunning(false), managerRunning(false),
managerShutdown(false), managerShutdown(false),
downloads(NULL), downloads(std::vector<Download*>()),
downloadsAddQueue(NULL) downloadsAddQueue(std::vector<Download*>())
{ {
pthread_mutex_init(&downloadLock, NULL); pthread_mutex_init(&downloadLock, NULL);
pthread_mutex_init(&downloadAddLock, NULL); pthread_mutex_init(&downloadAddLock, NULL);

View File

@ -24,7 +24,7 @@
#include <string> #include <string>
static const char hexChars[] = "0123456789abcdef"; static const char hexChars[] = "0123456789abcdef";
static long http_timeout = 15; static const long http_timeout = 15;
void http_init(char *proxy); void http_init(char *proxy);
void http_done(void); void http_done(void);

View File

@ -12,6 +12,8 @@ PreviewModel::PreviewModel():
saveInfo(NULL), saveInfo(NULL),
saveData(NULL), saveData(NULL),
saveComments(NULL), saveComments(NULL),
saveDataDownload(NULL),
commentsDownload(NULL),
commentBoxEnabled(false), commentBoxEnabled(false),
commentsLoaded(false), commentsLoaded(false),
commentsTotal(0), commentsTotal(0),