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

Method Process

src/par2creator.cpp:92–243  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

90}
91
92Result Par2Creator::Process(
93 const size_t memorylimit,
94 const std::string &basepath,
95#ifdef _OPENMP
96 const u32 nthreads,
97 const u32 _filethreads,
98#endif
99 const std::string &parfilename,
100 const std::vector<std::string> &_extrafiles,
101 const u64 _blocksize,
102 const u32 _firstblock,
103 const Scheme _recoveryfilescheme,
104 const u32 _recoveryfilecount,
105 const u32 _recoveryblockcount)
106{
107#ifdef _OPENMP
108 filethreads = _filethreads;
109#endif
110
111 if (!CheckBasepath(parfilename))
112 return eFileIOError;
113
114 // Get information from commandline
115 blocksize = _blocksize;
116 const std::vector<std::string> extrafiles = _extrafiles;
117 sourcefilecount = (u32)extrafiles.size();
118 recoveryblockcount = _recoveryblockcount;
119 recoveryfilecount = _recoveryfilecount;
120 firstrecoveryblock = _firstblock;
121 recoveryfilescheme = _recoveryfilescheme;
122
123#ifdef _OPENMP
124 // Set the number of threads
125 if (nthreads != 0)
126 omp_set_num_threads(nthreads);
127#endif
128
129 // Compute block size from block count or vice versa depending on which was
130 // specified on the command line
131 if (!ComputeBlockCount(extrafiles))
132 return eInvalidCommandLineArguments;
133
134 // Determine how many recovery files to create.
135 if (!ComputeRecoveryFileCount(sout,
136 serr,
137 &recoveryfilecount,
138 recoveryfilescheme,
139 recoveryblockcount,
140 largestfilesize,
141 blocksize)) {
142 return eInvalidCommandLineArguments;
143 }
144
145 // Determine how much recovery data can be computed on one pass
146 if (!CalculateProcessBlockSize(memorylimit))
147 return eLogicError;
148
149 if (recoveryblockcount > 0 && noiselevel >= nlDebug)

Callers 1

ProcessDataMethod · 0.45

Calls 1

ComputeRecoveryFileCountFunction · 0.85

Tested by

no test coverage detected