Fix shadowed variable declarations in android_main.cpp

This commit is contained in:
Robert Müller 2024-05-07 13:30:27 +02:00
parent b4a41ea098
commit b2b0cd0c81

View file

@ -54,23 +54,23 @@ void InitAndroid()
dbg_msg("integrity", "copying integrity.txt with size: %ld", length); dbg_msg("integrity", "copying integrity.txt with size: %ld", length);
IOHANDLE pIO = io_open("integrity.txt", IOFLAG_WRITE); IOHANDLE IntegrityFileWrite = io_open("integrity.txt", IOFLAG_WRITE);
io_write(pIO, pAl, length); io_write(IntegrityFileWrite, pAl, length);
io_close(pIO); io_close(IntegrityFileWrite);
free(pAl); free(pAl);
} }
IOHANDLE pIO = io_open("integrity.txt", IOFLAG_READ); IOHANDLE IntegrityFileRead = io_open("integrity.txt", IOFLAG_READ);
CLineReader LineReader; CLineReader IntegrityFileLineReader;
LineReader.Init(pIO); IntegrityFileLineReader.Init(IntegrityFileRead);
const char *pReadLine = NULL; const char *pReadLine = NULL;
std::vector<std::string> vLines; std::vector<std::string> vLines;
while((pReadLine = LineReader.Get())) while((pReadLine = IntegrityFileLineReader.Get()))
{ {
vLines.push_back(pReadLine); vLines.push_back(pReadLine);
} }
io_close(pIO); io_close(IntegrityFileRead);
// first line is the whole hash // first line is the whole hash
std::string AllAsOne; std::string AllAsOne;
@ -82,12 +82,12 @@ void InitAndroid()
SHA256_DIGEST ShaAll; SHA256_DIGEST ShaAll;
bool GotSHA = false; bool GotSHA = false;
{ {
IOHANDLE pIOR = io_open("integrity_save.txt", IOFLAG_READ); IOHANDLE IntegritySaveFileRead = io_open("integrity_save.txt", IOFLAG_READ);
if(pIOR != NULL) if(IntegritySaveFileRead != NULL)
{ {
CLineReader LineReader; CLineReader IntegritySaveLineReader;
LineReader.Init(pIOR); IntegritySaveLineReader.Init(IntegritySaveFileRead);
const char *pLine = LineReader.Get(); const char *pLine = IntegritySaveLineReader.Get();
if(pLine != NULL) if(pLine != NULL)
{ {
sha256_from_str(&ShaAll, pLine); sha256_from_str(&ShaAll, pLine);
@ -138,20 +138,20 @@ void InitAndroid()
SDL_RWclose(pF); SDL_RWclose(pF);
IOHANDLE pIO = io_open(FileName.c_str(), IOFLAG_WRITE); IOHANDLE AssetFileWrite = io_open(FileName.c_str(), IOFLAG_WRITE);
io_write(pIO, pAl, length); io_write(AssetFileWrite, pAl, length);
io_close(pIO); io_close(AssetFileWrite);
free(pAl); free(pAl);
} }
IOHANDLE pIOR = io_open("integrity_save.txt", IOFLAG_WRITE); IOHANDLE IntegritySaveFileWrite = io_open("integrity_save.txt", IOFLAG_WRITE);
if(pIOR != NULL) if(IntegritySaveFileWrite != NULL)
{ {
char aFileSHA[SHA256_MAXSTRSIZE]; char aFileSHA[SHA256_MAXSTRSIZE];
sha256_str(ShaAllFile, aFileSHA, sizeof(aFileSHA)); sha256_str(ShaAllFile, aFileSHA, sizeof(aFileSHA));
io_write(pIOR, aFileSHA, str_length(aFileSHA)); io_write(IntegritySaveFileWrite, aFileSHA, str_length(aFileSHA));
io_close(pIOR); io_close(IntegritySaveFileWrite);
} }
} }
} }