[前][次][番号順一覧][スレッド一覧]

ruby-changes:27457

From: kou <ko1@a...>
Date: Tue, 26 Feb 2013 23:30:50 +0900 (JST)
Subject: [ruby-changes:27457] kou:r39509 (trunk): * lib/rexml/document.rb: move entity_expansion_limit accessor to ...

kou	2013-02-26 23:30:40 +0900 (Tue, 26 Feb 2013)

  New Revision: 39509

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=39509

  Log:
    * lib/rexml/document.rb: move entity_expansion_limit accessor to ...
    * lib/rexml/rexml.rb: ... here to make rexml/text independent from
      REXML::Document. It causes circular require.
    * lib/rexml/document.rb (REXML::Document.entity_expansion_limit):
      deprecated.
    * lib/rexml/document.rb (REXML::Document.entity_expansion_limit=):
      deprecated.
    * lib/rexml/text.rb: add missing require "rexml/rexml" for
      REXML.entity_expansion_limit.
      Reported by Robert Ulejczyk. Thanks!!! [ruby-core:52895] [Bug #7961]

  Modified files:
    trunk/ChangeLog
    trunk/lib/rexml/document.rb
    trunk/lib/rexml/rexml.rb
    trunk/lib/rexml/text.rb

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 39508)
+++ ChangeLog	(revision 39509)
@@ -1,3 +1,16 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Tue Feb 26 23:26:13 2013  Kouhei Sutou  <kou@c...>
+
+	* lib/rexml/document.rb: move entity_expansion_limit accessor to ...
+	* lib/rexml/rexml.rb: ... here to make rexml/text independent from
+	  REXML::Document. It causes circular require.
+	* lib/rexml/document.rb (REXML::Document.entity_expansion_limit):
+	  deprecated.
+	* lib/rexml/document.rb (REXML::Document.entity_expansion_limit=):
+	  deprecated.
+	* lib/rexml/text.rb: add missing require "rexml/rexml" for
+	  REXML.entity_expansion_limit.
+	  Reported by Robert Ulejczyk. Thanks!!! [ruby-core:52895] [Bug #7961]
+
 Tue Feb 26 15:12:11 2013  Nobuyoshi Nakada  <nobu@r...>
 
 	* tool/mkconfig.rb: reconstruct comma separated list values.  a
Index: lib/rexml/document.rb
===================================================================
--- lib/rexml/document.rb	(revision 39508)
+++ lib/rexml/document.rb	(revision 39509)
@@ -255,16 +255,18 @@ module REXML https://github.com/ruby/ruby/blob/trunk/lib/rexml/document.rb#L255
       return @@entity_expansion_limit
     end
 
-    @@entity_expansion_text_limit = 10_240
-
     # Set the entity expansion limit. By default the limit is set to 10240.
+    #
+    # Deprecated. Use REXML.entity_expansion_text_limit= instead.
     def Document::entity_expansion_text_limit=( val )
-      @@entity_expansion_text_limit = val
+      REXML.entity_expansion_text_limit = val
     end
 
     # Get the entity expansion limit. By default the limit is set to 10240.
+    #
+    # Deprecated. Use REXML.entity_expansion_text_limit instead.
     def Document::entity_expansion_text_limit
-      return @@entity_expansion_text_limit
+      return REXML.entity_expansion_text_limit
     end
 
     attr_reader :entity_expansion_count
Index: lib/rexml/text.rb
===================================================================
--- lib/rexml/text.rb	(revision 39508)
+++ lib/rexml/text.rb	(revision 39509)
@@ -1,3 +1,4 @@ https://github.com/ruby/ruby/blob/trunk/lib/rexml/text.rb#L1
+require 'rexml/rexml'
 require 'rexml/entity'
 require 'rexml/doctype'
 require 'rexml/child'
@@ -383,7 +384,7 @@ module REXML https://github.com/ruby/ruby/blob/trunk/lib/rexml/text.rb#L384
       sum = 0
       string.gsub( /\r\n?/, "\n" ).gsub( REFERENCE ) {
         s = Text.expand($&, doctype, filter)
-        if sum + s.bytesize > Document.entity_expansion_text_limit
+        if sum + s.bytesize > REXML.entity_expansion_text_limit
           raise "entity expansion has grown too large"
         else
           sum += s.bytesize
Index: lib/rexml/rexml.rb
===================================================================
--- lib/rexml/rexml.rb	(revision 39508)
+++ lib/rexml/rexml.rb	(revision 39509)
@@ -28,4 +28,16 @@ module REXML https://github.com/ruby/ruby/blob/trunk/lib/rexml/rexml.rb#L28
 
   Copyright = COPYRIGHT
   Version = VERSION
+
+  @@entity_expansion_text_limit = 10_240
+
+  # Set the entity expansion limit. By default the limit is set to 10240.
+  def self.entity_expansion_text_limit=( val )
+    @@entity_expansion_text_limit = val
+  end
+
+  # Get the entity expansion limit. By default the limit is set to 10240.
+  def self.entity_expansion_text_limit
+    return @@entity_expansion_text_limit
+  end
 end

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]