r83886 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r83885‎ | r83886 | r83887 >
Date:11:51, 14 March 2011
Author:tstarling
Status:ok
Tags:
Comment:
* Fixed bug 27993: in Wikidiff2::explodeWords(), the iterator pBrk is invalidated by breaks.insert(). So move the breaks.insert() calls before the pBrk initialisation. Updated some minor details in Nikerabbit's test file.
* Updated tests for r80621 and r82906.
Modified paths:
  • /trunk/extensions/wikidiff2/tests/001.phpt (modified) (history)
  • /trunk/extensions/wikidiff2/tests/003.phpt (modified) (history)
  • /trunk/extensions/wikidiff2/wikidiff2.cpp (modified) (history)

Diff [purge]

Index: trunk/extensions/wikidiff2/wikidiff2.cpp
@@ -382,6 +382,11 @@
383383 breaks.insert(thaiBreakPositions.begin(), thaiBreakPositions.end());
384384 }
385385
 386+ // Add a fake end-of-string character and have a break on it, so that the
 387+ // last word gets added without special handling
 388+ breaks.insert(charSizes.size());
 389+ charSizes += (char)0;
 390+
386391 // Now make the word array by traversing the breaks set
387392 p = text.begin();
388393 IntSet::iterator pBrk = breaks.begin();
@@ -393,11 +398,6 @@
394399 pBrk++;
395400 }
396401
397 - // Add a fake end-of-string character and have a break on it, so that the
398 - // last word gets added without special handling
399 - breaks.insert(charSizes.size());
400 - charSizes += (char)0;
401 -
402402 for (charIndex = 0; charIndex < charSizes.size(); p += charSizes[charIndex++]) {
403403 // Assume all spaces are ASCII
404404 if (isSpace(*p)) {
Index: trunk/extensions/wikidiff2/tests/001.phpt
@@ -154,7 +154,7 @@
155155 <td class="diff-context"></td>
156156 </tr>
157157 <tr>
158 - <td class="diff-marker">-</td>
 158+ <td class="diff-marker">−</td>
159159 <td class="diff-deletedline"><div>kjahegwnygw</div></td>
160160 <td colspan="2">&nbsp;</td>
161161 </tr>
@@ -171,7 +171,7 @@
172172 <td class="diff-context"><div>a</div></td>
173173 </tr>
174174 <tr>
175 - <td class="diff-marker">-</td>
 175+ <td class="diff-marker">−</td>
176176 <td class="diff-deletedline"><div>---line---</div></td>
177177 <td colspan="2">&nbsp;</td>
178178 </tr>
@@ -237,12 +237,12 @@
238238 <td class="diff-context"><div>a</div></td>
239239 </tr>
240240 <tr>
241 - <td class="diff-marker">-</td>
 241+ <td class="diff-marker">−</td>
242242 <td class="diff-deletedline"><div>--line1--</div></td>
243243 <td colspan="2">&nbsp;</td>
244244 </tr>
245245 <tr>
246 - <td class="diff-marker">-</td>
 246+ <td class="diff-marker">−</td>
247247 <td class="diff-deletedline"><div>--line2--</div></td>
248248 <td colspan="2">&nbsp;</td>
249249 </tr>
@@ -313,7 +313,7 @@
314314 <td class="diff-context"><div>== Shortest sequence in Y ==</div></td>
315315 </tr>
316316 <tr>
317 - <td class="diff-marker">-</td>
 317+ <td class="diff-marker">−</td>
318318 <td class="diff-deletedline"><div>x1</div></td>
319319 <td colspan="2">&nbsp;</td>
320320 </tr>
@@ -342,17 +342,17 @@
343343 <td class="diff-context"><div>x1</div></td>
344344 </tr>
345345 <tr>
346 - <td class="diff-marker">-</td>
 346+ <td class="diff-marker">−</td>
347347 <td class="diff-deletedline"><div>x2</div></td>
348348 <td colspan="2">&nbsp;</td>
349349 </tr>
350350 <tr>
351 - <td class="diff-marker">-</td>
 351+ <td class="diff-marker">−</td>
352352 <td class="diff-deletedline"><div>x1</div></td>
353353 <td colspan="2">&nbsp;</td>
354354 </tr>
355355 <tr>
356 - <td class="diff-marker">-</td>
 356+ <td class="diff-marker">−</td>
357357 <td class="diff-deletedline"><div>x2</div></td>
358358 <td colspan="2">&nbsp;</td>
359359 </tr>
@@ -385,14 +385,10 @@
386386 <td class="diff-context"><div>== Changed line ==</div></td>
387387 </tr>
388388 <tr>
389 - <td class="diff-marker">-</td>
390 - <td class="diff-deletedline"><div>
391 -blah blah blah <span class="diffchange diffchange-inline">1</span>
392 - </div></td>
 389+ <td class="diff-marker">−</td>
 390+ <td class="diff-deletedline"><div>blah blah blah <span class="diffchange diffchange-inline">1</span></div></td>
393391 <td class="diff-marker">+</td>
394 - <td class="diff-addedline"><div>
395 -blah blah blah <span class="diffchange diffchange-inline">2</span>
396 - </div></td>
 392+ <td class="diff-addedline"><div>blah blah blah <span class="diffchange diffchange-inline">2</span></div></td>
397393 </tr>
398394 <tr>
399395 <td class="diff-marker"> </td>
Index: trunk/extensions/wikidiff2/tests/003.phpt
@@ -28,7 +28,7 @@
2929 </tr>
3030 <tr>
3131 <td class="diff-marker">−</td>
32 - <td class="diff-deletedline"><div>!!FUZZY!!Rajaa</div></td>
 32+ <td class="diff-deletedline"><div><span class="diffchange diffchange-inline">!!FUZZY!!Rajaa</span></div></td>
3333 <td class="diff-marker">+</td>
34 - <td class="diff-addedline"><div>Rajaa</div></td>
 34+ <td class="diff-addedline"><div><span class="diffchange diffchange-inline">Rajaa</span></div></td>
3535 </tr>

Sign-offs

UserFlagDate
Nikerabbittested12:05, 14 March 2011

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r80621Fix for bug 25725: don't insert any whitespace inside the divs, so that "whit...tstarling09:53, 20 January 2011
r82906Use realy minus sign, like for WikDiff.php and wikidiff.cpp...hartman20:14, 27 February 2011
r83872Added test for bug 27993nikerabbit07:38, 14 March 2011

Status & tagging log