summaryrefslogtreecommitdiffstats
path: root/lib/redmine/unified_diff.rb
diff options
context:
space:
mode:
authorToshi MARUYAMA <marutosijp2@yahoo.co.jp>2013-04-05 05:51:58 +0000
committerToshi MARUYAMA <marutosijp2@yahoo.co.jp>2013-04-05 05:51:58 +0000
commit0d029317594a87aeabd652ea6f0867680222ba3f (patch)
treed86de6bccf53036de656739717e41c4fb118f01c /lib/redmine/unified_diff.rb
parented0a8413a242b13bd0d10c06af578b8cbbd6516a (diff)
downloadredmine-0d029317594a87aeabd652ea6f0867680222ba3f.tar.gz
redmine-0d029317594a87aeabd652ea6f0867680222ba3f.zip
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
Diffstat (limited to 'lib/redmine/unified_diff.rb')
-rw-r--r--lib/redmine/unified_diff.rb12
1 files changed, 8 insertions, 4 deletions
diff --git a/lib/redmine/unified_diff.rb b/lib/redmine/unified_diff.rb
index 6fbfb80fe..968922a50 100644
--- a/lib/redmine/unified_diff.rb
+++ b/lib/redmine/unified_diff.rb
@@ -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]