handle empty character-strings
authorClaus Gittinger <cg@exept.de>
Thu, 05 Sep 1996 17:37:54 +0200
changeset 329 5fb99e0734e4
parent 328 f429f549b40a
child 330 d7ce98930ad3
handle empty character-strings
TIFFRdr.st
TIFFReader.st
--- a/TIFFRdr.st	Fri Aug 02 23:13:49 1996 +0200
+++ b/TIFFRdr.st	Thu Sep 05 17:37:54 1996 +0200
@@ -755,17 +755,21 @@
 
     |oldPos offset string|
 
+    n == 0 ifTrue:[^ ''].
+
     string := String new:(n - 1).
     (n <= 4) ifTrue:[
-	inStream nextBytes:(n - 1) into:string
+        inStream nextBytes:(n - 1) into:string
     ] ifFalse:[
-	offset := inStream nextLongMSB:(byteOrder ~~ #lsb).
-	oldPos := inStream position.
-	inStream position:(offset + 1).
-	inStream nextBytes:(n - 1) into:string.
-	inStream position:oldPos
+        offset := inStream nextLongMSB:(byteOrder ~~ #lsb).
+        oldPos := inStream position.
+        inStream position:(offset + 1).
+        inStream nextBytes:(n - 1) into:string.
+        inStream position:oldPos
     ].
     ^ string
+
+    "Modified: 5.9.1996 / 12:21:08 / cg"
 !
 
 readFracts:nFracts
@@ -1653,6 +1657,6 @@
 !TIFFReader  class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libview2/Attic/TIFFRdr.st,v 1.38 1996-07-11 19:15:48 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libview2/Attic/TIFFRdr.st,v 1.39 1996-09-05 15:37:54 cg Exp $'
 ! !
 TIFFReader initialize!
--- a/TIFFReader.st	Fri Aug 02 23:13:49 1996 +0200
+++ b/TIFFReader.st	Thu Sep 05 17:37:54 1996 +0200
@@ -755,17 +755,21 @@
 
     |oldPos offset string|
 
+    n == 0 ifTrue:[^ ''].
+
     string := String new:(n - 1).
     (n <= 4) ifTrue:[
-	inStream nextBytes:(n - 1) into:string
+        inStream nextBytes:(n - 1) into:string
     ] ifFalse:[
-	offset := inStream nextLongMSB:(byteOrder ~~ #lsb).
-	oldPos := inStream position.
-	inStream position:(offset + 1).
-	inStream nextBytes:(n - 1) into:string.
-	inStream position:oldPos
+        offset := inStream nextLongMSB:(byteOrder ~~ #lsb).
+        oldPos := inStream position.
+        inStream position:(offset + 1).
+        inStream nextBytes:(n - 1) into:string.
+        inStream position:oldPos
     ].
     ^ string
+
+    "Modified: 5.9.1996 / 12:21:08 / cg"
 !
 
 readFracts:nFracts
@@ -1653,6 +1657,6 @@
 !TIFFReader  class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libview2/TIFFReader.st,v 1.38 1996-07-11 19:15:48 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libview2/TIFFReader.st,v 1.39 1996-09-05 15:37:54 cg Exp $'
 ! !
 TIFFReader initialize!