From d074ef4d60e389348d10dd1d81e76634c17acb2d Mon Sep 17 00:00:00 2001 From: naruse Date: Mon, 30 Aug 2010 19:45:30 +0000 Subject: * string.c (tr_setup_table): fix bug in r29146. Initialize table even if cflag is 0; tr_find see whether del is empty or not. * string.c (tr_find): nodel can't be NULL; if NULL, it means it is not specified. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29148 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ext/psych/lib/psych/visitors/yaml_tree.rb | 2 +- ext/syck/lib/syck/rubytypes.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'ext') diff --git a/ext/psych/lib/psych/visitors/yaml_tree.rb b/ext/psych/lib/psych/visitors/yaml_tree.rb index 520cd7e9c2..6df1151ad7 100644 --- a/ext/psych/lib/psych/visitors/yaml_tree.rb +++ b/ext/psych/lib/psych/visitors/yaml_tree.rb @@ -205,7 +205,7 @@ module Psych quote = false style = Nodes::Scalar::ANY - if o.index("\x00") || o.count("^ -~\t\r\n").fdiv(o.length) > 0.3 + if o.index("\x00") || o.count("\x00-\x7F", "^ -~\t\r\n").fdiv(o.length) > 0.3 str = [o].pack('m').chomp tag = '!binary' # FIXME: change to below when syck is removed #tag = 'tag:yaml.org,2002:binary' diff --git a/ext/syck/lib/syck/rubytypes.rb b/ext/syck/lib/syck/rubytypes.rb index 50a6f4622b..f8bbfea022 100644 --- a/ext/syck/lib/syck/rubytypes.rb +++ b/ext/syck/lib/syck/rubytypes.rb @@ -148,7 +148,7 @@ class String to_yaml_style or not to_yaml_properties.empty? or self =~ /\n.+/ end def is_binary_data? - self.count("^ -~\t\r\n").fdiv(self.size) > 0.3 || self.index("\x00") unless self.empty? + self.count("\x00-\x7F", "^ -~\t\r\n").fdiv(self.size) > 0.3 || self.index("\x00") unless self.empty? end def String.yaml_new( klass, tag, val ) val = val.unpack("m")[0] if tag == "tag:yaml.org,2002:binary" -- cgit v1.2.3