Archive of RubyForge sup-devel mailing list
 help / color / mirror / Atom feed
* [sup-devel] [PATCH] ruby 1.9: expect nil start_offset when an MBox::Loader is first created
@ 2010-01-01 22:14 Rich Lane
  2010-01-03 15:00 ` William Morgan
  0 siblings, 1 reply; 2+ messages in thread
From: Rich Lane @ 2010-01-01 22:14 UTC (permalink / raw)
  To: sup-devel

Various callers (including sup-add) passed a nil start_offset. Through a
convoluted path probably involving the fact that nil.to_i == 0, this did the
right thing on Ruby 1.8. It crashes on 1.9, so change initialize to expect a
nil offset and replace it with 0.
---
 lib/sup/mbox/loader.rb |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/lib/sup/mbox/loader.rb b/lib/sup/mbox/loader.rb
index 520e2ec..54d227d 100644
--- a/lib/sup/mbox/loader.rb
+++ b/lib/sup/mbox/loader.rb
@@ -12,7 +12,7 @@ class Loader < Source
   attr_reader :labels
 
   ## uri_or_fp is horrific. need to refactor.
-  def initialize uri_or_fp, start_offset=0, usual=true, archived=false, id=nil, labels=nil
+  def initialize uri_or_fp, start_offset=nil, usual=true, archived=false, id=nil, labels=nil
     @mutex = Mutex.new
     @labels = Set.new((labels || []) - LabelManager::RESERVED_LABELS)
 
@@ -29,6 +29,7 @@ class Loader < Source
       @path = uri_or_fp.path
     end
 
+    start_offset ||= 0
     super uri_or_fp, start_offset, usual, archived, id
   end
 
-- 
1.6.3.3

_______________________________________________
Sup-devel mailing list
Sup-devel@rubyforge.org
http://rubyforge.org/mailman/listinfo/sup-devel


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2010-01-03 15:00 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-01-01 22:14 [sup-devel] [PATCH] ruby 1.9: expect nil start_offset when an MBox::Loader is first created Rich Lane
2010-01-03 15:00 ` William Morgan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox