Skip to content

Commit a43659c

Browse files
committed
Removed buggy parallel version
1 parent 001d4d7 commit a43659c

File tree

1 file changed

+1
-37
lines changed

1 file changed

+1
-37
lines changed

src/core/hexeditor.cpp

Lines changed: 1 addition & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -159,17 +159,6 @@ void HexEditor::saveDataToFileAsync(string path) {
159159
async(&HexEditor::saveDataToFile, this, path);
160160
}
161161

162-
vector<Match *> HexEditor::findPatternsInChunk(unsigned long start, unsigned long len) {
163-
wstring str = getCurrentDataAsWString(start, len);
164-
165-
vector<Match *> matches = this->patternMatching->hasMatches(move(str));
166-
// Update the relative match positions to the absolute position
167-
for (Match *m : matches) {
168-
m->index += start;
169-
}
170-
return matches;
171-
}
172-
173162
string HexEditor::fromUintVectorToPrintableString(vector<uint8_t> &vec, long start, long len) {
174163
stringstream ss;
175164
vector<uint8_t>::const_iterator it;
@@ -187,32 +176,7 @@ string HexEditor::fromUintVectorToPrintableString(vector<uint8_t> &vec, long sta
187176
}
188177

189178
vector<Match *> HexEditor::findPatterns() {
190-
unsigned long chunkSize = fileSize / this->task_num;
191-
unsigned long lastChunkSize = fileSize % this->task_num;
192-
193-
int i;
194-
int b_offset = 0;
195-
for (i = 0; i < this->task_num; i++) {
196-
if ((i*chunkSize) > 512)
197-
b_offset = 512;
198-
pattern_tasks.push_back(async([this, chunkSize, i, b_offset](){ return this->findPatternsInChunk(chunkSize * i - b_offset, chunkSize + b_offset); }));
199-
}
200-
201-
// Load the last chunk
202-
if (lastChunkSize > 0) {
203-
pattern_tasks.push_back(async([this, chunkSize, lastChunkSize, i, b_offset](){ return this->findPatternsInChunk(chunkSize * i - b_offset, lastChunkSize + b_offset); }));
204-
}
205-
206-
vector<Match*> res;
207-
for (auto& ptask : pattern_tasks) {
208-
vector<Match*> data = ptask.get();
209-
res.insert(res.end(), data.begin(), data.end());
210-
}
211-
212-
this->pattern_tasks.clear();
213-
this->pattern_tasks.shrink_to_fit();
214-
215-
return res;
179+
return this->patternMatching->hasMatches(this->current_data);
216180
}
217181

218182
vector<pair<unsigned long, uint8_t>> HexEditor::compareTo(HexEditor &hexEditor) {

0 commit comments

Comments
 (0)