[JEDI.NET-commits] main/run Jedi.System.Strings.pas,1.4,1.5
Status: Pre-Alpha
Brought to you by:
jedi_mbe
From: Marcel B. <jed...@us...> - 2005-03-04 14:52:05
|
Update of /cvsroot/jedidotnet/main/run In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29463/main/run Modified Files: Jedi.System.Strings.pas Log Message: * Fixed small bug in IntToOct (shortest byte length flaw) * Fixed bug in ParseIntBaseImpl were SubString might go over the string length if ignoreLeadingZeroes was true. Index: Jedi.System.Strings.pas =================================================================== RCS file: /cvsroot/jedidotnet/main/run/Jedi.System.Strings.pas,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** Jedi.System.Strings.pas 22 Jan 2005 15:29:23 -0000 1.4 --- Jedi.System.Strings.pas 4 Mar 2005 14:51:49 -0000 1.5 *************** *** 575,578 **** --- 575,580 ---- class function StringUtils.IntToOct(value: Integer; padToShortestByteSize: Boolean): string; var + realValue: Int64; + testValue: Int64; len: Integer; begin *************** *** 580,586 **** if padToShortestByteSize then begin len := 3; ! while len < Result.Length do len := len shl 1; len := len - Result.Length; if len > 0 then --- 582,598 ---- if padToShortestByteSize then begin + if value < 0 then + realValue := $100000000 + value + else + realValue := value; + testValue := 256; len := 3; ! while testValue <= realValue do ! begin ! testValue := testValue * testValue; len := len shl 1; + end; + if len = 12 then + len := 11; len := len - Result.Length; if len > 0 then *************** *** 716,720 **** while (leadZeroCount < s.Length) and (s.Chars[leadZeroCount] = '0') do Inc(leadZeroCount); ! maxDigits := Math.Min(s.Length, maxDigits); s := s.Substring(leadZeroCount, maxDigits).ToUpper(CultureInfo.InvariantCulture); digits := '0123456789ABCDEF'.Substring(0, base); --- 728,732 ---- while (leadZeroCount < s.Length) and (s.Chars[leadZeroCount] = '0') do Inc(leadZeroCount); ! maxDigits := Math.Min(s.Length - leadZeroCount, maxDigits); s := s.Substring(leadZeroCount, maxDigits).ToUpper(CultureInfo.InvariantCulture); digits := '0123456789ABCDEF'.Substring(0, base); |