177 |
|
|
178 |
|
string portion; |
179 |
|
unsigned sampleLength = 0, begin = 0, end = string::npos; |
180 |
< |
while (sampleLength < 160 && itor != occurrencesText.end()) |
180 |
> |
while (sampleLength < sampleMax && itor != occurrencesText.end()) |
181 |
|
{ |
182 |
|
unsigned found = itor->first; |
183 |
|
unsigned length = itor->second; |
185 |
|
for (unsigned index = found; index > begin; index--) |
186 |
|
{ |
187 |
|
if (index == begin) cerr << "Oh crap, I'm insane!\n"; |
188 |
< |
if (found - index >= 160 - sampleLength - length) |
188 |
> |
if (found - index >= sampleMax - sampleLength - length) |
189 |
|
{ |
190 |
|
for (; index < found; index++) |
191 |
|
{ |
230 |
|
|
231 |
|
if (++itor != occurrencesText.end()) |
232 |
|
{ |
233 |
< |
if (itor->first + itor->second < begin + 160 - sampleLength) |
233 |
> |
if (itor->first + itor->second < begin + sampleMax - sampleLength) |
234 |
|
{ |
235 |
|
portion = getText().substr(begin, itor->first - begin); |
236 |
|
sampleLength += portion.length(); |
247 |
|
} |
248 |
|
else |
249 |
|
{ |
250 |
< |
for (end = begin + 160 - sampleLength; end > begin; end--) |
250 |
> |
for (end = begin + sampleMax - sampleLength; end > begin; |
251 |
> |
end--) |
252 |
|
{ |
253 |
|
if (isspace(getText()[end])) break; |
254 |
|
} |
268 |
|
} |
269 |
|
else |
270 |
|
{ |
271 |
< |
for (end = begin + 160 - sampleLength; end > begin && (end + 1 < |
272 |
< |
getText().length()); end--) |
271 |
> |
for (end = begin + sampleMax - sampleLength; end > begin && (end + |
272 |
> |
1 < getText().length()); end--) |
273 |
|
{ |
274 |
|
if (isspace(getText()[end])) break; |
275 |
|
} |