change __isString() to __isStringLike() in primitive code
authorStefan Vogel <sv@exept.de>
Thu, 05 Nov 2009 17:25:23 +0100
changeset 2335 609923563c1d
parent 2334 1a245a5b81ab
child 2336 072bb2f98ec9
change __isString() to __isStringLike() in primitive code
ZipStream.st
--- a/ZipStream.st	Thu Nov 05 17:25:21 2009 +0100
+++ b/ZipStream.st	Thu Nov 05 17:25:23 2009 +0100
@@ -202,7 +202,7 @@
       and:[bytesIn  size >= stop
       and:[bytesOut size >  0]]]
      ) ifFalse:[
-	^ self error:'invalid argument size'
+        ^ self error:'invalid argument size'
     ].
 
 %{
@@ -213,42 +213,42 @@
 
     if( (__isSmallInteger(start)) && (__isSmallInteger(stop)) && (__isSmallInteger(size)) )
     {
-	__countIn = __intVal( size );
+        __countIn = __intVal( size );
 
-	if (__isBytes(bytesIn)) {
-	    __bytesIn = __ByteArrayInstPtr(bytesIn)->ba_element;
-	} else {
-	    if (__isString(bytesIn)) {
-		__bytesIn = __stringVal( bytesIn );
-	    }
-	}
+        if (__isBytes(bytesIn)) {
+            __bytesIn = __ByteArrayInstPtr(bytesIn)->ba_element;
+        } else {
+            if (__isStringLike(bytesIn)) {
+                __bytesIn = __stringVal( bytesIn );
+            }
+        }
 
-	if (__isBytes(bytesOut)) {
-	    __bytesOut = __ByteArrayInstPtr(bytesOut)->ba_element;
-	    __countOut = __byteArraySize( bytesOut );
-	} else {
-	    if (__isString(bytesOut)) {
-		__bytesOut = __stringVal( bytesOut );
-		__countOut = __stringSize( bytesOut );
-	    }
-	}
+        if (__isBytes(bytesOut)) {
+            __bytesOut = __ByteArrayInstPtr(bytesOut)->ba_element;
+            __countOut = __byteArraySize( bytesOut );
+        } else {
+            if (__isString(bytesOut)) {
+                __bytesOut = __stringVal( bytesOut );
+                __countOut = __stringSize( bytesOut );
+            }
+        }
     }
 
     if( __bytesOut && __bytesIn )
     {
-	int __result = Z_OK;
+        int __result = Z_OK;
 
-	__bytesIn += (__intVal( start)) - 1;
+        __bytesIn += (__intVal( start)) - 1;
 
-	if( doCompress == true )
-	    __result   = compress  ( (Byte *) __bytesOut, & __countOut, (Byte *) __bytesIn, __countIn );
-	else
-	    __result   = uncompress( (Byte *) __bytesOut, & __countOut, (Byte *) __bytesIn, __countIn );
+        if( doCompress == true )
+            __result   = compress  ( (Byte *) __bytesOut, & __countOut, (Byte *) __bytesIn, __countIn );
+        else
+            __result   = uncompress( (Byte *) __bytesOut, & __countOut, (Byte *) __bytesIn, __countIn );
 
-	if( __result == Z_OK )
-	    { RETURN(__MKSMALLINT(__countOut)); }
+        if( __result == Z_OK )
+            { RETURN(__MKSMALLINT(__countOut)); }
 
-	errorNr = __MKSMALLINT( __result );
+        errorNr = __MKSMALLINT( __result );
     }
 %}.
 
@@ -338,32 +338,32 @@
 
 %{
     if (__isInteger(crc) && __isSmallInteger(start) && __isSmallInteger(stop)) {
-	char * __bytes  = 0;
-	unsigned int __size;
-	uLong  __crc  = __unsignedLongIntVal( crc );
-	uInt   __start = __intVal( start );
-	uInt   __stop = __intVal( stop );
+        char * __bytes  = 0;
+        unsigned int __size;
+        uLong  __crc  = __unsignedLongIntVal( crc );
+        uInt   __start = __intVal( start );
+        uInt   __stop = __intVal( stop );
 
-	if (__isBytes(bytesIn)) {
-	    __bytes = __byteArrayVal(bytesIn);
-	    __size = __byteArraySize(bytesIn);
-	} else if (__isString(bytesIn)) {
-	    __bytes = __stringVal(bytesIn);
-	    __size = __stringSize(bytesIn);
-	} else {
-	    goto err;
-	}
+        if (__isBytes(bytesIn)) {
+            __bytes = __byteArrayVal(bytesIn);
+            __size = __byteArraySize(bytesIn);
+        } else if (__isStringLike(bytesIn)) {
+            __bytes = __stringVal(bytesIn);
+            __size = __stringSize(bytesIn);
+        } else {
+            goto err;
+        }
 
 
-	if (__start < 1 || __start > __size) goto err;
-	if (__stop < 1 || __stop > __size) goto err;
+        if (__start < 1 || __start > __size) goto err;
+        if (__stop < 1 || __stop > __size) goto err;
 
-	__size = __stop - __start + 1;
+        __size = __stop - __start + 1;
 
-	__bytes += __start - 1;
-	__crc = crc32(__crc, (Byte *) __bytes, __size );
+        __bytes += __start - 1;
+        __crc = crc32(__crc, (Byte *) __bytes, __size );
 
-	RETURN( __MKUINT(__crc) );
+        RETURN( __MKUINT(__crc) );
     }
 err:;
 %}.
@@ -824,7 +824,11 @@
 !ZipStream class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic2/ZipStream.st,v 1.36 2009-08-03 13:38:33 ca Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic2/ZipStream.st,v 1.37 2009-11-05 16:25:23 stefan Exp $'
+!
+
+version_CVS
+    ^ '$Header: /cvs/stx/stx/libbasic2/ZipStream.st,v 1.37 2009-11-05 16:25:23 stefan Exp $'
 ! !
 
 ZipStream initialize!