[PATCH] Fix genrevision.cpp compiler warning on assignment in conditionals. (#134)

This commit is contained in:
Eva Comaroski 2016-06-06 22:43:02 +03:00 committed by Antz
parent 3ba3df5284
commit 566454d98b

View File

@ -78,7 +78,8 @@ bool extractDataFromGit(std::string filename, std::string path, bool url, RawDat
{ {
char buf[1024]; char buf[1024];
if (FILE* entriesFile = fopen(filename.c_str(), "r")) FILE* entriesFile = fopen(filename.c_str(), "r");
if (entriesFile)
{ {
char hash_str[200]; char hash_str[200];
char branch_str[200]; char branch_str[200];
@ -140,7 +141,10 @@ bool extractDataFromGit(std::string filename, std::string path, bool url, RawDat
else else
{ strcpy(data.rev_str, hash_str); } { strcpy(data.rev_str, hash_str); }
} }
else if (entriesFile = fopen((path + ".git/HEAD").c_str(), "r")) else
{
entriesFile = fopen((path + ".git/HEAD").c_str(), "r");
if(entriesFile)
{ {
if (!fgets(buf, sizeof(buf), entriesFile)) if (!fgets(buf, sizeof(buf), entriesFile))
{ {
@ -157,7 +161,8 @@ bool extractDataFromGit(std::string filename, std::string path, bool url, RawDat
fclose(entriesFile); fclose(entriesFile);
if (FILE *refFile = fopen((path + ".git/" + refBuff).c_str(), "r")) FILE *refFile = fopen((path + ".git/" + refBuff).c_str(), "r");
if (refFile)
{ {
char hash[41]; char hash[41];
@ -175,7 +180,8 @@ bool extractDataFromGit(std::string filename, std::string path, bool url, RawDat
{ return false; } { return false; }
} }
else else
return false; { return false; }
}
time_t rev_time = 0; time_t rev_time = 0;
// extracting date/time // extracting date/time