Permalink
Browse files

gcc warning fixes (up to lua files)

  • Loading branch information...
jacob1 committed Jan 16, 2015
1 parent 7676f73 commit 54d985f9752581040c9b1e8d8c60ce46f6327adf
@@ -66,7 +66,7 @@
return name;
}*/

int update_start(char *data, int len)
int update_start(char *data, unsigned int len)
{
char *self=exe_name(), *temp;
#ifdef WIN
@@ -2,7 +2,7 @@
#define UPDATE_H_

//char *exe_name(void);
int update_start(char *data, int len);
int update_start(char *data, unsigned int len);
int update_finish(void);
void update_cleanup(void);

@@ -345,7 +345,7 @@ bool Client::DoInstallation()
#include "icondoc.h"

std::string filename = exe_name(), pathname = filename.substr(0, filename.rfind('/'));
for (int i = 0; i < filename.size(); i++)
for (size_t i = 0; i < filename.size(); i++)
{
if (filename[i] == '\'')
{
@@ -489,7 +489,7 @@ std::vector<std::string> Client::DirectorySearch(std::string directory, std::str
#endif
return std::vector<std::string>();
}
while(directoryEntry = readdir(directoryHandle))
while ((directoryEntry = readdir(directoryHandle)))
{
std::string currentFileName = std::string(directoryEntry->d_name);
if(currentFileName.length()>4)
@@ -505,7 +505,7 @@ std::vector<std::string> Client::DirectorySearch(std::string directory, std::str
bool extensionMatch = !extensions.size();
for(std::vector<std::string>::iterator extIter = extensions.begin(), extEnd = extensions.end(); extIter != extEnd; ++extIter)
{
int filenameLength = filename.length()-(*extIter).length();
size_t filenameLength = filename.length()-(*extIter).length();
if(filename.find(*extIter, filenameLength) == filenameLength)
{
extensionMatch = true;
@@ -694,7 +694,7 @@ void Client::Tick()

//Notifications from server
json::Array notificationsArray = objDocument["Notifications"];
for(int j = 0; j < notificationsArray.Size(); j++)
for(size_t j = 0; j < notificationsArray.Size(); j++)
{
json::String notificationLink = notificationsArray[j]["Link"];
json::String notificationText = notificationsArray[j]["Text"];
@@ -891,7 +891,7 @@ User Client::GetAuthUser()
RequestStatus Client::UploadSave(SaveInfo & save)
{
lastError = "";
int gameDataLength;
unsigned int gameDataLength;
char * gameData = NULL;
int dataStatus;
char * data;
@@ -926,7 +926,7 @@ RequestStatus Client::UploadSave(SaveInfo & save)

const char *const postNames[] = { "Name", "Description", "Data:save.bin", "Publish", NULL };
const char *const postDatas[] = { saveName, saveDescription, gameData, (char *)(save.GetPublished()?"Public":"Private") };
int postLengths[] = { save.GetName().length(), save.GetDescription().length(), gameDataLength, save.GetPublished()?6:7 };
size_t postLengths[] = { save.GetName().length(), save.GetDescription().length(), gameDataLength, (size_t)(save.GetPublished()?6:7) };
//std::cout << postNames[0] << " " << postDatas[0] << " " << postLengths[0] << std::endl;
data = http_multipart_post("http://" SERVER "/Save.api", postNames, postDatas, postLengths, userid, NULL, session, &dataStatus, &dataLength);

@@ -1049,7 +1049,7 @@ std::string Client::AddStamp(GameSave * saveData)

MakeDirectory(STAMPS_DIR);

int gameDataLength;
unsigned int gameDataLength;
char * gameData = saveData->Serialise(gameDataLength);

std::ofstream stampStream;
@@ -1089,7 +1089,7 @@ void Client::RescanStamps()
if (directory != NULL)
{
stampIDs.clear();
while (entry = readdir(directory))
while ((entry = readdir(directory)))
{
if(strncmp(entry->d_name, "..", 3) && strncmp(entry->d_name, ".", 2) && strstr(entry->d_name, ".stm") && strlen(entry->d_name) == 14)
{
@@ -1110,15 +1110,18 @@ int Client::GetStampsCount()

std::vector<std::string> Client::GetStamps(int start, int count)
{
if(start+count > stampIDs.size()) {
if(start > stampIDs.size())
int size = (int)stampIDs.size();
if (start+count > size)
{
if(start > size)
return std::vector<std::string>();
count = stampIDs.size()-start;
count = size-start;
}

std::vector<std::string> stampRange;
int index = 0;
for (std::list<std::string>::const_iterator iterator = stampIDs.begin(), end = stampIDs.end(); iterator != end; ++iterator, ++index) {
for (std::list<std::string>::const_iterator iterator = stampIDs.begin(), end = stampIDs.end(); iterator != end; ++iterator, ++index)
{
if(index>=start && index < start+count)
stampRange.push_back(*iterator);
}
@@ -1149,7 +1152,7 @@ RequestStatus Client::ExecVote(int saveID, int direction)

const char *const postNames[] = { "ID", "Action", NULL };
const char *const postDatas[] = { id, directionText };
int postLengths[] = { saveIDText.length(), strlen(directionText) };
size_t postLengths[] = { saveIDText.length(), strlen(directionText) };
//std::cout << postNames[0] << " " << postDatas[0] << " " << postLengths[0] << std::endl;
data = http_multipart_post("http://" SERVER "/Vote.api", postNames, postDatas, postLengths, userid, NULL, session, &dataStatus, &dataLength);

@@ -1330,7 +1333,7 @@ LoginStatus Client::Login(std::string username, std::string password, User & use
int dataStatus, dataLength;
const char *const postNames[] = { "Username", "Hash", NULL };
const char *const postDatas[] = { (char*)username.c_str(), totalHash };
int postLengths[] = { username.length(), 32 };
size_t postLengths[] = { username.length(), 32 };
data = http_multipart_post("http://" SERVER "/Login.json", postNames, postDatas, postLengths, NULL, NULL, NULL, &dataStatus, &dataLength);
if(dataStatus == 200 && data)
{
@@ -1350,7 +1353,7 @@ LoginStatus Client::Login(std::string username, std::string password, User & use
json::String userElevationTemp = objDocument["Elevation"];

json::Array notificationsArray = objDocument["Notifications"];
for(int j = 0; j < notificationsArray.Size(); j++)
for (size_t j = 0; j < notificationsArray.Size(); j++)
{
json::String notificationLink = notificationsArray[j]["Link"];
json::String notificationText = notificationsArray[j]["Text"];
@@ -1459,7 +1462,7 @@ RequestStatus Client::AddComment(int saveID, std::string comment)

const char *const postNames[] = { "Comment", NULL };
const char *const postDatas[] = { (char*)(comment.c_str()) };
int postLengths[] = { comment.length() };
size_t postLengths[] = { comment.length() };
data = http_multipart_post((char *)urlStream.str().c_str(), postNames, postDatas, postLengths, (char *)(userIDStream.str().c_str()), NULL, (char *)(authUser.SessionID.c_str()), &dataStatus, &dataLength);
}
else
@@ -1575,7 +1578,7 @@ RequestStatus Client::ReportSave(int saveID, std::string message)

const char *const postNames[] = { "Reason", NULL };
const char *const postDatas[] = { (char*)(message.c_str()) };
int postLengths[] = { message.length() };
size_t postLengths[] = { message.length() };
data = http_multipart_post((char *)urlStream.str().c_str(), postNames, postDatas, postLengths, (char *)(userIDStream.str().c_str()), NULL, (char *)(authUser.SessionID.c_str()), &dataStatus, &dataLength);
}
else
@@ -1685,7 +1688,7 @@ RequestStatus Client::PublishSave(int saveID)
userIDStream << authUser.ID;
const char *const postNames[] = { "ActionPublish", NULL };
const char *const postDatas[] = { "" };
int postLengths[] = { 1 };
size_t postLengths[] = { 1 };
char *data = http_multipart_post(urlStream.str().c_str(), postNames, postDatas, postLengths, userIDStream.str().c_str(), NULL, authUser.SessionID.c_str(), &dataStatus, NULL);
if (data)
free(data);
@@ -1750,7 +1753,7 @@ SaveInfo * Client::GetSave(int saveID, int saveDate)
json::Array tagsArray = objDocument["Tags"];
std::list<std::string> tempTags;

for(int j = 0; j < tagsArray.Size(); j++)
for (size_t j = 0; j < tagsArray.Size(); j++)
{
json::String tempTag = tagsArray[j];
tempTags.push_back(tempTag.Value());
@@ -1826,7 +1829,7 @@ RequestBroker::Request * Client::GetSaveAsync(int saveID, int saveDate)
json::Array tagsArray = objDocument["Tags"];
std::list<std::string> tempTags;

for(int j = 0; j < tagsArray.Size(); j++)
for (size_t j = 0; j < tagsArray.Size(); j++)
{
json::String tempTag = tagsArray[j];
tempTags.push_back(tempTag.Value());
@@ -1919,7 +1922,7 @@ RequestBroker::Request * Client::GetCommentsAsync(int saveID, int start, int cou
json::Array commentsArray;
json::Reader::Read(commentsArray, dataStream);

for(int j = 0; j < commentsArray.Size(); j++)
for (size_t j = 0; j < commentsArray.Size(); j++)
{
json::Number tempUserID = commentsArray[j]["UserID"];
json::String tempUsername = commentsArray[j]["Username"];
@@ -1972,7 +1975,7 @@ std::vector<SaveComment*> * Client::GetComments(int saveID, int start, int count
json::Array commentsArray;
json::Reader::Read(commentsArray, dataStream);

for(int j = 0; j < commentsArray.Size(); j++)
for (size_t j = 0; j < commentsArray.Size(); j++)
{
json::Number tempUserID = commentsArray[j]["UserID"];
json::String tempUsername = commentsArray[j]["Username"];
@@ -2030,7 +2033,7 @@ std::vector<std::pair<std::string, int> > * Client::GetTags(int start, int count
json::Number tempCount = objDocument["TagTotal"];
resultCount = tempCount.Value();
json::Array tagsArray = objDocument["Tags"];
for(int j = 0; j < tagsArray.Size(); j++)
for (size_t j = 0; j < tagsArray.Size(); j++)
{
json::Number tagCount = tagsArray[j]["Count"];
json::String tag = tagsArray[j]["Tag"];
@@ -2097,7 +2100,7 @@ std::vector<SaveInfo*> * Client::SearchSaves(int start, int count, std::string q
json::Number tempCount = objDocument["Count"];
resultCount = tempCount.Value();
json::Array savesArray = objDocument["Saves"];
for(int j = 0; j < savesArray.Size(); j++)
for (size_t j = 0; j < savesArray.Size(); j++)
{
json::Number tempID = savesArray[j]["ID"];
json::Number tempDate = savesArray[j]["Date"];
@@ -2302,7 +2305,7 @@ std::list<std::string> * Client::RemoveTag(int saveID, std::string tag)

tags = new std::list<std::string>();

for(int j = 0; j < tagsArray.Size(); j++)
for (size_t j = 0; j < tagsArray.Size(); j++)
{
json::String tempTag = tagsArray[j];
tags->push_back(tempTag.Value());
@@ -2363,7 +2366,7 @@ std::list<std::string> * Client::AddTag(int saveID, std::string tag)

tags = new std::list<std::string>();

for(int j = 0; j < tagsArray.Size(); j++)
for (size_t j = 0; j < tagsArray.Size(); j++)
{
json::String tempTag = tagsArray[j];
tags->push_back(tempTag.Value());
@@ -60,7 +60,7 @@ class Client: public Singleton<Client> {
std::string lastError;

std::list<std::string> stampIDs;
int lastStampTime;
unsigned lastStampTime;
int lastStampName;

//Auth session
Oops, something went wrong.

0 comments on commit 54d985f

Please sign in to comment.