aboutsummaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorStuart Connolly <stuart02@gmail.com>2014-08-21 23:13:07 +0100
committerStuart Connolly <stuart02@gmail.com>2014-08-21 23:13:07 +0100
commite3c342d623b24a55215fadb3b7c72f80df303e83 (patch)
tree25eb85592f82030b08c94f38298ec87a1ee0a497 /Source
parentca2b9458049c57a5d444ddb1f8a8ad51dd4d24aa (diff)
downloadsequelpro-e3c342d623b24a55215fadb3b7c72f80df303e83.tar.gz
sequelpro-e3c342d623b24a55215fadb3b7c72f80df303e83.tar.bz2
sequelpro-e3c342d623b24a55215fadb3b7c72f80df303e83.zip
Fix warnings.
Diffstat (limited to 'Source')
-rw-r--r--Source/SPFileHandle.m11
1 files changed, 7 insertions, 4 deletions
diff --git a/Source/SPFileHandle.m b/Source/SPFileHandle.m
index aade2770..2f822c48 100644
--- a/Source/SPFileHandle.m
+++ b/Source/SPFileHandle.m
@@ -91,7 +91,7 @@
int i, c;
char *bzbuf = malloc(4);
- const char *charFileMode = (fileMode == O_WRONLY) ? "wb" : "rb";
+ const char *charFileMode = fileMode == O_WRONLY ? "wb" : "rb";
BZFILE *bzfile;
gzFile *gzfile = gzopen(path, charFileMode);
@@ -101,16 +101,19 @@
// Get the first 4 bytes from the file
for (i = 0; (c = getc(wrappedFile)) != EOF && i < 4; bzbuf[i++] = c);
+
rewind(wrappedFile);
// Test to see if the file is gzip compressed
- BOOL isGzip = (!gzdirect(gzfile));
+ BOOL isGzip = !gzdirect(gzfile);
// Test to see if the first 2 bytes extracted from the file match the Bzip2 signature/magic number
// (BZ). The 3rd byte should be either 'h' (Huffman encoding) or 0 (Bzip1 - deprecated) to
// indicate the Bzip version. Finally, the 4th byte should be a number between 1 and 9 that indicates
// the block size used.
- BOOL isBzip2 = ((bzbuf[0] == 'B') && (bzbuf[1] == 'Z') &&
+
+ BOOL isBzip2 = (sizeof(bzbuf) == 4) &&
+ ((bzbuf[0] == 'B') && (bzbuf[1] == 'Z') &&
((bzbuf[2] == 'h') || (bzbuf[2] == '0')) &&
((bzbuf[3] >= 0x31) && (bzbuf[3] <= 0x39)));
@@ -118,7 +121,7 @@
if (isBzip2) bzfile = BZ2_bzopen(path, charFileMode);
- useCompression = (isGzip || isBzip2);
+ useCompression = isGzip || isBzip2;
if (useCompression) {
if (isGzip) {