[PATCH] Fix genrevision.cpp compiler warning on assignment in conditionals. (#134)
This commit is contained in:
parent
3ba3df5284
commit
566454d98b
@ -78,7 +78,8 @@ bool extractDataFromGit(std::string filename, std::string path, bool url, RawDat
|
||||
{
|
||||
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 branch_str[200];
|
||||
@ -140,42 +141,47 @@ bool extractDataFromGit(std::string filename, std::string path, bool url, RawDat
|
||||
else
|
||||
{ strcpy(data.rev_str, hash_str); }
|
||||
}
|
||||
else if (entriesFile = fopen((path + ".git/HEAD").c_str(), "r"))
|
||||
else
|
||||
{
|
||||
if (!fgets(buf, sizeof(buf), entriesFile))
|
||||
entriesFile = fopen((path + ".git/HEAD").c_str(), "r");
|
||||
if(entriesFile)
|
||||
{
|
||||
fclose(entriesFile);
|
||||
return false;
|
||||
}
|
||||
|
||||
char refBuff[200];
|
||||
if (!sscanf(buf, "ref: %s", refBuff))
|
||||
{
|
||||
fclose(entriesFile);
|
||||
return false;
|
||||
}
|
||||
|
||||
fclose(entriesFile);
|
||||
|
||||
if (FILE *refFile = fopen((path + ".git/" + refBuff).c_str(), "r"))
|
||||
{
|
||||
char hash[41];
|
||||
|
||||
if (!fgets(hash, sizeof(hash), refFile))
|
||||
if (!fgets(buf, sizeof(buf), entriesFile))
|
||||
{
|
||||
fclose(refFile);
|
||||
fclose(entriesFile);
|
||||
return false;
|
||||
}
|
||||
|
||||
strcpy(data.rev_str, hash);
|
||||
char refBuff[200];
|
||||
if (!sscanf(buf, "ref: %s", refBuff))
|
||||
{
|
||||
fclose(entriesFile);
|
||||
return false;
|
||||
}
|
||||
|
||||
fclose(refFile);
|
||||
fclose(entriesFile);
|
||||
|
||||
FILE *refFile = fopen((path + ".git/" + refBuff).c_str(), "r");
|
||||
if (refFile)
|
||||
{
|
||||
char hash[41];
|
||||
|
||||
if (!fgets(hash, sizeof(hash), refFile))
|
||||
{
|
||||
fclose(refFile);
|
||||
return false;
|
||||
}
|
||||
|
||||
strcpy(data.rev_str, hash);
|
||||
|
||||
fclose(refFile);
|
||||
}
|
||||
else
|
||||
{ return false; }
|
||||
}
|
||||
else
|
||||
{ return false; }
|
||||
}
|
||||
else
|
||||
return false;
|
||||
|
||||
time_t rev_time = 0;
|
||||
// extracting date/time
|
||||
|
Loading…
x
Reference in New Issue
Block a user