invent a new error for the bad escape usage

This commit is contained in:
Ward Wouts 2004-10-18 18:35:39 +00:00
parent 14d403d5b3
commit 745c164cec

View file

@ -1,4 +1,4 @@
# $Dwarf: yenc.rb,v 1.10 2004/06/16 08:14:50 ward Exp $
# $Dwarf: yenc.rb,v 1.11 2004/10/18 08:13:47 ward Exp $
# $Source$
#
@ -19,6 +19,8 @@
require 'tempfile'
class YencError < RuntimeError; end
class YEnc
class << self
@ -53,10 +55,10 @@ def _ydecode_line(line)
ostr = ''
while i < ll
if line[i] == 0x3d
i += 1
if i == ll
raise PermError, "Escape char found as last char on line. This is not allowed by the yEnc standard"
if i == (ll - 1)
raise YencError, "Escape char found as last char of line. This is not allowed by the yEnc standard"
else
i += 1
line[i] -= 64
end
end
@ -193,7 +195,6 @@ def _ydecode_file(file, outfile)
return mode, filename, outfile
end
# toch maar een keer aparte class van maken... geld ook voor dit geneuzel
def _ydecode_array(data)
decode = ""
mode = 0600