Skip to content

Commit bbffebb

Browse files
committed
minor CLI cleanup
- stop adding module map as a header (oops) - dupe the selectable args for noz release build from debug - fix NULL pointer crash when run without PWD environment var - return 0 for successful noz runs, not 1
1 parent 5a4a091 commit bbffebb

File tree

6 files changed

+62
-8
lines changed

6 files changed

+62
-8
lines changed

ZipUtilities.xcodeproj/project.pbxproj

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,6 @@
8080
1C7052421EBEBC370071C2FF /* NOZZipper.h in Headers */ = {isa = PBXBuildFile; fileRef = 1C0542291B7BDD97007CE7BA /* NOZZipper.h */; settings = {ATTRIBUTES = (Public, ); }; };
8181
1C7052431EBEBC370071C2FF /* NOZSyncStepOperation.h in Headers */ = {isa = PBXBuildFile; fileRef = 1C3223801B780CC500DC0A33 /* NOZSyncStepOperation.h */; settings = {ATTRIBUTES = (Public, ); }; };
8282
1C7052441EBEBC370071C2FF /* NOZEncoder.h in Headers */ = {isa = PBXBuildFile; fileRef = 1C7634381BB64F2100BBFECF /* NOZEncoder.h */; settings = {ATTRIBUTES = (Public, ); }; };
83-
1C7052451EBEBC370071C2FF /* module.modulemap in Headers */ = {isa = PBXBuildFile; fileRef = B3F87BF41CF4C08A00FBBFEF /* module.modulemap */; settings = {ATTRIBUTES = (Public, ); }; };
8483
1C7052461EBEBC370071C2FF /* NOZUtils.h in Headers */ = {isa = PBXBuildFile; fileRef = 1C6BF7981B740ACF00969629 /* NOZUtils.h */; settings = {ATTRIBUTES = (Public, ); }; };
8584
1C7052471EBEBC370071C2FF /* NOZUnzipper.h in Headers */ = {isa = PBXBuildFile; fileRef = 1C05422D1B7BDDBA007CE7BA /* NOZUnzipper.h */; settings = {ATTRIBUTES = (Public, ); }; };
8685
1C7052481EBEBC370071C2FF /* hash_longest_match64_inc.h in Headers */ = {isa = PBXBuildFile; fileRef = 1C70520B1EBEA7A80071C2FF /* hash_longest_match64_inc.h */; };
@@ -367,7 +366,6 @@
367366
8BF29229208FAC1700541EE0 /* encoder_dict.c in Sources */ = {isa = PBXBuildFile; fileRef = 8BF29226208FAC1600541EE0 /* encoder_dict.c */; settings = {COMPILER_FLAGS = "-w -Xanalyzer -analyzer-disable-all-checks"; }; };
368367
8BF2922A208FAC1700541EE0 /* encoder_dict.c in Sources */ = {isa = PBXBuildFile; fileRef = 8BF29226208FAC1600541EE0 /* encoder_dict.c */; settings = {COMPILER_FLAGS = "-w -Xanalyzer -analyzer-disable-all-checks"; }; };
369368
8BF2922B208FAC1700541EE0 /* encoder_dict.h in Headers */ = {isa = PBXBuildFile; fileRef = 8BF29227208FAC1700541EE0 /* encoder_dict.h */; };
370-
B3F87BF51CF4C09600FBBFEF /* module.modulemap in Headers */ = {isa = PBXBuildFile; fileRef = B3F87BF41CF4C08A00FBBFEF /* module.modulemap */; settings = {ATTRIBUTES = (Public, ); }; };
371369
B3F87BF61CF4C21600FBBFEF /* ZipUtilities.h in Headers */ = {isa = PBXBuildFile; fileRef = 4623A8321B9A828A00A56535 /* ZipUtilities.h */; settings = {ATTRIBUTES = (Public, ); }; };
372370
/* End PBXBuildFile section */
373371

@@ -1348,7 +1346,6 @@
13481346
1C05422B1B7BDD97007CE7BA /* NOZZipper.h in Headers */,
13491347
1C3223821B780CC500DC0A33 /* NOZSyncStepOperation.h in Headers */,
13501348
1C76343A1BB64F2100BBFECF /* NOZEncoder.h in Headers */,
1351-
B3F87BF51CF4C09600FBBFEF /* module.modulemap in Headers */,
13521349
1C6BF79A1B740ACF00969629 /* NOZUtils.h in Headers */,
13531350
1C05422F1B7BDDBA007CE7BA /* NOZUnzipper.h in Headers */,
13541351
1C70520F1EBEA7A80071C2FF /* hash_longest_match64_inc.h in Headers */,
@@ -1376,7 +1373,6 @@
13761373
1C7052421EBEBC370071C2FF /* NOZZipper.h in Headers */,
13771374
1C7052431EBEBC370071C2FF /* NOZSyncStepOperation.h in Headers */,
13781375
1C7052441EBEBC370071C2FF /* NOZEncoder.h in Headers */,
1379-
1C7052451EBEBC370071C2FF /* module.modulemap in Headers */,
13801376
1C7052461EBEBC370071C2FF /* NOZUtils.h in Headers */,
13811377
1C7052471EBEBC370071C2FF /* NOZUnzipper.h in Headers */,
13821378
1C7052481EBEBC370071C2FF /* hash_longest_match64_inc.h in Headers */,

ZipUtilities.xcodeproj/xcshareddata/xcschemes/noz -Release.xcscheme

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,18 @@
6262
</BuildableReference>
6363
</BuildableProductRunnable>
6464
<CommandLineArguments>
65+
<CommandLineArgument
66+
argument = "-A"
67+
isEnabled = "YES">
68+
</CommandLineArgument>
69+
<CommandLineArgument
70+
argument = "-z -i -m Brotli -l 12 /Applications/Doxygen.app -o /Users/nobrien/Doxygen.zip"
71+
isEnabled = "NO">
72+
</CommandLineArgument>
73+
<CommandLineArgument
74+
argument = "-z -o /Users/nobrien/Doxygen.zip -i -m Brotli -l 12 /Applications/Doxygen.app"
75+
isEnabled = "NO">
76+
</CommandLineArgument>
6577
<CommandLineArgument
6678
argument = "-z -o /Users/nobrien/Doxygen.zip -i /Applications/Doxygen.app -m Brotli -l 12"
6779
isEnabled = "NO">
@@ -70,6 +82,50 @@
7082
argument = "-z -o /Users/nobrien/Desktop/Doxygen.app.tar.zip -i /Users/nobrien/Desktop/Doxygen.app.tar -m Brotli -l 12"
7183
isEnabled = "NO">
7284
</CommandLineArgument>
85+
<CommandLineArgument
86+
argument = "-D -L -i ~/Desktop/Maniac\ Mansion/Maniac_Mansion.zip"
87+
isEnabled = "NO">
88+
</CommandLineArgument>
89+
<CommandLineArgument
90+
argument = "-D"
91+
isEnabled = "NO">
92+
</CommandLineArgument>
93+
<CommandLineArgument
94+
argument = "-u"
95+
isEnabled = "NO">
96+
</CommandLineArgument>
97+
<CommandLineArgument
98+
argument = "-z -M Brotli 101 -c &quot;Encoded (101) using Brotli&quot; -o ~/Desktop/XC9.zip -i /Applications/Xcode_9_GM.app -m Brotli -l 10 "
99+
isEnabled = "NO">
100+
</CommandLineArgument>
101+
<CommandLineArgument
102+
argument = "-u -M ZStandard 102 -M Brotli 101 -M LZMA 14 -M LZ4 256 -M LZFSE 2049 -b ~/Desktop/TestNOZ -i ~/Desktop/maniac-mansion.zip -e -o MANIAC.EXE -m Deflate Maniac\ Mansion/Game/MANIAC.EXE -e Maniac\ Mansion/Music/Midi/dave.mid -e Maniac\ Mansion/Manual\ and\ cheats/walkthrough.txt -e Maniac\ Mansion/Manual\ and\ cheats/Manual/ca1.jpeg"
103+
isEnabled = "NO">
104+
</CommandLineArgument>
105+
<CommandLineArgument
106+
argument = "-u -M ZStandard 102 -M Brotli 101 -M LZMA 14 -M LZ4 256 -M LZFSE 2049 -b ~/Desktop/TestNOZ -i ~/Developer/ZipUtilities/ZipUtilitiesTests/Directory.zip -e -o MANIAC.EXE -m Deflate Game/MANIAC.EXE -e Walkthrough/walkthrough.txt -e Game/12.LFL -e ca1.jpeg"
107+
isEnabled = "NO">
108+
</CommandLineArgument>
109+
<CommandLineArgument
110+
argument = "-u -b ~/Desktop/TestNOZ -i ~/Developer/ZipUtilities/ZipUtilitiesTests/Directory.zip"
111+
isEnabled = "NO">
112+
</CommandLineArgument>
113+
<CommandLineArgument
114+
argument = "-c -m ZStandard -l 14 -i ~/Developer/ZipUtilities/ZipUtilitiesTests/Aesop.txt -o ~/Desktop/Aesop.zstd"
115+
isEnabled = "NO">
116+
</CommandLineArgument>
117+
<CommandLineArgument
118+
argument = "-d -m ZStandard -i ~/Desktop/Aesop.zstd -o ~/Desktop/Aesop.txt"
119+
isEnabled = "NO">
120+
</CommandLineArgument>
121+
<CommandLineArgument
122+
argument = "-D -L -v -i ~/Downloads/openjpeg-version.2.1.zip"
123+
isEnabled = "NO">
124+
</CommandLineArgument>
125+
<CommandLineArgument
126+
argument = "-D -L -s -i ~/Downloads/openjpeg-version.2.1.zip"
127+
isEnabled = "NO">
128+
</CommandLineArgument>
73129
</CommandLineArguments>
74130
<AdditionalOptions>
75131
</AdditionalOptions>

noz/NOZCLICompressMode.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ + (int)run:(NOZCLICompressModeInfo *)info
172172
[NSByteCountFormatter stringFromByteCount:outSize countStyle:NSByteCountFormatterCountStyleBinary],
173173
ratio];
174174
printf("%s", printMessage.UTF8String);
175-
return 1;
175+
return 0;
176176
}
177177

178178
@end

noz/NOZCLIDecompressMode.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ + (int)run:(NOZCLIDecompressModeInfo *)info
150150
ratio];
151151
printf("%s", printMessage.UTF8String);
152152

153-
return 1;
153+
return 0;
154154
}
155155

156156
@end

noz/NOZCLIMethodMode.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ + (int)run:(NOZCLIMethodModeInfo *)unused
7575
}
7676
printf("\n");
7777
}
78-
return 1;
78+
return 0;
7979
}
8080

8181
@end

noz/main.m

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,9 @@ int main(int argc, const char * argv[])
2121
exe = [path lastPathComponent];
2222
path = [path stringByDeletingLastPathComponent];
2323
args = [args subarrayWithRange:NSMakeRange(1, args.count - 1)];
24-
NSString *currentDir = @(getenv("PWD"));
24+
25+
const char *pwd = getenv("PWD");
26+
NSString *currentDir = pwd ? @(pwd) : nil;
2527

2628
retVal = NOZCLI_main(exe, path, currentDir, args);
2729
}

0 commit comments

Comments
 (0)