ibondre / ude

Automatically exported from code.google.com/p/ude
Other
0 stars 0 forks source link

BUG in SBCSGroupProber class in function Reset #4

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
http://ude.googlecode.com/svn/trunk/src/Library/Ude.Core/SBCSGroupProber.cs

existing code:

public override void Reset ()
{
    int activeNum = 0;
...

SHOULD be:

public override void Reset ()
{
    activeNum = 0;
...

in many cases this bug will cause fail to detect right charset because class 
member activeNum is currently always 0 because in Reset function local variable 
used, see this piece of code:
} else if (st == ProbingState.NotMe) {
   isActive[i] = false;
   activeNum--;
   if (activeNum <= 0) {
      state = ProbingState.NotMe;
      break;
   }
}

I fixed it locally but want that other developer didn't spent much time 
debugging the same issue)

attached file is where bug is reproduced (charset is KOI8-R)

Original issue reported on code.google.com by diaus...@gmail.com on 25 May 2012 at 6:40

Attachments:

GoogleCodeExporter commented 9 years ago
a simple workaround would be not to use the Reset() method and simply construct 
a new instance of the class.

Original comment by jacob.d...@gmail.com on 22 Dec 2014 at 10:29