Skip to content

Commit fc5bf82

Browse files
committed
Update Pyinstaller.cpp
1 parent 3da81ba commit fc5bf82

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

src/Pyinstaller.cpp

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,6 @@ bool PyInstArchive::checkFile() {
130130
return true;
131131
}
132132

133-
134133
/**
135134
* @brief Swaps the byte order of a 32-bit integer to correct endianness.
136135
*
@@ -162,12 +161,12 @@ bool PyInstArchive::getCArchiveInfo() {
162161

163162
// Check for version and load relevant data
164163
fPtr.seekg(cookiePos, std::ios::beg);
165-
char buffer[PYINST21_COOKIE_SIZE]; // Use a single buffer to handle both versions if possible
164+
char buffer[PYINST21_COOKIE_SIZE]; // Use a single buffer to handle both versions
166165
fPtr.read(buffer, (pyinstVer == 20) ? PYINST20_COOKIE_SIZE : PYINST21_COOKIE_SIZE);
167166

168167
// Directly read values from the buffer
169168
if (pyinstVer == 20 || pyinstVer == 21) {
170-
// Read and immediately swap bytes (combine reading and byte order correction in one step)
169+
// Read and immediately swap bytes
171170
lengthofPackage = swapBytes(*reinterpret_cast<uint32_t*>(buffer + 8));
172171
toc = swapBytes(*reinterpret_cast<uint32_t*>(buffer + 12));
173172
tocLen = swapBytes(*reinterpret_cast<uint32_t*>(buffer + 16));
@@ -194,7 +193,7 @@ bool PyInstArchive::getCArchiveInfo() {
194193
std::cout << "[DEBUG] tableOfContentsSize: " << tableOfContentsSize << std::endl;
195194
#endif
196195

197-
parseTOC(); // Always included, regardless of the mode
196+
parseTOC();
198197

199198
#ifdef _DEBUG
200199
std::cout << "[DEBUG] Entry sizes in the CArchive:" << std::endl;
@@ -228,7 +227,7 @@ void PyInstArchive::parseTOC() {
228227
tocList.clear(); // Clear any existing TOC entries
229228
uint32_t parsedLen = 0; // Initialize parsed length
230229

231-
// Read the Table of Contents in chunks to reduce file reads
230+
// Read the Table of Contents in chunks
232231
while (parsedLen < tableOfContentsSize) {
233232
uint32_t entrySize;
234233
fPtr.read(reinterpret_cast<char*>(&entrySize), sizeof(entrySize));
@@ -239,7 +238,7 @@ void PyInstArchive::parseTOC() {
239238
uint32_t nameLen = sizeof(uint32_t) + sizeof(uint32_t) * 3 + sizeof(uint8_t) + sizeof(char);
240239
std::vector<char> nameBuffer(entrySize - nameLen); // Create buffer for the name
241240

242-
// Read the rest of the fields in one go to minimize file reads
241+
// Read the rest of the fields in one go
243242
uint32_t entryPos, cmprsdDataSize, uncmprsdDataSize;
244243
uint8_t cmprsFlag;
245244
char typeCmprsData;

0 commit comments

Comments
 (0)