Skip to content

Commit b89216f

Browse files
feliwirFighter19
andcommitted
[LINUX][ZH] Fix compress tool compilation (#620)
Co-authored-by: Patrick Zacharias <[email protected]>
1 parent d019808 commit b89216f

File tree

4 files changed

+15
-12
lines changed

4 files changed

+15
-12
lines changed

GeneralsMD/Code/Libraries/Source/Compression/EAC/huffencode.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1050,8 +1050,8 @@ static void HUFF_pack(struct HuffEncodeContext *EC,
10501050
if (!i3)
10511051
HUFF_writecode(EC,dest,i);
10521052

1053-
if (((int) bptr1- (int) EC->buffer) >= (int)(EC->plen+curpc))
1054-
curpc = (int) bptr1 - (int) EC->buffer - EC->plen;
1053+
if (((long) bptr1- (long) EC->buffer) >= (long)(EC->plen+curpc))
1054+
curpc = (long) bptr1 - (long) EC->buffer - EC->plen;
10551055
}
10561056

10571057
/* write EOF ([clue] 0gn [10]) */

GeneralsMD/Code/Libraries/Source/Compression/LZHCompress/NoxCompress.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ Bool DecompressFile (char *infile, char *outfile)
4747
char *outBlock = NULL;
4848
LZHL_DHANDLE decompress;
4949
Int ok = 0;
50-
UnsignedInt srcSz, dstSz;
50+
size_t srcSz, dstSz;
5151

5252
// Parameter checking
5353

@@ -224,7 +224,7 @@ Bool DecompressMemory (void *inBufferVoid, Int inSize, void *outBufferVoid, Int
224224
UnsignedInt rawSize = 0, compressedSize = 0;
225225
LZHL_DHANDLE decompress;
226226
Int ok = 0;
227-
UnsignedInt srcSz, dstSz;
227+
size_t srcSz, dstSz;
228228

229229
// Parameter checking
230230

GeneralsMD/Code/Tools/CRCDiff/debug.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,11 @@
2020
// Minmal debug info
2121
// Author: Matthew D. Campbell, Sept 2002
2222

23-
#include <windows.h>
2423
#include "debug.h"
2524
#include <cstdio>
25+
#ifdef _WIN32
26+
#include <windows.h>
27+
#endif
2628

2729
#ifdef DEBUG
2830

GeneralsMD/Code/Tools/Compress/Compress.cpp

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ void dumpHelp(const char *exe)
5454
}
5555
}
5656

57-
void main(int argc, char **argv)
57+
int main(int argc, char **argv)
5858
{
5959
std::string inFile = "";
6060
std::string outFile = "";
@@ -65,7 +65,7 @@ void main(int argc, char **argv)
6565
if ( !stricmp(argv[i], "-help") )
6666
{
6767
dumpHelp(argv[0]);
68-
exit(0);
68+
return EXIT_SUCCESS;
6969
}
7070

7171
if ( !strcmp(argv[i], "-in") )
@@ -106,7 +106,7 @@ void main(int argc, char **argv)
106106
if (inFile.empty())
107107
{
108108
dumpHelp(argv[0]);
109-
exit(0);
109+
return EXIT_SUCCESS;
110110
}
111111

112112
DEBUG_LOG(("IN:'%s' OUT:'%s' Compression:'%s'\n",
@@ -119,7 +119,7 @@ void main(int argc, char **argv)
119119
if (!fp)
120120
{
121121
DEBUG_LOG(("Cannot open '%s'\n", inFile.c_str()));
122-
return;
122+
return EXIT_FAILURE;
123123
}
124124
fseek(fp, 0, SEEK_END);
125125
int size = ftell(fp);
@@ -131,14 +131,14 @@ void main(int argc, char **argv)
131131
if (numRead != 8)
132132
{
133133
DEBUG_LOG(("Cannot read header from '%s'\n", inFile.c_str()));
134-
return;
134+
return EXIT_FAILURE;
135135
}
136136

137137
CompressionType usedType = CompressionManager::getCompressionType(data, 8);
138138
if (usedType == COMPRESSION_NONE)
139139
{
140140
DEBUG_LOG(("No compression on '%s'\n", inFile.c_str()));
141-
return;
141+
return EXIT_FAILURE;
142142
}
143143

144144
int uncompressedSize = CompressionManager::getUncompressedSize(data, 8);
@@ -147,8 +147,9 @@ void main(int argc, char **argv)
147147
inFile.c_str(), CompressionManager::getCompressionNameByType(usedType),
148148
uncompressedSize, size, size/(double)(uncompressedSize+0.1)*100.0));
149149

150-
return;
150+
return EXIT_SUCCESS;
151151
}
152152

153153
// compress file
154+
return EXIT_FAILURE;
154155
}

0 commit comments

Comments
 (0)