XBMReader.st
changeset 1144 c86a1e3e3884
parent 1049 1afeefeedd14
child 1495 100e4e782f71
--- a/XBMReader.st	Mon Mar 15 11:54:48 1999 +0100
+++ b/XBMReader.st	Thu Mar 18 11:28:23 1999 +0100
@@ -97,6 +97,9 @@
         line := nil.
     ] do:[
         line := inStream nextLine.
+        [line notNil and:[line isEmpty]] whileTrue:[
+            line := inStream nextLine.
+        ].
     ].
     line isNil ifTrue:[
         inStream close.
@@ -107,6 +110,9 @@
             line := nil.
         ] do:[
             line := inStream nextLine.
+            [line notNil and:[line isEmpty]] whileTrue:[
+                line := inStream nextLine.
+            ].
         ].
         line isNil ifTrue:[
             inStream close.
@@ -127,7 +133,7 @@
     inStream close.
     ^ true
 
-    "Modified: 22.4.1997 / 23:12:00 / cg"
+    "Modified: / 18.3.1999 / 11:33:39 / cg"
 ! !
 
 !XBMReader methodsFor:'reading from file'!
@@ -173,10 +179,13 @@
     lineString := lineString copyFrom:(index + 1).
     width := Number readFromString:lineString onError:nil.
     width isNil ifTrue:[
-	^ self fileFormatError:'format error (expected width)'.
+        ^ self fileFormatError:'format error (expected width)'.
     ].
 
     lineString := aStream nextLine.
+    [lineString notNil and:[lineString isEmpty]] whileTrue:[
+        lineString := aStream nextLine.   
+    ].
     index := lineString indexOf:(Character space).
     index := lineString indexOf:(Character space) startingAt:(index + 1).
     (index == 0) ifTrue:[
@@ -188,7 +197,7 @@
     lineString := lineString copyFrom:(index + 1).
     height := Number readFromString:lineString onError:nil.
     height isNil ifTrue:[
-	^ self fileFormatError:'format error (expected height)'.
+        ^ self fileFormatError:'format error (expected height)'.
     ].
 
     bytesPerRow := width // 8.
@@ -202,7 +211,8 @@
     dstIndex := 1.
 
     lineString := aStream nextLine.
-    [lineString startsWith:'#'] whileTrue:[
+    [(lineString startsWith:'#')
+     or:[lineString isEmpty]] whileTrue:[
         lineString := aStream nextLine.
     ].
 
@@ -210,6 +220,9 @@
         lineString := aStream nextLine.
     ].
     lineString := aStream nextLine.
+    [lineString notNil and:[lineString isEmpty]] whileTrue:[
+        lineString := aStream nextLine.
+    ].
 
     [lineString notNil] whileTrue:[
         index := 1.
@@ -225,7 +238,11 @@
                 dstIndex := dstIndex + 1
             ]
         ].
-        lineString := aStream nextLine
+        lineString := aStream nextLine.
+        [lineString notNil and:[lineString isEmpty]] whileTrue:[
+            lineString := aStream nextLine.
+        ].
+
     ].
     photometric := #whiteIs0.
     samplesPerPixel := 1.
@@ -235,7 +252,7 @@
      XBMReader fromFile:'bitmaps/globe1.xbm'
     "
 
-    "Modified: / 3.2.1998 / 18:19:45 / cg"
+    "Modified: / 18.3.1999 / 11:32:46 / cg"
 ! !
 
 !XBMReader methodsFor:'writing to file'!
@@ -324,6 +341,6 @@
 !XBMReader class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libview2/XBMReader.st,v 1.40 1998-08-19 22:40:06 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libview2/XBMReader.st,v 1.41 1999-03-18 10:28:23 cg Exp $'
 ! !
 XBMReader initialize!