ImageReader.st
changeset 6902 6357c181c178
parent 6761 7307a75477f4
child 7142 439177d49d77
--- a/ImageReader.st	Mon Jul 27 19:24:48 2015 +0200
+++ b/ImageReader.st	Sat Aug 08 17:49:42 2015 +0200
@@ -281,69 +281,69 @@
     if (! whiteCountTable) return;
     whiteShiftTable = (char *) malloc(sizeof(char) * 8192);
     if (! whiteShiftTable) {
-        goto fail1;
+	goto fail1;
     }
     blackCountTable = (short *) malloc(sizeof(short) * 8192);
     if (! blackCountTable) {
-        goto fail2;
+	goto fail2;
     }
     blackShiftTable = (char *) malloc(sizeof(char) * 8192);
     if (! blackShiftTable) {
-        free(blackCountTable); blackCountTable = (short *)0;
+	free(blackCountTable); blackCountTable = (short *)0;
 fail2:
-        free(whiteShiftTable); whiteShiftTable = (char *)0;
+	free(whiteShiftTable); whiteShiftTable = (char *)0;
 fail1:
-        free(whiteCountTable); whiteCountTable = (short *)0;
-        return;
+	free(whiteCountTable); whiteCountTable = (short *)0;
+	return;
     }
 
     for (index = 0; index < 8192; index++) {
-        whiteCountTable[index] = -1;
-        blackCountTable[index] = -1;
+	whiteCountTable[index] = -1;
+	blackCountTable[index] = -1;
     }
 
     for (value = 0; value <= 63; value++) {
-        nBits = whiteDef[value].nBits;
-        bits = whiteDef[value].bits >> 3;
-        for (cnt = 1 << (13 - nBits); cnt; cnt--, bits++) {
-            whiteCountTable[bits] = value;
-            whiteShiftTable[bits] = nBits;
-        }
-        nBits = blackDef[value].nBits;
-        bits = blackDef[value].bits >> 3;
-        for (cnt = 1 << (13 - nBits); cnt; cnt--, bits++) {
-            blackCountTable[bits] = value;
-            blackShiftTable[bits] = nBits;
-        }
+	nBits = whiteDef[value].nBits;
+	bits = whiteDef[value].bits >> 3;
+	for (cnt = 1 << (13 - nBits); cnt; cnt--, bits++) {
+	    whiteCountTable[bits] = value;
+	    whiteShiftTable[bits] = nBits;
+	}
+	nBits = blackDef[value].nBits;
+	bits = blackDef[value].bits >> 3;
+	for (cnt = 1 << (13 - nBits); cnt; cnt--, bits++) {
+	    blackCountTable[bits] = value;
+	    blackShiftTable[bits] = nBits;
+	}
     }
     index = value;
 
     for (; value <= 1728; value += 64) {
-        nBits = whiteDef[index].nBits;
-        bits = whiteDef[index].bits >> 3;
-        for (cnt = 1 << (13 - nBits); cnt; cnt--, bits++) {
-            whiteCountTable[bits] = value;
-            whiteShiftTable[bits] = nBits;
-        }
-        nBits = blackDef[index].nBits;
-        bits = blackDef[index].bits >> 3;
-        for (cnt = 1 << (13 - nBits); cnt; cnt--, bits++) {
-            blackCountTable[bits] = value;
-            blackShiftTable[bits] = nBits;
-        }
-        index++;
+	nBits = whiteDef[index].nBits;
+	bits = whiteDef[index].bits >> 3;
+	for (cnt = 1 << (13 - nBits); cnt; cnt--, bits++) {
+	    whiteCountTable[bits] = value;
+	    whiteShiftTable[bits] = nBits;
+	}
+	nBits = blackDef[index].nBits;
+	bits = blackDef[index].bits >> 3;
+	for (cnt = 1 << (13 - nBits); cnt; cnt--, bits++) {
+	    blackCountTable[bits] = value;
+	    blackShiftTable[bits] = nBits;
+	}
+	index++;
     }
 
     for (; value <= 2560; value += 64) {
-        nBits = whiteDef[index].nBits;
-        bits = whiteDef[index].bits >> 3;
-        for (cnt = 1 << (13 - nBits); cnt; cnt--, bits++) {
-            whiteCountTable[bits] = value;
-            whiteShiftTable[bits] = nBits;
-            blackCountTable[bits] = value;
-            blackShiftTable[bits] = nBits;
-        }
-        index++;
+	nBits = whiteDef[index].nBits;
+	bits = whiteDef[index].bits >> 3;
+	for (cnt = 1 << (13 - nBits); cnt; cnt--, bits++) {
+	    whiteCountTable[bits] = value;
+	    whiteShiftTable[bits] = nBits;
+	    blackCountTable[bits] = value;
+	    blackShiftTable[bits] = nBits;
+	}
+	index++;
     }
 }
 
@@ -376,93 +376,93 @@
     bits = (bits << 8) | *from++;
     nBitsLess13 = 3;
     for (;;) {
-        bits13 = (bits >> nBitsLess13) & 0x1FFF;
-        cnt = countPtr[bits13];
-        if (cnt < 0) return 1;
-        shift = shiftPtr[bits13];
-        outCount += cnt;
-        if (countPtr == blackCountTable) {
-            /* toggle if it was a terminating code */
-            if (cnt < 64) {
-                countPtr = whiteCountTable;
-                shiftPtr = whiteShiftTable;
-            }
+	bits13 = (bits >> nBitsLess13) & 0x1FFF;
+	cnt = countPtr[bits13];
+	if (cnt < 0) return 1;
+	shift = shiftPtr[bits13];
+	outCount += cnt;
+	if (countPtr == blackCountTable) {
+	    /* toggle if it was a terminating code */
+	    if (cnt < 64) {
+		countPtr = whiteCountTable;
+		shiftPtr = whiteShiftTable;
+	    }
 
-            /* draw cnt black bits */
-            if (cnt) {
-                if (outBitOffset) {
-                    nLeft = 8 - outBitOffset;
-                    if (cnt < nLeft) nLeft = cnt;
-                    t = leftBits[nLeft] >> outBitOffset;
-                    *to |= t;
-                    cnt -= nLeft;
-                    outBitOffset += nLeft;
-                    if (outBitOffset >= 8) {
-                        to++;
-                        outBitOffset -= 8;
-                    }
-                }
-                if (cnt > 256) {
-                    while ((INT)to & 3) {
-                        *to++ = 0xFF;
-                        cnt -= 8;
-                    }
+	    /* draw cnt black bits */
+	    if (cnt) {
+		if (outBitOffset) {
+		    nLeft = 8 - outBitOffset;
+		    if (cnt < nLeft) nLeft = cnt;
+		    t = leftBits[nLeft] >> outBitOffset;
+		    *to |= t;
+		    cnt -= nLeft;
+		    outBitOffset += nLeft;
+		    if (outBitOffset >= 8) {
+			to++;
+			outBitOffset -= 8;
+		    }
+		}
+		if (cnt > 256) {
+		    while ((INT)to & 3) {
+			*to++ = 0xFF;
+			cnt -= 8;
+		    }
 #if __POINTER_SIZE__ == 8
-                    while ((INT)to & 7) {
-                        *to++ = 0xFF;
-                        cnt -= 8;
-                    }
-                    while (cnt >= 64) {
-                        (*(INT *)to) = 0xFFFFFFFFFFFFFFFF;
-                        to += 8;
-                        cnt -= 64;
-                    }
-                    if (cnt >= 32) {
-                        (*(long *)to) = 0xFFFFFFFF;
-                        to += 4;
-                        cnt -= 32;
-                    }
+		    while ((INT)to & 7) {
+			*to++ = 0xFF;
+			cnt -= 8;
+		    }
+		    while (cnt >= 64) {
+			(*(INT *)to) = 0xFFFFFFFFFFFFFFFF;
+			to += 8;
+			cnt -= 64;
+		    }
+		    if (cnt >= 32) {
+			(*(long *)to) = 0xFFFFFFFF;
+			to += 4;
+			cnt -= 32;
+		    }
 #else
-                    while ((INT)to & 3) {
-                        *to++ = 0xFF;
-                        cnt -= 8;
-                    }
-                    while (cnt >= 32) {
-                        (*(long *)to) = 0xFFFFFFFF;
-                        to += 4;
-                        cnt -= 32;
-                    }
+		    while ((INT)to & 3) {
+			*to++ = 0xFF;
+			cnt -= 8;
+		    }
+		    while (cnt >= 32) {
+			(*(long *)to) = 0xFFFFFFFF;
+			to += 4;
+			cnt -= 32;
+		    }
 #endif
-                }
-                while (cnt >= 8) {
-                    *to++ = 0xFF;
-                    cnt -= 8;
-                }
-                *to |= leftBits[cnt];
-                outBitOffset += cnt;
-            }
-        } else {
-            /* toggle if it was a terminating code */
-            if (cnt < 64) {
-                countPtr = blackCountTable;
-                shiftPtr = blackShiftTable;
-            }
+		}
+		while (cnt >= 8) {
+		    *to++ = 0xFF;
+		    cnt -= 8;
+		}
+		*to |= leftBits[cnt];
+		outBitOffset += cnt;
+	    }
+	} else {
+	    /* toggle if it was a terminating code */
+	    if (cnt < 64) {
+		countPtr = blackCountTable;
+		shiftPtr = blackShiftTable;
+	    }
 
-            /* skip cnt bits */
-            to += cnt >> 3;
-            outBitOffset += cnt & 7;
-            if (outBitOffset >= 8) {
-                to++;
-                outBitOffset -= 8;
-            }
-        }
-        if (outCount >= len) return 1;
+	    /* skip cnt bits */
+	    to += cnt >> 3;
+	    outBitOffset += cnt & 7;
+	    if (outBitOffset >= 8) {
+		to++;
+		outBitOffset -= 8;
+	    }
+	}
+	if (outCount >= len) return 1;
 
-        nBitsLess13 -= shift;
-        while (nBitsLess13 < 0) {
-            bits = (bits << 8) | *from++;
-            nBitsLess13 += 8;
-        }
+	nBitsLess13 -= shift;
+	while (nBitsLess13 < 0) {
+	    bits = (bits << 8) | *from++;
+	    nBitsLess13 += 8;
+	}
     }
 }
 
@@ -470,8 +470,8 @@
  * LZW decompression
  */
 struct buffer {
-        struct buffer *prev;
-        unsigned char chars[8192 - 4];
+	struct buffer *prev;
+	unsigned char chars[8192 - 4];
 };
 
 static int
@@ -504,14 +504,14 @@
 
     strings = (unsigned char **)malloc(sizeof(unsigned char *) * 4096);
     if (! strings) {
-        free(scratchBuffer);
-        return 0;
+	free(scratchBuffer);
+	return 0;
     }
     stringLen = (short *)malloc(sizeof(short) * 4096);
     if (! stringLen) {
-        free(strings);
-        free(scratchBuffer);
-        return 0;
+	free(strings);
+	free(scratchBuffer);
+	return 0;
     }
 
     scratchBuffer->prev = (struct buffer *)0;
@@ -519,9 +519,9 @@
     nScratch = sizeof(scratchBuffer->chars);
 
     for (i = 0; i < 256; i++) {
-        *scratchPtr = i;
-        strings[i] = scratchPtr++;
-        stringLen[i] = 1;
+	*scratchPtr = i;
+	strings[i] = scratchPtr++;
+	stringLen[i] = 1;
     }
 
     nextCode = 258;
@@ -530,151 +530,154 @@
     nBits = 0;
     bits = 0;
     while (inCount) {
-        /* fetch code */
-        while (nBits < codeLen) {
-            bits = (bits<<8) | *from++;
-            inCount--;
-            nBits += 8;
-        }
-        shift = nBits - codeLen;
-        code = (bits >> shift) & mask;
-        bits &= ~(mask << shift);
-        nBits -= codeLen;
+	/* fetch code */
+	while (nBits < codeLen) {
+	    bits = (bits<<8) | *from++;
+	    inCount--;
+	    nBits += 8;
+	}
+	shift = nBits - codeLen;
+	code = (bits >> shift) & mask;
+	bits &= ~(mask << shift);
+	nBits -= codeLen;
 
-        if (code == 257) break;
-        if (code == 256) {
-            if (! inCount)
-                break;
+	if (code == 257) break;
+	if (code == 256) {
+	    if (! inCount)
+		break;
 
-            /* free stuff */
-            while (scratchBuffer->prev) {
-                newBuffer = scratchBuffer;
-                scratchBuffer = scratchBuffer->prev;
-                free(newBuffer);
-            }
-            /* reset everything */
-            scratchPtr = scratchBuffer->chars + 256;
-            nScratch = sizeof(scratchBuffer->chars) - 256;
-            codeLen = 9;
-            nextCode = 258;
-            mask = 0x1FF;
-            /* fetch code */
-            while (nBits < codeLen) {
-                bits = (bits<<8) | *from++;
-                inCount--;
-                nBits += 8;
-            }
-            shift = nBits - codeLen;
-            code = (bits >> shift) & mask;
-            bits &= ~(mask << shift);
-            nBits -= codeLen;
-            if (code == 257) break;
-            /* add to output */
-            if (to >= toEnd) {
-                if (@global(InfoPrinting) == true) {
-                    console_fprintf(stderr, "ImageReader [warning]: LZW outBuffer overrun\n");
-                }
-                ret = 0;
-                break;
-            }
-            *to++ = code;
-            oldCode = code;
-        } else {
-            if (code < nextCode) {
-                /* writeString(string[code]) */
-                len = stringLen[code];
-                bcopy(strings[code], to, len);
-                to += len;
+	    /* free stuff */
+	    while (scratchBuffer->prev) {
+		newBuffer = scratchBuffer;
+		scratchBuffer = scratchBuffer->prev;
+		free(newBuffer);
+	    }
+	    /* reset everything */
+	    scratchPtr = scratchBuffer->chars + 256;
+	    nScratch = sizeof(scratchBuffer->chars) - 256;
+	    codeLen = 9;
+	    nextCode = 258;
+	    mask = 0x1FF;
+	    /* fetch code */
+	    while (nBits < codeLen) {
+		bits = (bits<<8) | *from++;
+		inCount--;
+		nBits += 8;
+	    }
+	    shift = nBits - codeLen;
+	    code = (bits >> shift) & mask;
+	    bits &= ~(mask << shift);
+	    nBits -= codeLen;
+	    if (code == 257) break;
+	    /* add to output */
+	    if (to >= toEnd) {
+		if (@global(InfoPrinting) == true) {
+		    console_fprintf(stderr, "ImageReader [warning]: LZW outBuffer overrun\n");
+		}
+		ret = 0;
+		break;
+	    }
+	    *to++ = code;
+	    oldCode = code;
+	} else {
+	    if (code < nextCode) {
+		/* writeString(string[code]) */
+		len = stringLen[code];
+		bcopy(strings[code], to, len);
+		to += len;
 
-                if (oldCode != -1) {
-                    /* add( string[oldcode] + first(string[code]) ) */
-                    len = stringLen[oldCode] + 1;
-                    if (nScratch < len) {
-                        newBuffer = (struct buffer *)malloc(sizeof(struct buffer));
-                        if (! newBuffer) goto out;
-                        newBuffer->prev = scratchBuffer;
-                        scratchBuffer = newBuffer;
-                        scratchPtr = scratchBuffer->chars;
-                        nScratch = sizeof(scratchBuffer->chars);
-                    }
-                    stringLen[nextCode] = len;
-                    strings[nextCode] = scratchPtr;
-                    bcopy(strings[oldCode], scratchPtr, len-1);
-                    scratchPtr += len-1;
-                    *scratchPtr++ = strings[code][0];
-                    nScratch -= len;
-                    nextCode++;
-                }
-            } else {
-                if (oldCode == -1) {
-                    /* bad input */
-                    ret = 0;
-                    goto out;
-                }
+		if (oldCode != -1) {
+		    /* add( string[oldcode] + first(string[code]) ) */
+		    len = stringLen[oldCode] + 1;
+		    if (nScratch < len) {
+			newBuffer = (struct buffer *)malloc(sizeof(struct buffer));
+			if (! newBuffer) goto out;
+			newBuffer->prev = scratchBuffer;
+			scratchBuffer = newBuffer;
+			scratchPtr = scratchBuffer->chars;
+			nScratch = sizeof(scratchBuffer->chars);
+		    }
+		    stringLen[nextCode] = len;
+		    strings[nextCode] = scratchPtr;
+		    bcopy(strings[oldCode], scratchPtr, len-1);
+		    scratchPtr += len-1;
+		    *scratchPtr++ = strings[code][0];
+		    nScratch -= len;
+		    nextCode++;
+		}
+	    } else {
+		if (oldCode == -1) {
+		    /* bad input */
+		    ret = 0;
+		    goto out;
+		}
 
-                /* writeString(string[oldCode] + first(string[oldCode]) ) */
-                len = stringLen[oldCode];
-                if ((to+len) >= toEnd) {
-                    if (@global(InfoPrinting) == true) {
-                        console_fprintf(stderr, "ImageReader [warning]: LZW outBuffer overrun\n");
-                    }
-                    ret = 0;
-                    goto out;
-                }
-                bcopy(strings[oldCode], to, len);
-                to += len;
-                *to++ = strings[oldCode][0];
+		/* writeString(string[oldCode] + first(string[oldCode]) ) */
+		len = stringLen[oldCode];
+		if ((to+len) >= toEnd) {
+		    if (@global(InfoPrinting) == true) {
+			console_fprintf(stderr, "ImageReader [warning]: LZW outBuffer overrun\n");
+		    }
+		    ret = 0;
+		    goto out;
+		}
+		bcopy(strings[oldCode], to, len);
+		to += len;
+		*to++ = strings[oldCode][0];
 
-                /* add( string[oldcode] + first(string[oldCode]) ) */
-                len++;
-                if (nScratch < len) {
-                    newBuffer = (struct buffer *)malloc(sizeof(struct buffer));
-                    if (! newBuffer) goto out;
-                    newBuffer->prev = scratchBuffer;
-                    scratchBuffer = newBuffer;
-                    scratchPtr = scratchBuffer->chars;
-                    nScratch = sizeof(scratchBuffer->chars);
-                }
-                stringLen[nextCode] = len;
-                strings[nextCode] = scratchPtr;
-                bcopy(strings[oldCode], scratchPtr, len-1);
-                scratchPtr += len-1;
-                *scratchPtr++ = strings[oldCode][0];
-                nScratch -= len;
-                nextCode++;
-            }
-            oldCode = code;
-            if (nextCode >= 511)
-                if (nextCode == 511) {
-                    codeLen = 10;
-                    mask = 0x3FF;
-                } else if (nextCode >= 1023)
-                    if (nextCode == 1023) {
-                        codeLen = 11;
-                        mask = 0x7FF;
-                    } else
-                        if (nextCode == 2047) {
-                            codeLen = 12;
-                            mask = 0xFFF;
-                        }
-        }
+		/* add( string[oldcode] + first(string[oldCode]) ) */
+		len++;
+		if (nScratch < len) {
+		    newBuffer = (struct buffer *)malloc(sizeof(struct buffer));
+		    if (! newBuffer) goto out;
+		    newBuffer->prev = scratchBuffer;
+		    scratchBuffer = newBuffer;
+		    scratchPtr = scratchBuffer->chars;
+		    nScratch = sizeof(scratchBuffer->chars);
+		}
+		stringLen[nextCode] = len;
+		strings[nextCode] = scratchPtr;
+		bcopy(strings[oldCode], scratchPtr, len-1);
+		scratchPtr += len-1;
+		*scratchPtr++ = strings[oldCode][0];
+		nScratch -= len;
+		nextCode++;
+	    }
+	    oldCode = code;
+	    if (nextCode >= 511) {
+		if (nextCode == 511) {
+		    codeLen = 10;
+		    mask = 0x3FF;
+		} else if (nextCode >= 1023) {
+		    if (nextCode == 1023) {
+			codeLen = 11;
+			mask = 0x7FF;
+		    } else {
+			if (nextCode == 2047) {
+			    codeLen = 12;
+			    mask = 0xFFF;
+			}
+		    }
+		}
+	    }
+	}
     }
 out: ;
     /* free stuff */
     while (scratchBuffer) {
-        newBuffer = scratchBuffer;
-        scratchBuffer = scratchBuffer->prev;
-        free(newBuffer);
+	newBuffer = scratchBuffer;
+	scratchBuffer = scratchBuffer->prev;
+	free(newBuffer);
     }
 
     free(strings);
     free(stringLen);
 
     if (from > fromEnd) {
-        if (@global(InfoPrinting) == true) {
-            console_fprintf(stderr, "ImageReader [warning]: LZW inBuffer overrun\n");
-        }
-        ret = 0;
+	if (@global(InfoPrinting) == true) {
+	    console_fprintf(stderr, "ImageReader [warning]: LZW inBuffer overrun\n");
+	}
+	ret = 0;
     }
     return ret;
 }
@@ -682,24 +685,24 @@
 /*
  * delta decoding (TIFF predictor = 2)
  */
-static
+static void
 __decodeDelta__(bytes, width, height)
     register unsigned char *bytes;
 {
-        register w;
-        unsigned char r, g, b;
+	register w;
+	unsigned char r, g, b;
 
-        while (height--) {
-            r = g = b = 0;
-            for (w = width; w; w--) {
-                r += *bytes;
-                *bytes++ = r;
-                g += *bytes;
-                *bytes++ = g;
-                b += *bytes;
-                *bytes++ = b;
-            }
-        }
+	while (height--) {
+	    r = g = b = 0;
+	    for (w = width; w; w--) {
+		r += *bytes;
+		*bytes++ = r;
+		g += *bytes;
+		*bytes++ = g;
+		b += *bytes;
+		*bytes++ = b;
+	    }
+	}
 }
 
 /*
@@ -725,29 +728,29 @@
     int codeLen = initialCodeLen;
     unsigned char *fromEnd, *toEnd;
     static int ranges[] = {0, 1, 2, 4, 8, 16, 32, 64,
-                           128, 256, 512, 1024, 2048 };
+			   128, 256, 512, 1024, 2048 };
 
     fromEnd = from + fromSize;
     toEnd = to + toSize;
 
     if ((unsigned)codeLen > 12) {
-        if (@global(InfoPrinting) == true) {
-            console_fprintf(stderr, "ImageReader [warning]: GIF bad codelen (>12)\n");
-        }
-        return 0;
+	if (@global(InfoPrinting) == true) {
+	    console_fprintf(stderr, "ImageReader [warning]: GIF bad codelen (>12)\n");
+	}
+	return 0;
     }
     prefix = (unsigned short *)malloc(sizeof(short) * 4096);
     if (! prefix) return 0;
     suffix  = (unsigned short *)malloc(sizeof(short) * 4096);
     if (! suffix) {
-        free(prefix);
-        return 0;
+	free(prefix);
+	return 0;
     }
     outCode = (unsigned short *)malloc(sizeof(short) * 4096);
     if (! outCode) {
-        free(prefix);
-        free(suffix);
-        return 0;
+	free(prefix);
+	free(suffix);
+	return 0;
     }
     clearCode = ranges[codeLen]; /* 256 */
     endCode = clearCode + 1;     /* 257 */
@@ -759,119 +762,119 @@
     nBits = 0;
     bits = 0;
     while (inCount) {
-        /* fetch code */
-        while (nBits < codeLen) {
-            bits = bits | (*from++ << nBits);
-            inCount--;
-            nBits += 8;
-        }
-        if (inCount <= 0)
-            break;
-        code = bits & mask;
-        bits >>= codeLen;
-        nBits -= codeLen;
-        if (code == endCode) break;
-        if (code == clearCode) {
-            if (inCount <= 0)
-                break;
+	/* fetch code */
+	while (nBits < codeLen) {
+	    bits = bits | (*from++ << nBits);
+	    inCount--;
+	    nBits += 8;
+	}
+	if (inCount <= 0)
+	    break;
+	code = bits & mask;
+	bits >>= codeLen;
+	nBits -= codeLen;
+	if (code == endCode) break;
+	if (code == clearCode) {
+	    if (inCount <= 0)
+		break;
 
-            codeLen = initialCodeLen;
-            maxCode = clearCode<<1;
-            mask = maxCode - 1;
-            freeCode = clearCode + 2;
+	    codeLen = initialCodeLen;
+	    maxCode = clearCode<<1;
+	    mask = maxCode - 1;
+	    freeCode = clearCode + 2;
 
-            /* fetch code */
-            while (nBits < codeLen) {
-                bits = bits | (*from++ << nBits);
-                inCount--;
-                nBits += 8;
-            }
-            if (inCount <= 0)
-                break;
-            code = bits & mask;
-            bits >>= codeLen;
-            nBits -= codeLen;
-            if (code == endCode) break;
-            /* add to output */
-            if (to >= toEnd) {
-                if (@global(InfoPrinting) == true) {
-                    console_fprintf(stderr, "ImageReader [warning]: GIF outBuffer overrun\n");
-                }
-                ret = 0;
-                break;
-            }
-            *to++ = code;
-            oldCode = fin = curCode = code;
-        } else {
-            curCode = inCode = code;
-            if (curCode >= freeCode) {
-                curCode = oldCode;
-                outCode[outCount++] = fin;
-            }
+	    /* fetch code */
+	    while (nBits < codeLen) {
+		bits = bits | (*from++ << nBits);
+		inCount--;
+		nBits += 8;
+	    }
+	    if (inCount <= 0)
+		break;
+	    code = bits & mask;
+	    bits >>= codeLen;
+	    nBits -= codeLen;
+	    if (code == endCode) break;
+	    /* add to output */
+	    if (to >= toEnd) {
+		if (@global(InfoPrinting) == true) {
+		    console_fprintf(stderr, "ImageReader [warning]: GIF outBuffer overrun\n");
+		}
+		ret = 0;
+		break;
+	    }
+	    *to++ = code;
+	    oldCode = fin = curCode = code;
+	} else {
+	    curCode = inCode = code;
+	    if (curCode >= freeCode) {
+		curCode = oldCode;
+		outCode[outCount++] = fin;
+	    }
 
-            while (curCode >= clearCode) {
-                if (outCount > 1024) {
-                    goto out;
-                }
+	    while (curCode >= clearCode) {
+		if (outCount > 1024) {
+		    goto out;
+		}
 
-                /* debugging and protecting myself from overwrites */
-                if (curCode >= 4096) {
-                    if (@global(InfoPrinting) == true) {
-                        console_fprintf(stderr, "ImageReader [warning]: GIF corrupted input (code > 4095)\n");
-                    }
-                    ret = 0;
-                    break;
-                }
-                outCode[outCount++] = suffix[curCode];
-                curCode = prefix[curCode];
-            }
+		/* debugging and protecting myself from overwrites */
+		if (curCode >= 4096) {
+		    if (@global(InfoPrinting) == true) {
+			console_fprintf(stderr, "ImageReader [warning]: GIF corrupted input (code > 4095)\n");
+		    }
+		    ret = 0;
+		    break;
+		}
+		outCode[outCount++] = suffix[curCode];
+		curCode = prefix[curCode];
+	    }
 
-            fin = curCode;
-            outCode[outCount++] = fin;
+	    fin = curCode;
+	    outCode[outCount++] = fin;
 
 #if 0
-            if ((to+outCount) >= toEnd) {
-                if (@global(InfoPrinting) == true) {
-                    console_fprintf(stderr, "ImageReader [warning]: GIF outBuffer overrun\n");
-                }
-                ret = 0;
-                break;
-            }
+	    if ((to+outCount) >= toEnd) {
+		if (@global(InfoPrinting) == true) {
+		    console_fprintf(stderr, "ImageReader [warning]: GIF outBuffer overrun\n");
+		}
+		ret = 0;
+		break;
+	    }
 #endif
-            for (i = outCount - 1; i >= 0; i--) {
-                if (to >= toEnd) {
-                    if (@global(InfoPrinting) == true) {
-                        console_fprintf(stderr, "ImageReader [warning]: GIF outBuffer overrun\n");
-                    }
-                    ret = 0;
-                    break;
-                }
-                *to++ = outCode[i];
-            }
-            outCount = 0;
+	    for (i = outCount - 1; i >= 0; i--) {
+		if (to >= toEnd) {
+		    if (@global(InfoPrinting) == true) {
+			console_fprintf(stderr, "ImageReader [warning]: GIF outBuffer overrun\n");
+		    }
+		    ret = 0;
+		    break;
+		}
+		*to++ = outCode[i];
+	    }
+	    outCount = 0;
 
-            /* debugging and protecting myself from overwrites */
-            if (freeCode >= 4096) {
-                if (@global(InfoPrinting) == true) {
-                    console_fprintf(stderr, "ImageReader [warning]: GIF corrupted input (freeCode > 4095)\n");
-                }
-                ret = 0;
-                break;
-            }
+	    /* debugging and protecting myself from overwrites */
+	    if (freeCode >= 4096) {
+		if (@global(InfoPrinting) == true) {
+		    console_fprintf(stderr, "ImageReader [warning]: GIF corrupted input (freeCode > 4095)\n");
+		}
+		ret = 0;
+		break;
+	    }
 
-            prefix[freeCode] = oldCode;
-            suffix[freeCode] = fin;
-            oldCode = inCode;
+	    prefix[freeCode] = oldCode;
+	    suffix[freeCode] = fin;
+	    oldCode = inCode;
 
-            freeCode++;
-            if (freeCode >= maxCode) {
-                if (codeLen < 12) {
-                    codeLen++;
-                    maxCode *= 2;
-                    mask = (1 << codeLen) - 1;
-                }
-            }
-        }
+	    freeCode++;
+	    if (freeCode >= maxCode) {
+		if (codeLen < 12) {
+		    codeLen++;
+		    maxCode *= 2;
+		    mask = (1 << codeLen) - 1;
+		}
+	    }
+	}
     }
 out: ;
     free(prefix);
@@ -879,10 +882,10 @@
     free(outCode);
 
     if (from > fromEnd) {
-        if (@global(InfoPrinting) == true) {
-            console_fprintf(stderr, "ImageReader [warning]: GIF inBuffer overrun\n");
-        }
-        ret = 0;
+	if (@global(InfoPrinting) == true) {
+	    console_fprintf(stderr, "ImageReader [warning]: GIF inBuffer overrun\n");
+	}
+	ret = 0;
     }
     return ret;
 }
@@ -918,10 +921,10 @@
     ImageReaders are created temporary to read an image from a stream.
     Normally, they are not directly used - instead, the image class is
     asked to read some file, and return an instance for it:
-        Image fromFile:<someFileName>
+	Image fromFile:<someFileName>
     The Image class will guess the images format and forward the task to
     some concrete ImageReaderClass.
-    If that class thinks, that the file's format is incorrect, 
+    If that class thinks, that the file's format is incorrect,
     other readers are tried until some reader class finds the file's format acceptable.
 
     Image readers read the stream and collect all relevant information internally.
@@ -930,9 +933,9 @@
 
     See the implementation of #fromStream: in concrete subclasses.
     The public interfaces are:
-         <ConcreteReaderClass> fromFile:aFilename
+	 <ConcreteReaderClass> fromFile:aFilename
     or:
-         <ConcreteReaderClass> fromStream:aStream
+	 <ConcreteReaderClass> fromStream:aStream
 
     If you add a new reader, don't forget to add the method #isValidImageFile:
     which should return true, if this reader supports reading a given file.
@@ -941,10 +944,10 @@
     #canRepresent:anImage and return true from this method.
 
     [See also:]
-        Image Icon Form
+	Image Icon Form
 
     [author:]
-        Claus Gittinger
+	Claus Gittinger
 "
 ! !
 
@@ -1023,12 +1026,12 @@
     if (__isByteArrayLike(srcBytes)
      && __isByteArray(dstBytes)
      && __bothSmallInteger(offset, count)) {
-        if (__decodeCCITTgroup3__(__ByteArrayInstPtr(srcBytes)->ba_element,
-                                  __ByteArrayInstPtr(dstBytes)->ba_element
-                                  + __intVal(offset) - 1,
-                                  __intVal(count))) {
-            RETURN ( self );
-        }
+	if (__decodeCCITTgroup3__(__ByteArrayInstPtr(srcBytes)->ba_element,
+				  __ByteArrayInstPtr(dstBytes)->ba_element
+				  + __intVal(offset) - 1,
+				  __intVal(count))) {
+	    RETURN ( self );
+	}
     }
 %}
 .
@@ -1044,16 +1047,16 @@
      && __isByteArray(dstBytes)
      && __bothSmallInteger(codeLen, offset)
      && __isSmallInteger(count)) {
-        if (__decodeGIF__(__ByteArrayInstPtr(srcBytes)->ba_element,
-                          __ByteArrayInstPtr(dstBytes)->ba_element
-                                                +__intVal(offset) - 1,
-                          __intVal(count),
-                          __intVal(codeLen),
-                          __byteArraySize(srcBytes),
-                          __byteArraySize(dstBytes)
-                         )) {
-            RETURN ( self );
-        }
+	if (__decodeGIF__(__ByteArrayInstPtr(srcBytes)->ba_element,
+			  __ByteArrayInstPtr(dstBytes)->ba_element
+						+__intVal(offset) - 1,
+			  __intVal(count),
+			  __intVal(codeLen),
+			  __byteArraySize(srcBytes),
+			  __byteArraySize(dstBytes)
+			 )) {
+	    RETURN ( self );
+	}
     }
 %}
 .
@@ -1068,15 +1071,15 @@
     if (__isByteArrayLike(srcBytes)
      && __isByteArray(dstBytes)
      && __bothSmallInteger(offset, count)) {
-        if (__decodeLZW__(__ByteArrayInstPtr(srcBytes)->ba_element,
-                          __ByteArrayInstPtr(dstBytes)->ba_element
-                                              + __intVal(offset) - 1,
-                          __intVal(count),
-                          __byteArraySize(srcBytes),
-                          __byteArraySize(dstBytes)
-                        )) {
-            RETURN ( self );
-        }
+	if (__decodeLZW__(__ByteArrayInstPtr(srcBytes)->ba_element,
+			  __ByteArrayInstPtr(dstBytes)->ba_element
+					      + __intVal(offset) - 1,
+			  __intVal(count),
+			  __byteArraySize(srcBytes),
+			  __byteArraySize(dstBytes)
+			)) {
+	    RETURN ( self );
+	}
     }
 %}
 .
@@ -1094,26 +1097,26 @@
     i := 1.
 
     [i <= nIn] whileTrue:[
-        b := srcBytes at:i.
-        i := i + 1.
+	b := srcBytes at:i.
+	i := i + 1.
 
-        b ~~ 16rFF ifTrue:[   "/ not a NOP
-            b <= 127 ifTrue:[
-                "/ 0..127 literal bytes
-                n := b + 1.
-                dstBytes replaceFrom:dstOffs to:dstOffs+n-1 with:srcBytes startingAt:i.
-                i := i + n.
-            ] ifFalse:[                  
-                "/ 128..254 a run        
-                n := b - 125.
+	b ~~ 16rFF ifTrue:[   "/ not a NOP
+	    b <= 127 ifTrue:[
+		"/ 0..127 literal bytes
+		n := b + 1.
+		dstBytes replaceFrom:dstOffs to:dstOffs+n-1 with:srcBytes startingAt:i.
+		i := i + n.
+	    ] ifFalse:[
+		"/ 128..254 a run
+		n := b - 125.
 
-                v := srcBytes at:i.
-                i := i + 1.
+		v := srcBytes at:i.
+		i := i + 1.
 
-                dstBytes from:dstOffs to:dstOffs+n put:v.
-            ].
-            dstOffs := dstOffs + n.
-        ]
+		dstBytes from:dstOffs to:dstOffs+n put:v.
+	    ].
+	    dstOffs := dstOffs + n.
+	]
     ].
     ^ dstOffs - dstOffset
 
@@ -1132,28 +1135,28 @@
     i := srcStart.
     nRemaining := outCount.
     [nRemaining > 0] whileTrue:[
-        b := srcBytes at:i.
-        i := i + 1.
+	b := srcBytes at:i.
+	i := i + 1.
 
-        b ~~ 16rFF ifTrue:[   "/ not a NOP
-            b <= 127 ifTrue:[
-                "/ 0..127 literal bytes
-                n := b + 1.
-                dstBytes replaceFrom:dstOffs to:dstOffs+n-1 with:srcBytes startingAt:i.
-                nRemaining := nRemaining - n.
-                i := i + n.
-            ] ifFalse:[                  
-                "/ 128..254 a run        
-                n := b - 125.
+	b ~~ 16rFF ifTrue:[   "/ not a NOP
+	    b <= 127 ifTrue:[
+		"/ 0..127 literal bytes
+		n := b + 1.
+		dstBytes replaceFrom:dstOffs to:dstOffs+n-1 with:srcBytes startingAt:i.
+		nRemaining := nRemaining - n.
+		i := i + n.
+	    ] ifFalse:[
+		"/ 128..254 a run
+		n := b - 125.
 
-                v := srcBytes at:i.
-                i := i + 1.
+		v := srcBytes at:i.
+		i := i + 1.
 
-                dstBytes from:dstOffs to:dstOffs+n-1 put:v.
-                nRemaining := nRemaining - n.
-            ].
-            dstOffs := dstOffs + n.
-        ]
+		dstBytes from:dstOffs to:dstOffs+n-1 put:v.
+		nRemaining := nRemaining - n.
+	    ].
+	    dstOffs := dstOffs + n.
+	]
     ].
     ^ i-srcStart
 !
@@ -1236,7 +1239,7 @@
      bytes := ByteArray new:1000000.
      bytes replaceFrom:1 with:#[ 0 1 2 3 4 5 6 7 8 9 10 11 12].
      Time millisecondsToRun:[
-        self swap:1000000 bytesFromRGB_to_BGR_in:bytes.
+	self swap:1000000 bytesFromRGB_to_BGR_in:bytes.
      ].
      bytes copyTo:10.
     "
@@ -1249,35 +1252,35 @@
     |t|
 
 %{  /* OPTIONAL */
-    if (__isByteArray(data) 
+    if (__isByteArray(data)
      && __isSmallInteger(nBytes)
      && __isSmallInteger(startIndex)) {
-        int __nBytes = __intVal(nBytes);
-        int __startOffset = __intVal(startIndex) - 1;
-        int __dataSize = __byteArraySize(data);
+	int __nBytes = __intVal(nBytes);
+	int __startOffset = __intVal(startIndex) - 1;
+	int __dataSize = __byteArraySize(data);
 
-        if ((__startOffset + __nBytes) <= __dataSize) {
-            int __lastIndex = __startOffset + __nBytes - 2;
-            unsigned char *__cp = __ByteArrayInstPtr(data)->ba_element + __startOffset;
-            int __i;
-            unsigned char __t;
+	if ((__startOffset + __nBytes) <= __dataSize) {
+	    int __lastIndex = __startOffset + __nBytes - 2;
+	    unsigned char *__cp = __ByteArrayInstPtr(data)->ba_element + __startOffset;
+	    int __i;
+	    unsigned char __t;
 
-            for (__i=__startOffset; __i<__lastIndex; __i+=3, __cp+=3) {
-                __t = __cp[0];
-                __cp[0] = __cp[2];
-                __cp[2] = __t;
-            }
-            RETURN (true);
-        }
+	    for (__i=__startOffset; __i<__lastIndex; __i+=3, __cp+=3) {
+		__t = __cp[0];
+		__cp[0] = __cp[2];
+		__cp[2] = __t;
+	    }
+	    RETURN (true);
+	}
     }
 %}.
     1 to:(nBytes - 2) by:3 do:[:i |
-        |ii|
+	|ii|
 
-        ii := i + startIndex - 1.
-        t := data at:ii.
-        data at:i put:(data at:ii+2).
-        data at:ii+2 put:t
+	ii := i + startIndex - 1.
+	t := data at:ii.
+	data at:i put:(data at:ii+2).
+	data at:ii+2 put:t
     ].
 
     "
@@ -1293,7 +1296,7 @@
      bytes := ByteArray new:1000000.
      bytes replaceFrom:1 with:#[ 0 1 2 3 4 5 6 7 8 9 10 11 12].
      Time millisecondsToRun:[
-        self swap:1000000 bytesFromRGB_to_BGR_in:bytes.
+	self swap:1000000 bytesFromRGB_to_BGR_in:bytes.
      ].
      bytes copyTo:10.
     "
@@ -1378,17 +1381,17 @@
     |readerClass response|
 
     self == ImageReader ifTrue:[
-        "select a reader supporting this file format"
-        readerClass := self readerClassForFilename:url asURL path.
-        readerClass ~~ self ifTrue:[
-            ^ readerClass fromURL:url.
-        ].
+	"select a reader supporting this file format"
+	readerClass := self readerClassForFilename:url asURL path.
+	readerClass ~~ self ifTrue:[
+	    ^ readerClass fromURL:url.
+	].
     ].
 
     response := HTTPInterface get:url.
     response isErrorResponse ifTrue:[
-        self error:'failed to read url' mayProceed:true.
-        ^ nil
+	self error:'failed to read url' mayProceed:true.
+	^ nil
     ].
     ^ self fromBytes:(response data).
 
@@ -1437,24 +1440,24 @@
     |readerClass reader inStream|
 
     self == ImageReader ifTrue:[
-        "select a reader supporting this file format"
-        readerClass := self readerClassForFilename:aFilename.
-        readerClass ~~ self ifTrue:[
-            ^ readerClass readFile:aFilename.
-        ].
+	"select a reader supporting this file format"
+	readerClass := self readerClassForFilename:aFilename.
+	readerClass ~~ self ifTrue:[
+	    ^ readerClass readFile:aFilename.
+	].
     ].
 
     inStream := self streamReadingFile:aFilename.
     inStream isNil ifTrue:[
-        'ImageReader [warning]: file open error' errorPrintCR.
-        ^ nil
+	'ImageReader [warning]: file open error' errorPrintCR.
+	^ nil
     ].
     reader := self new.
     reader inStream:inStream.
     [
-        reader fromStream:inStream.
+	reader fromStream:inStream.
     ] ensure:[
-        inStream close.
+	inStream close.
     ].
     ^ reader
 
@@ -1488,15 +1491,15 @@
 
     mime := aStringOrFilename asFilename mimeTypeFromName.
     mime isNil ifTrue:[
-        mime := aStringOrFilename asFilename mimeTypeOfContents.
+	mime := aStringOrFilename asFilename mimeTypeOfContents.
     ].
 
     mime notNil ifTrue:[
-        reader := MIMETypes imageReaderForType:mime.
+	reader := MIMETypes imageReaderForType:mime.
     ].
     reader isNil ifTrue:[
-        "answer the reader when proceeding form this error"
-        reader := ConversionError raiseRequestErrorString:(' - unsupported image type: ''%1''' bindWith:(mime ? aStringOrFilename asFilename suffix)).
+	"answer the reader when proceeding form this error"
+	reader := ConversionError raiseRequestErrorString:(' - unsupported image type: ''%1''' bindWith:(mime ? aStringOrFilename asFilename suffix)).
     ].
     ^ reader
 
@@ -1546,65 +1549,65 @@
 */
 
     for (__y=__h; __y>0; __y--) {
-        __outBits = 0;
-        __nOut = 8;
-        __nextOutRow = __outP + __bpr;
+	__outBits = 0;
+	__nOut = 8;
+	__nextOutRow = __outP + __bpr;
 
-        for (__x=__w; __x>=8; __x-=8) {
-            if (__inP[0] != __maskPixel) { __outBits |= 0x80; };
-            if (__inP[1] != __maskPixel) { __outBits |= 0x40; };
-            if (__inP[2] != __maskPixel) { __outBits |= 0x20; };
-            if (__inP[3] != __maskPixel) { __outBits |= 0x10; };
-            if (__inP[4] != __maskPixel) { __outBits |= 0x08; };
-            if (__inP[5] != __maskPixel) { __outBits |= 0x04; };
-            if (__inP[6] != __maskPixel) { __outBits |= 0x02; };
-            if (__inP[7] != __maskPixel) { __outBits |= 0x01; };
-            __inP += 8;
-            *__outP++ = __outBits;
-            __outBits = 0;
-        }
-        for (; __x>0; __x--) {
-            __outBits <<= 1;
-            if (*__inP != __maskPixel) {
-                __outBits |= 1;
-            }
-            __inP++;
+	for (__x=__w; __x>=8; __x-=8) {
+	    if (__inP[0] != __maskPixel) { __outBits |= 0x80; };
+	    if (__inP[1] != __maskPixel) { __outBits |= 0x40; };
+	    if (__inP[2] != __maskPixel) { __outBits |= 0x20; };
+	    if (__inP[3] != __maskPixel) { __outBits |= 0x10; };
+	    if (__inP[4] != __maskPixel) { __outBits |= 0x08; };
+	    if (__inP[5] != __maskPixel) { __outBits |= 0x04; };
+	    if (__inP[6] != __maskPixel) { __outBits |= 0x02; };
+	    if (__inP[7] != __maskPixel) { __outBits |= 0x01; };
+	    __inP += 8;
+	    *__outP++ = __outBits;
+	    __outBits = 0;
+	}
+	for (; __x>0; __x--) {
+	    __outBits <<= 1;
+	    if (*__inP != __maskPixel) {
+		__outBits |= 1;
+	    }
+	    __inP++;
 
 /*
  printf("x: %d  bits: %x\n", __x, __outBits);
 */
-            if (--__nOut == 0) {
+	    if (--__nOut == 0) {
 #ifdef DEBUG
-                if (__outP >= outEnd) {
-                    if (@global(InfoPrinting) == true) {
-                        console_fprintf(stderr, "oops %d\n", __LINE__);
-                    }
-                    goto fail;
-                }
+		if (__outP >= outEnd) {
+		    if (@global(InfoPrinting) == true) {
+			console_fprintf(stderr, "oops %d\n", __LINE__);
+		    }
+		    goto fail;
+		}
 #endif
-                *__outP = __outBits;
+		*__outP = __outBits;
 
-                __outP++;
-                __nOut = 8;
-                __outBits = 0;
-            }
-        }
+		__outP++;
+		__nOut = 8;
+		__outBits = 0;
+	    }
+	}
 
-        if (__nOut != 8) {
-            __outBits <<= __nOut;
+	if (__nOut != 8) {
+	    __outBits <<= __nOut;
 
 #ifdef DEBUG
-            if (__outP >= outEnd) {
-                if (@global(InfoPrinting) == true) {
-                    console_fprintf(stderr, "oops2 %d\n", __LINE__);
-                }
-                goto fail;
-            }
+	    if (__outP >= outEnd) {
+		if (@global(InfoPrinting) == true) {
+		    console_fprintf(stderr, "oops2 %d\n", __LINE__);
+		}
+		goto fail;
+	    }
 #endif
-            *__outP = __outBits;
+	    *__outP = __outBits;
 
-        }
-        __outP = __nextOutRow;
+	}
+	__outP = __nextOutRow;
     }
 fail: ;
 %}.
@@ -1832,7 +1835,7 @@
     "return the photometric interpretation of the image data.
      This may be a somewhat old leftover from times, when tiff was the first image file type to be read.
      Much better would be to always have some (possibly fake and virtual) colormap around, and ask that one.
-     However, in the meantime, many other classes depend on that, so that it should be kept as an API 
+     However, in the meantime, many other classes depend on that, so that it should be kept as an API
      - even when the internal representation will be replaced by something better in the future."
 
     ^ photometric
@@ -1887,7 +1890,7 @@
 
     errorString := self class name , ' [info]: ' , aMessage.
     inStream isFileStream ifTrue:[
-        errorString := errorString , ' [in ' , inStream pathName , ']'
+	errorString := errorString , ' [in ' , inStream pathName , ']'
     ].
 
     Image badImageFormatQuerySignal raiseRequestErrorString:errorString.
@@ -1986,7 +1989,7 @@
     "save image in my format on aFile"
 
     self writingFile:aFileName for:image do:[:stream |
-        self save:image onStream:stream.
+	self save:image onStream:stream.
     ].
 
     "Modified: / 01-06-2010 / 19:02:17 / cg"
@@ -1996,8 +1999,8 @@
     "save image in my format on a Stream"
 
     ^ Image cannotRepresentImageSignal
-        raiseWith:image
-        errorString:('image save not implemented/supported for this format').
+	raiseWith:image
+	errorString:('image save not implemented/supported for this format').
 !
 
 saveAll:aCollectionOfImages onFile:aFileName
@@ -2006,7 +2009,7 @@
      for an exception to be raised."
 
     self writingFile:aFileName for:aCollectionOfImages do:[:stream |
-        self saveAll:aCollectionOfImages onStream:stream.
+	self saveAll:aCollectionOfImages onStream:stream.
     ].
 
     "Modified: / 01-06-2010 / 19:02:17 / cg"
@@ -2018,8 +2021,8 @@
      for an exception to be raised."
 
     ^ Image cannotRepresentImageSignal
-        raiseWith:aCollectionOfImages
-        errorString:('save of imageSequence not implemented/supported for this format').
+	raiseWith:aCollectionOfImages
+	errorString:('save of imageSequence not implemented/supported for this format').
 !
 
 writingFile:aFileName for:something do:aBlock
@@ -2028,25 +2031,25 @@
     |stream|
 
     [
-        stream := aFileName asFilename newReadWriteStream.
+	stream := aFileName asFilename newReadWriteStream.
     ] on:FileStream openErrorSignal do:[:ex|
-        ^ Image fileCreationErrorSignal
-            raiseWith:something
-            errorString:('file creation error: ' , aFileName asString).
+	^ Image fileCreationErrorSignal
+	    raiseWith:something
+	    errorString:('file creation error: ' , aFileName asString).
     ].
 
     [
-        [
-            aBlock value: stream
-        ] ensure:[
-            stream close.
-        ].
+	[
+	    aBlock value: stream
+	] ensure:[
+	    stream close.
+	].
     ] ifCurtailed:[
-        OperatingSystem accessDeniedErrorSignal 
-            handle:[:ex |] 
-            do:[
-                aFileName asFilename delete.
-            ]
+	OperatingSystem accessDeniedErrorSignal
+	    handle:[:ex |]
+	    do:[
+		aFileName asFilename delete.
+	    ]
     ].
 ! !
 
@@ -2108,10 +2111,9 @@
 !ImageReader class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libview/ImageReader.st,v 1.114 2015-02-09 16:58:13 cg Exp $'
+    ^ '$Header$'
 !
 
 version_CVS
-    ^ '$Header: /cvs/stx/stx/libview/ImageReader.st,v 1.114 2015-02-09 16:58:13 cg Exp $'
+    ^ '$Header$'
 ! !
-