mirror of
https://github.com/mangosfour/server.git
synced 2025-12-25 13:37:02 +00:00
Revert "fix error ‘atoi’ was not declared in this scope. Thanks to drarkanex for pointing"
This reverts commit 1427e2260bea015ef950697efd0023d9be0e9216.
This commit is contained in:
parent
26970354c6
commit
9d5d28e780
1 changed files with 27 additions and 33 deletions
|
|
@ -79,8 +79,7 @@ bool extractDataFromGit(std::string filename, std::string path, bool url, RawDat
|
|||
{
|
||||
char buf[1024];
|
||||
|
||||
FILE* entriesFile = fopen(filename.c_str(), "r");
|
||||
if (entriesFile)
|
||||
if (FILE* entriesFile = fopen(filename.c_str(), "r"))
|
||||
{
|
||||
char hash_str[200];
|
||||
char branch_str[200];
|
||||
|
|
@ -112,7 +111,7 @@ bool extractDataFromGit(std::string filename, std::string path, bool url, RawDat
|
|||
char* acc_str = NULL;
|
||||
char* repo_str = NULL;
|
||||
|
||||
// parse URL like git@github.com:mangoszero/server
|
||||
// parse URL like git@github.com:mangosthree/server
|
||||
char url_buf[200];
|
||||
int res = sscanf(url_str, "git@%s", url_buf);
|
||||
if (res)
|
||||
|
|
@ -142,47 +141,42 @@ bool extractDataFromGit(std::string filename, std::string path, bool url, RawDat
|
|||
else
|
||||
{ strcpy(data.rev_str, hash_str); }
|
||||
}
|
||||
else
|
||||
else if (entriesFile = fopen((path + ".git/HEAD").c_str(), "r"))
|
||||
{
|
||||
entriesFile = fopen((path + ".git/HEAD").c_str(), "r");
|
||||
if(entriesFile)
|
||||
if (!fgets(buf, sizeof(buf), entriesFile))
|
||||
{
|
||||
if (!fgets(buf, sizeof(buf), entriesFile))
|
||||
{
|
||||
fclose(entriesFile);
|
||||
return false;
|
||||
}
|
||||
|
||||
char refBuff[200];
|
||||
if (!sscanf(buf, "ref: %s", refBuff))
|
||||
{
|
||||
fclose(entriesFile);
|
||||
return false;
|
||||
}
|
||||
|
||||
fclose(entriesFile);
|
||||
return false;
|
||||
}
|
||||
|
||||
FILE *refFile = fopen((path + ".git/" + refBuff).c_str(), "r");
|
||||
if (refFile)
|
||||
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))
|
||||
{
|
||||
char hash[41];
|
||||
|
||||
if (!fgets(hash, sizeof(hash), refFile))
|
||||
{
|
||||
fclose(refFile);
|
||||
return false;
|
||||
}
|
||||
|
||||
strcpy(data.rev_str, hash);
|
||||
|
||||
fclose(refFile);
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{ return false; }
|
||||
|
||||
strcpy(data.rev_str, hash);
|
||||
|
||||
fclose(refFile);
|
||||
}
|
||||
else
|
||||
{ return false; }
|
||||
}
|
||||
else
|
||||
return false;
|
||||
|
||||
time_t rev_time = 0;
|
||||
// extracting date/time
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue