MD5Stream.st
changeset 23955 65bb2eee0144
parent 23938 16758cdac0c1
equal deleted inserted replaced
23954:e28c9c96d726 23955:65bb2eee0144
   334 %{
   334 %{
   335     INT len, offs;
   335     INT len, offs;
   336     INT objSize;
   336     INT objSize;
   337     int nInstBytes;
   337     int nInstBytes;
   338     char *extPtr;
   338     char *extPtr;
   339 
   339     OBJ _hashContext = __INST(hashContext);
   340     if (__isByteArray(__INST(hashContext))
   340 
   341        &&__byteArraySize(__INST(hashContext)) == sizeof(MD5_CTX)
   341     // convert first, check later
       
   342     len = __intVal(count);
       
   343     offs = __intVal(start) - 1;
       
   344 
       
   345     if (__isByteArray(_hashContext)
       
   346        && __byteArraySize(_hashContext) == sizeof(MD5_CTX)
   342        && __bothSmallInteger(count, start)
   347        && __bothSmallInteger(count, start)
   343     ) {
   348     ) {
   344         MD5_CTX *ctx = (MD5_CTX *)__ByteArrayInstPtr(__INST(hashContext))->ba_element;
   349         MD5_CTX *ctx = (MD5_CTX *)__byteArrayVal(_hashContext);
   345 
   350 
   346         len = __intVal(count);
   351         if (__isByteArrayLike(anObject)) {
   347         offs = __intVal(start) - 1;
   352             extPtr = (char *)__byteArrayVal(anObject);
   348 
   353             objSize = __byteArraySize(anObject);
   349         if (__isExternalBytesLike(anObject)) {
   354         } else if (__isStringLike(anObject)) { 
       
   355             extPtr = (char *)__stringVal(anObject);
       
   356             objSize = __stringSize(anObject);
       
   357         } else if (__isExternalBytesLike(anObject)) {
   350             OBJ sz;
   358             OBJ sz;
   351 
   359 
   352             nInstBytes = 0;
   360             nInstBytes = 0;
   353             extPtr = (char *)__externalBytesAddress(anObject);
   361             extPtr = (char *)__externalBytesAddress(anObject);
   354             if (extPtr == (char *)0) goto bad;
   362             if (extPtr == (char *)0) goto bad;
   397     }
   405     }
   398 bad: ;
   406 bad: ;
   399 %}.
   407 %}.
   400 
   408 
   401     ^ self primitiveFailed
   409     ^ self primitiveFailed
       
   410 
       
   411     "Modified: / 23-03-2019 / 15:16:34 / Claus Gittinger"
   402 ! !
   412 ! !
   403 
   413 
   404 !MD5Stream class methodsFor:'documentation'!
   414 !MD5Stream class methodsFor:'documentation'!
   405 
   415 
   406 version
   416 version