Skip to content

Commit 79e887d

Browse files
committed
Fixed compiler warnings; other minor tweaks
1 parent 0205e17 commit 79e887d

File tree

6 files changed

+449
-427
lines changed

6 files changed

+449
-427
lines changed

MTADiag/Common.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,4 @@
2323
#include <shlobj.h>
2424
#include "Log.h"
2525

26-
#define VERSION "2.7.3"
26+
#define VERSION "2.7.4"

MTADiag/Curl.cpp

Lines changed: 19 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ size_t write_data ( void *ptr, size_t size, size_t nmemb, void *stream ); // wri
2323
bool Curl::DownloadFile ( std::string fileURL, std::string filePath )
2424
{
2525
CURL *curl; // initialize curl
26-
CURLcode res; // variable to store curl result
2726
curl = curl_easy_init(); // initialize curl_easy
2827
if ( curl ) // if curl was initialized
2928
{
@@ -35,20 +34,22 @@ bool Curl::DownloadFile ( std::string fileURL, std::string filePath )
3534
curl_easy_setopt ( curl, CURLOPT_WRITEDATA, fp ); // set the file path
3635
curl_easy_setopt ( curl, CURLOPT_NOPROGRESS, FALSE ); // we want progress
3736
curl_easy_setopt ( curl, CURLOPT_PROGRESSFUNCTION, progress_callback ); // set the progress callback function
38-
res = curl_easy_perform ( curl ); // perform; store result into res
37+
CURLcode res = curl_easy_perform ( curl ); // perform; store result into res
3938
curl_easy_cleanup ( curl ); // clean up
4039
fclose ( fp ); // close the file
41-
}
42-
if ( !res ) // if we were successful
40+
41+
if ( !res ) // if we were successful
4342
return true;
44-
else // failure
43+
else // failure
44+
return false;
45+
}
46+
else // failure to initialize CURL
4547
return false;
4648
}
4749

4850
std::string Curl::CreatePasteBin ( std::string filePath, std::string pasteName )
4951
{
5052
CURL *curl; // initialize curl
51-
CURLcode res; // variable to store curl result
5253
curl = curl_easy_init(); // initialize curl_easy
5354

5455
std::string logText; // stores entire log file
@@ -92,17 +93,22 @@ std::string Curl::CreatePasteBin ( std::string filePath, std::string pasteName )
9293
curl_easy_setopt ( curl, CURLOPT_NOPROGRESS, FALSE ); // we want progress
9394
curl_easy_setopt ( curl, CURLOPT_PROGRESSFUNCTION, progress_callback ); // set the progress callback function
9495
curl_easy_setopt ( curl, CURLOPT_WRITEFUNCTION, write_data ); // set the write function
95-
res = curl_easy_perform ( curl ); // perform; store result into res
96+
CURLcode res = curl_easy_perform ( curl ); // perform; store result into res
9697
curl_easy_cleanup ( curl ); // clean up
97-
}
98-
if ( !res ) // if we were successful
99-
{
10098

101-
return response;
99+
if ( !res ) // if we were successful
100+
{
101+
102+
return response;
103+
}
104+
else // failure
105+
{
106+
return "Failed to upload to Pastebin.";
107+
}
102108
}
103-
else // failure
109+
else
104110
{
105-
return "Failed to upload to Pastebin.";
111+
return "Failed to initialize CURL.";
106112
}
107113
}
108114

MTADiag/Diag.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,6 @@ void Diag::Begin ( void )
6666
std::cout << "Missing GTA file: " << fileList[i].szFilename << std::endl; // output any messed up file
6767
bQuit = true; // we need to quit since the user's GTA install is probably screwed up
6868
}
69-
std::cout << szFilename << std::endl;
7069
printf ( "Checking %i out of %i...\r", i, ( sizeof ( fileList ) / sizeof ( fileList[0] ) ) );
7170
fflush ( stdout );
7271
}
@@ -125,6 +124,8 @@ void Diag::Begin ( void )
125124
Log::WriteStringToLog ( "" );
126125

127126
// check for any modified or nonstandard GTA files
127+
std::cout << "Checking for modified or nonstandard GTA files, please wait..." << std::endl;
128+
128129
for ( unsigned int i = 0; i < ( sizeof ( fileList ) / sizeof ( fileList[0] ) ); i++ )
129130
{
130131
std::string szMd5 = fileList[i].szMd5;
@@ -240,9 +241,9 @@ void Diag::Cleanup ( bool deleteLog )
240241
void Diag::GeneratePaths ( void )
241242
{
242243
// obtain Temp and WINDOWS environment variables, and store system time
243-
tempDir = getenv ( "Temp" ); // get the Temp directory
244-
systemRoot = getenv ( "SystemRoot" ); // get the WINDOWS directory
245-
programData = getenv ( "AllUsersProfile" ); // get the ProgramData directory
244+
tempDir = GetEnv ( "Temp" ); // get the Temp directory
245+
systemRoot = GetEnv ( "SystemRoot" ); // get the WINDOWS directory
246+
programData = GetEnv ( "AllUsersProfile" ); // get the ProgramData directory
246247
IsWow64Process ( GetCurrentProcess(), &bIsWOW64 ); // is MTADiag running under WOW64?
247248
GetLocalTime ( &sysTime ); // get the current system time
248249
bQuit = false; // initialize quit bool, used in GTA files checking

0 commit comments

Comments
 (0)