fix padding in Lb64encode
undefined array elements read as "" or (arithmetically) 0 so this is ok and works as the lines below expect it
This commit is contained in:
parent
06b2d53ea2
commit
1dd5ae69ae
10
dot.mkshrc
10
dot.mkshrc
@ -1,5 +1,5 @@
|
||||
# $Id$
|
||||
# $MirOS: src/bin/mksh/dot.mkshrc,v 1.112 2017/03/19 20:59:25 tg Exp $
|
||||
# $MirOS: src/bin/mksh/dot.mkshrc,v 1.113 2017/03/19 21:08:25 tg Exp $
|
||||
#-
|
||||
# Copyright (c) 2002, 2003, 2004, 2006, 2007, 2008, 2009, 2010,
|
||||
# 2011, 2012, 2013, 2014, 2015, 2016, 2017
|
||||
@ -330,14 +330,12 @@ function Lb64encode {
|
||||
else
|
||||
\\builtin read -raN-1 s
|
||||
fi
|
||||
\\builtin typeset -i i=0 n=${#s[*]} j v
|
||||
\\builtin typeset -i i=0 n=${#s[*]} v
|
||||
|
||||
while (( i < n )); do
|
||||
(( v = s[i++] << 16 ))
|
||||
(( j = i < n ? s[i++] : 0 ))
|
||||
(( v |= j << 8 ))
|
||||
(( j = i < n ? s[i++] : 0 ))
|
||||
(( v |= j ))
|
||||
(( v |= s[i++] << 8 ))
|
||||
(( v |= s[i++] ))
|
||||
t+=${table[v >> 18]}${table[v >> 12 & 63]}
|
||||
c=${table[v >> 6 & 63]}
|
||||
if (( i <= n )); then
|
||||
|
Loading…
x
Reference in New Issue
Block a user