--- a/MD5Stream.st Fri Mar 22 14:44:14 2019 +0100
+++ b/MD5Stream.st Sat Mar 23 15:18:05 2019 +0100
@@ -336,17 +336,25 @@
INT objSize;
int nInstBytes;
char *extPtr;
+ OBJ _hashContext = __INST(hashContext);
- if (__isByteArray(__INST(hashContext))
- &&__byteArraySize(__INST(hashContext)) == sizeof(MD5_CTX)
+ // convert first, check later
+ len = __intVal(count);
+ offs = __intVal(start) - 1;
+
+ if (__isByteArray(_hashContext)
+ && __byteArraySize(_hashContext) == sizeof(MD5_CTX)
&& __bothSmallInteger(count, start)
) {
- MD5_CTX *ctx = (MD5_CTX *)__ByteArrayInstPtr(__INST(hashContext))->ba_element;
+ MD5_CTX *ctx = (MD5_CTX *)__byteArrayVal(_hashContext);
- len = __intVal(count);
- offs = __intVal(start) - 1;
-
- if (__isExternalBytesLike(anObject)) {
+ if (__isByteArrayLike(anObject)) {
+ extPtr = (char *)__byteArrayVal(anObject);
+ objSize = __byteArraySize(anObject);
+ } else if (__isStringLike(anObject)) {
+ extPtr = (char *)__stringVal(anObject);
+ objSize = __stringSize(anObject);
+ } else if (__isExternalBytesLike(anObject)) {
OBJ sz;
nInstBytes = 0;
@@ -399,6 +407,8 @@
%}.
^ self primitiveFailed
+
+ "Modified: / 23-03-2019 / 15:16:34 / Claus Gittinger"
! !
!MD5Stream class methodsFor:'documentation'!