--- a/Base64Coder.st Tue Mar 19 17:28:18 2019 +0100
+++ b/Base64Coder.st Wed Mar 20 21:23:46 2019 +0100
@@ -383,25 +383,27 @@
The number of bits in buffer is not a multiple of 6, so we pad
the buffer and signal that padding has been done via $= characters."
- |b1 b2 b3 b4|
+ |tempBuffer "{Class: SmallInteger}"
+ b1 b2 b3 b4|
bits == 0 ifTrue:[
"buffer is empty, nothing to do"
^ self.
].
+ tempBuffer := buffer.
bits == 8 ifTrue:[
- buffer := buffer bitShift:4.
+ tempBuffer := tempBuffer bitShift:4.
b4 := b3 := 64. "pad with '=='"
- b1 := (buffer bitShift:-6) bitAnd:16r3F.
- b2 := buffer bitAnd:16r3F.
+ b1 := (tempBuffer bitShift:-6) bitAnd:16r3F.
+ b2 := tempBuffer bitAnd:16r3F.
] ifFalse:[
bits = 16 ifTrue:[
- buffer := buffer bitShift:2.
+ tempBuffer := tempBuffer bitShift:2.
b4 := 64. "pad with '='"
- b3 := buffer bitAnd:16r3F.
- b2 := (buffer bitShift:-6) bitAnd:16r3F.
- b1 := (buffer bitShift:-12) bitAnd:16r3F.
+ b3 := tempBuffer bitAnd:16r3F.
+ b2 := (tempBuffer bitShift:-6) bitAnd:16r3F.
+ b1 := (tempBuffer bitShift:-12) bitAnd:16r3F.
]
].
bits := buffer := 0.
@@ -418,7 +420,7 @@
nextPut:(mapping at:b4+1).
charCount := charCount + 4.
- "Modified: / 30-09-2018 / 15:15:52 / Claus Gittinger"
+ "Modified: / 20-03-2019 / 21:22:39 / Claus Gittinger"
! !
!Base64Coder methodsFor:'private'!