.
--- a/WinIconRdr.st Mon Sep 18 00:52:44 1995 +0200
+++ b/WinIconRdr.st Mon Sep 18 12:35:20 1995 +0200
@@ -35,7 +35,7 @@
version
"
-$Header: /cvs/stx/stx/libview2/Attic/WinIconRdr.st,v 1.17 1995-09-17 22:52:44 claus Exp $
+$Header: /cvs/stx/stx/libview2/Attic/WinIconRdr.st,v 1.18 1995-09-18 10:35:20 claus Exp $
"
!
@@ -64,36 +64,34 @@
inStream isNil ifTrue:[^ false].
inStream binary.
- inStream size < 16 ifTrue:[
- ^ false
- ].
+ ok := false.
+ inStream size > 16 ifTrue:[
+ header := ByteArray uninitializedNew:4.
+ inStream nextBytes:4 into:header.
- header := ByteArray uninitializedNew:4.
- inStream nextBytes:4 into:header.
-
- ok := false.
- (header startsWith:#(66 77)) ifTrue:[ "BM"
- ok := true.
-"/ 'WINREADER: Win3.x or OS/2 vsn 2 BM format' infoPrintNL.
+ (header startsWith:#(66 77)) ifTrue:[ "BM"
+ ok := true.
+"/ 'WINREADER: Win3.x or OS/2 vsn 2 BM format' infoPrintNL.
+ ].
+ (header startsWith:#(66 65)) ifTrue:[ "BA"
+ ok := true.
+"/ 'WINREADER: OS/2 vsn 2 BA format' infoPrintNL.
+ ].
+ (header startsWith:#(73 67)) ifTrue:[ "IC"
+ ok := true.
+"/ 'WINREADER: OS/2 IC format' infoPrintNL.
+ ].
+ (header startsWith:#(80 84)) ifTrue:[ "PT"
+ ok := true.
+"/ 'WINREADER: OS/2 PT format' infoPrintNL.
+ ].
+ (header startsWith:#(0 0 1 0)) ifTrue:[
+ ok := true.
+"/ 'WINREADER: Win3.x ICO format' infoPrintNL.
+ ].
].
- (header startsWith:#(66 65)) ifTrue:[ "BA"
- ok := true.
-"/ 'WINREADER: OS/2 vsn 2 BA format' infoPrintNL.
- ].
- (header startsWith:#(73 67)) ifTrue:[ "IC"
- ok := true.
-"/ 'WINREADER: OS/2 IC format' infoPrintNL.
- ].
- (header startsWith:#(80 84)) ifTrue:[ "PT"
- ok := true.
-"/ 'WINREADER: OS/2 PT format' infoPrintNL.
- ].
- (header startsWith:#(0 0 1 0)) ifTrue:[
- ok := true.
-"/ 'WINREADER: Win3.x ICO format' infoPrintNL.
- ].
- ok ifFalse:[^ false].
- ^ true
+ inStream close.
+ ^ ok
"
WindowsIconReader isValidImageFile:'/phys/clam2/LocalLibrary/Images/OS2_icons/dos.ico'
--- a/WindowsIconReader.st Mon Sep 18 00:52:44 1995 +0200
+++ b/WindowsIconReader.st Mon Sep 18 12:35:20 1995 +0200
@@ -35,7 +35,7 @@
version
"
-$Header: /cvs/stx/stx/libview2/WindowsIconReader.st,v 1.17 1995-09-17 22:52:44 claus Exp $
+$Header: /cvs/stx/stx/libview2/WindowsIconReader.st,v 1.18 1995-09-18 10:35:20 claus Exp $
"
!
@@ -64,36 +64,34 @@
inStream isNil ifTrue:[^ false].
inStream binary.
- inStream size < 16 ifTrue:[
- ^ false
- ].
+ ok := false.
+ inStream size > 16 ifTrue:[
+ header := ByteArray uninitializedNew:4.
+ inStream nextBytes:4 into:header.
- header := ByteArray uninitializedNew:4.
- inStream nextBytes:4 into:header.
-
- ok := false.
- (header startsWith:#(66 77)) ifTrue:[ "BM"
- ok := true.
-"/ 'WINREADER: Win3.x or OS/2 vsn 2 BM format' infoPrintNL.
+ (header startsWith:#(66 77)) ifTrue:[ "BM"
+ ok := true.
+"/ 'WINREADER: Win3.x or OS/2 vsn 2 BM format' infoPrintNL.
+ ].
+ (header startsWith:#(66 65)) ifTrue:[ "BA"
+ ok := true.
+"/ 'WINREADER: OS/2 vsn 2 BA format' infoPrintNL.
+ ].
+ (header startsWith:#(73 67)) ifTrue:[ "IC"
+ ok := true.
+"/ 'WINREADER: OS/2 IC format' infoPrintNL.
+ ].
+ (header startsWith:#(80 84)) ifTrue:[ "PT"
+ ok := true.
+"/ 'WINREADER: OS/2 PT format' infoPrintNL.
+ ].
+ (header startsWith:#(0 0 1 0)) ifTrue:[
+ ok := true.
+"/ 'WINREADER: Win3.x ICO format' infoPrintNL.
+ ].
].
- (header startsWith:#(66 65)) ifTrue:[ "BA"
- ok := true.
-"/ 'WINREADER: OS/2 vsn 2 BA format' infoPrintNL.
- ].
- (header startsWith:#(73 67)) ifTrue:[ "IC"
- ok := true.
-"/ 'WINREADER: OS/2 IC format' infoPrintNL.
- ].
- (header startsWith:#(80 84)) ifTrue:[ "PT"
- ok := true.
-"/ 'WINREADER: OS/2 PT format' infoPrintNL.
- ].
- (header startsWith:#(0 0 1 0)) ifTrue:[
- ok := true.
-"/ 'WINREADER: Win3.x ICO format' infoPrintNL.
- ].
- ok ifFalse:[^ false].
- ^ true
+ inStream close.
+ ^ ok
"
WindowsIconReader isValidImageFile:'/phys/clam2/LocalLibrary/Images/OS2_icons/dos.ico'