From 42347d5f66a4bd780cfb2fbdf21543f1d1d6f43c Mon Sep 17 00:00:00 2001 From: Ward Wouts Date: Mon, 31 Jan 2005 14:08:33 +0000 Subject: [PATCH] hopelijk fixed dit een threading probleem, zo nee, dan zullen er toch mutexes gebruikt moeten worden... --- trunk/ripnews/encode/yenc.rb | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/trunk/ripnews/encode/yenc.rb b/trunk/ripnews/encode/yenc.rb index aba693c..e7c9091 100644 --- a/trunk/ripnews/encode/yenc.rb +++ b/trunk/ripnews/encode/yenc.rb @@ -1,4 +1,4 @@ -# $Dwarf: yenc.rb,v 1.11 2004/10/18 08:13:47 ward Exp $ +# $Dwarf: yenc.rb,v 1.12 2004/10/18 18:35:39 ward Exp $ # $Source$ # @@ -27,9 +27,11 @@ class << self Debuglevel = 0 def ydecode(data, outfile=nil) - @ymap = {} - (-106..255).each do |b| - @ymap[b]=((b-42)%256) + unless @ymap + @ymap = {} + (-106..255).each do |b| + @ymap[b]=((b-42)%256) + end end case data.class.to_s @@ -62,7 +64,12 @@ def _ydecode_line(line) line[i] -= 64 end end - ostr << @ymap[line[i]] + begin + ostr << @ymap[line[i].to_i] + rescue TypeError + puts "this should not happen!!!" + puts "line[i] contents: '#{line[i]}'\n" + end i += 1 end return ostr