int32 vs. long fix
authorClaus Gittinger <cg@exept.de>
Thu, 21 Feb 2013 11:44:11 +0100
changeset 14791 4bd37b3efdb2
parent 14790 28d875953487
child 14792 3a8ef902a219
int32 vs. long fix
SHA1Stream.st
--- a/SHA1Stream.st	Wed Feb 20 17:41:32 2013 +0100
+++ b/SHA1Stream.st	Thu Feb 21 11:44:11 2013 +0100
@@ -100,7 +100,7 @@
     unsigned long a, b, c, d, e;
     typedef union {
 	unsigned char c[64];
-	unsigned long l[16];
+	unsigned int32 /* long */ l[16];
     } CHAR64LONG16;
     CHAR64LONG16* block;
 #ifdef SHA1HANDSOFF
@@ -487,15 +487,18 @@
     digest := ByteArray new:HashSize.
 
 %{
-    if (__isByteArray(__INST(hashContext)) &&
-	__byteArraySize(__INST(hashContext)) == sizeof(SHA1_CTX) &&
+    OBJ hcon;
+
+    hcon = __INST(hashContext);
+    if (__isByteArray(hcon) &&
+	__byteArraySize(hcon) == sizeof(SHA1_CTX) &&
 	__isByteArray(digest) &&
 	__byteArraySize(digest) == 20
     ) {
-	SHA1_CTX *ctx = (SHA1_CTX *)__ByteArrayInstPtr(__INST(hashContext))->ba_element;
+	SHA1_CTX *ctx = (SHA1_CTX *)(__ByteArrayInstPtr(hcon)->ba_element);
 	SHA1_CTX copyContext;
 
-	memcpy(&copyContext, ctx, sizeof(copyContext));
+	memcpy(&copyContext, ctx, sizeof(SHA1_CTX));
 	SHA1Final(__ByteArrayInstPtr(digest)->ba_element, &copyContext);
 	RETURN(digest);
     }
@@ -579,11 +582,11 @@
 !SHA1Stream class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic/SHA1Stream.st,v 1.35 2013-02-20 15:40:35 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/SHA1Stream.st,v 1.36 2013-02-21 10:44:11 cg Exp $'
 !
 
 version_CVS
-    ^ '$Header: /cvs/stx/stx/libbasic/SHA1Stream.st,v 1.35 2013-02-20 15:40:35 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/SHA1Stream.st,v 1.36 2013-02-21 10:44:11 cg Exp $'
 ! !