Skip to content

Commit a14f09f

Browse files
committed
fix some compiler warnings
1 parent 44bcf1a commit a14f09f

3 files changed

Lines changed: 8 additions & 8 deletions

File tree

src/bncsutil/cdkeydecoder.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -422,12 +422,12 @@ int CDKeyDecoder::processWarCraft2Key() {
422422
cdkey[j] = c;
423423
if (c <= '7') {
424424
v = v2;
425-
c2 = ((char) (v & 0xFF)) & 7 ^ c;
425+
c2 = (((char) (v & 0xFF)) & 7) ^ c;
426426
v >>= 3;
427427
cdkey[j] = (char) c2;
428428
v2 = v;
429429
} else if (c < 'A') {
430-
cdkey[j] = ((char) j) & 1 ^ c;
430+
cdkey[j] = (((char) j) & 1) ^ c;
431431
}
432432
}
433433

@@ -527,14 +527,14 @@ void CDKeyDecoder::decodeKeyTable(int* keyTable) {
527527
/*
528528
ecx = (j & 7) << 2;
529529
ebp = (keyTable[0x3 - (j >> 3)] & (0xF << ecx)) >> ecx;
530-
varC = w3TranslateMap[ebp ^ w3TranslateMap[varC + i] + i];
530+
varC = w3TranslateMap[ebp ^ (w3TranslateMap[varC + i] + i)];
531531
*/
532532
ecx = (j & 7) << 2;
533533
//ebp = (keyTable[0x3 - (j >> 3)] & (0xF << ecx)) >> ecx;
534534
ebp = (keyTable[0x3 - (j >> 3)]);
535535
ebp &= (0xF << ecx);
536536
ebp = ebp >> ecx;
537-
varC = w3TranslateMap[ebp ^ w3TranslateMap[varC + i] + i];
537+
varC = w3TranslateMap[ebp ^ (w3TranslateMap[varC + i] + i)];
538538
}
539539
}
540540

@@ -551,7 +551,7 @@ void CDKeyDecoder::decodeKeyTable(int* keyTable) {
551551

552552
j = 3 - var4;
553553
ebx = (w3TranslateMap[varC + i] & 0xF) << esi;
554-
keyTable[j] = (ebx | ~(0xF << esi) & ((int) keyTable[j]));
554+
keyTable[j] = (ebx | (~(0xF << esi) & ((int) keyTable[j])));
555555
} while ((i -= 16) >= 0);
556556

557557
// pass 2

src/bncsutil/checkrevision.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@ MEXP(int) checkRevision(const char* formula, const char* files[], int numFiles,
219219
values[0] ^= checkrevision_seeds[mpqNumber];
220220

221221
for (int i = 0; i < numFiles; i++) {
222-
size_t file_len, remainder, rounded_size, buffer_size;
222+
size_t file_len, remainder, buffer_size;
223223

224224
f = file_open(files[i], FILE_READ);
225225
if (!f) {

src/bncsutil/file.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ file_t file_open(const char* filename, unsigned int mode)
6767

6868
try {
6969
data = new _file;
70-
} catch (std::bad_alloc) {
70+
} catch (const std::bad_alloc&) {
7171
//bncsutil_debug_message_a("Failed to allocate %u bytes to hold file structure.", sizeof(struct _file));
7272
CloseHandle(file);
7373
return (file_t) 0;
@@ -200,7 +200,7 @@ file_t file_open(const char* filename, const unsigned int mode_flags)
200200

201201
try {
202202
data = new _file;
203-
} catch (std::bad_alloc) {
203+
} catch (const std::bad_alloc&) {
204204
//bncsutil_debug_message_a("Failed to allocate %u bytes to hold file structure.", sizeof(struct _file));
205205
fclose(f);
206206
return (file_t) 0;

0 commit comments

Comments
 (0)