check integer ordinal range on only Ruby 1.8 (#13644)

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@11706 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Toshi MARUYAMA 2013-04-05 05:51:58 +00:00
parent ed0a8413a2
commit 0d02931759
1 changed files with 8 additions and 4 deletions

View File

@ -199,15 +199,19 @@ module Redmine
while starting < max && line_left[starting] == line_right[starting]
starting += 1
end
while line_left[starting].ord.between?(128, 191) && starting > 0
starting -= 1
unless "".respond_to?(:force_encoding)
while line_left[starting].ord.between?(128, 191) && starting > 0
starting -= 1
end
end
ending = -1
while ending >= -(max - starting) && line_left[ending] == line_right[ending]
ending -= 1
end
while line_left[ending].ord.between?(128, 191) && ending > -1
ending -= 1
unless "".respond_to?(:force_encoding)
while line_left[ending].ord.between?(128, 191) && ending > -1
ending -= 1
end
end
unless starting == 0 && ending == -1
[starting, ending]