MCPcopy Create free account
hub / github.com/Parchive/par2cmdline / Parse

Method Parse

src/commandline.cpp:154–202  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

152}
153
154bool CommandLine::Parse(int argc, const char * const *argv)
155{
156 if (!ReadArgs(argc, argv))
157 return false;
158
159 if (operation != opNone) { // user didn't do "par --help", etc.
160 if (!CheckValuesAndSetDefaults())
161 return false;
162 }
163
164 if (operation == opCreate) {
165 if (!ComputeBlockSize())
166 return false;
167
168 u32 sourceblockcount = 0;
169 u64 largestfilesize = 0;
170 for (std::vector<std::string>::const_iterator i=extrafiles.begin(); i!=extrafiles.end(); i++)
171 {
172 u64 filesize = filesize_cache.get(*i);
173 sourceblockcount += (u32) ((filesize + blocksize-1) / blocksize);
174 if (filesize > largestfilesize)
175 {
176 largestfilesize = filesize;
177 }
178 }
179
180 if (sourceblockcount > 32768)
181 {
182 std::cerr << "Too many source blocks (" << sourceblockcount << " > 32768)." << std::endl;
183 return false;
184 }
185
186 if (!ComputeRecoveryBlockCount(&recoveryblockcount,
187 sourceblockcount,
188 blocksize,
189 firstblock,
190 recoveryfilescheme,
191 recoveryfilecount,
192 recoveryblockcountset,
193 redundancy,
194 redundancysize,
195 largestfilesize))
196 {
197 return false;
198 }
199 }
200
201 return true;
202}
203
204bool CommandLine::ReadArgs(int argc, const char * const *argv)
205{

Callers 7

mainFunction · 0.80
test9_helperFunction · 0.80
test10_helperFunction · 0.80
test10Function · 0.80
test11_helperFunction · 0.80
test11Function · 0.80
test12Function · 0.80

Calls 1

getMethod · 0.80

Tested by 6

test9_helperFunction · 0.64
test10_helperFunction · 0.64
test10Function · 0.64
test11_helperFunction · 0.64
test11Function · 0.64
test12Function · 0.64