[Vm-dev] [commit][3238] Compile for 32 or 64 bit host or image, 4 or 8 byte sqInt, squeakvm or squeakvm64.

Eliot Miranda eliot.miranda at gmail.com
Fri Jan 30 01:31:02 UTC 2015


Hi David,

    you might look at latforms/unix/plugins/SqueakSSL/sqUnixOpenSSL.c in
the Cog branch.  It uses e.g.

if(ssl->loglevel) printf("sqAcceptSSL: cert = %p\n", cert);

instead of

if(ssl->loglevel) printf("sqAcceptSSL: cert = %lx\n", (long)cert);

which is preferrable, as cert is a pointer.  The Cog version definitely
compiles on 64-bit; I'm running a 64-bit Spur Stack VM regularly.

On Thu, Jan 29, 2015 at 4:37 PM, <commits at squeakvm.org> wrote:

>
> Revision: 3238
> Author:   lewis
> Date:     2015-01-29 16:37:29 -0800 (Thu, 29 Jan 2015)
> Log Message:
> -----------
> Compile for 32 or 64 bit host or image, 4 or 8 byte sqInt, squeakvm or
> squeakvm64.
> Change signature of sqGetIntPropertySSL to match declaration in
> Cross/plugins/SqueakSSL/SqueakSSL.h
> For debug printing, cast sqInt to long and print with %ld to prevent
> warnings when sizeof(sqInt) is 8.
> Reference Mantis 7751 (http://bugs.squeak.org/view.php?id=7751)
>
> Modified Paths:
> --------------
>     trunk/platforms/unix/plugins/SqueakSSL/sqUnixOpenSSL.c
>
> Modified: trunk/platforms/unix/plugins/SqueakSSL/sqUnixOpenSSL.c
> ===================================================================
> --- trunk/platforms/unix/plugins/SqueakSSL/sqUnixOpenSSL.c      2015-01-29
> 22:46:44 UTC (rev 3237)
> +++ trunk/platforms/unix/plugins/SqueakSSL/sqUnixOpenSSL.c      2015-01-30
> 00:37:29 UTC (rev 3238)
> @@ -36,8 +36,8 @@
>  sqInt sqCopyBioSSL(sqSSL *ssl, BIO *bio, char *dstBuf, sqInt dstLen) {
>    int nbytes = BIO_ctrl_pending(bio);
>
> -  if(ssl->loglevel) printf("sqCopyBioSSL: %d bytes pending; buffer size
> %d\n",
> -        nbytes, dstLen);
> +  if(ssl->loglevel) printf("sqCopyBioSSL: %d bytes pending; buffer size
> %ld\n",
> +        nbytes, (long)dstLen);
>    if(nbytes > dstLen) return -1;
>    return BIO_read(bio, dstBuf, dstLen);
>  }
> @@ -156,7 +156,7 @@
>         X509 *cert;
>         sqSSL *ssl = sslFromHandle(handle);
>
> -       if(ssl->loglevel) printf("sqConnectSSL: %x\n", (int)ssl);
> +       if(ssl->loglevel) printf("sqConnectSSL: %lx\n", (long)ssl);
>
>         /* Verify state of session */
>         if(ssl == NULL || (ssl->state != SQSSL_UNUSED && ssl->state !=
> SQSSL_CONNECTING)) {
> @@ -172,7 +172,7 @@
>                 SSL_set_connect_state(ssl->ssl);
>         }
>
> -       if(ssl->loglevel) printf("sqConnectSSL: BIO_write %d bytes\n",
> srcLen);
> +       if(ssl->loglevel) printf("sqConnectSSL: BIO_write %ld bytes\n",
> (long)srcLen);
>
>         n = BIO_write(ssl->bioRead, srcBuf, srcLen);
>
> @@ -202,7 +202,7 @@
>
>         if(ssl->loglevel) printf("sqConnectSSL:
> SSL_get_peer_certificate\n");
>         cert = SSL_get_peer_certificate(ssl->ssl);
> -       if(ssl->loglevel) printf("sqConnectSSL: cert = %x\n", (int)cert);
> +       if(ssl->loglevel) printf("sqConnectSSL: cert = %lx\n", (long)cert);
>         /* Fail if no cert received. */
>         if(cert) {
>                 X509_NAME_get_text_by_NID(X509_get_subject_name(cert),
> @@ -252,7 +252,7 @@
>                 SSL_set_accept_state(ssl->ssl);
>         }
>
> -       if(ssl->loglevel) printf("sqAcceptSSL: BIO_write %d bytes\n",
> srcLen);
> +       if(ssl->loglevel) printf("sqAcceptSSL: BIO_write %ld bytes\n",
> (long)srcLen);
>
>         n = BIO_write(ssl->bioRead, srcBuf, srcLen);
>
> @@ -286,7 +286,7 @@
>
>         if(ssl->loglevel) printf("sqAcceptSSL:
> SSL_get_peer_certificate\n");
>         cert = SSL_get_peer_certificate(ssl->ssl);
> -       if(ssl->loglevel) printf("sqAcceptSSL: cert = %x\n", (int)cert);
> +       if(ssl->loglevel) printf("sqAcceptSSL: cert = %lx\n", (long)cert);
>
>         if(cert) {
>           X509_NAME_get_text_by_NID(X509_get_subject_name(cert),
> @@ -322,7 +322,7 @@
>
>         if(ssl == NULL || ssl->state != SQSSL_CONNECTED) return
> SQSSL_INVALID_STATE;
>
> -       if(ssl->loglevel) printf("sqEncryptSSL: Encrypting %d bytes\n",
> srcLen);
> +       if(ssl->loglevel) printf("sqEncryptSSL: Encrypting %ld bytes\n",
> (long)srcLen);
>
>         nbytes = SSL_write(ssl->ssl, srcBuf, srcLen);
>         if(nbytes != srcLen) return SQSSL_GENERIC_ERROR;
> @@ -414,7 +414,7 @@
>                 propID - the property id to retrieve
>         Returns: The integer value of the property.
>  */
> -int sqGetIntPropertySSL(sqInt handle, int propID) {
> +sqInt sqGetIntPropertySSL(sqInt handle, sqInt propID) {
>         sqSSL *ssl = sslFromHandle(handle);
>
>         if(ssl == NULL) return 0;
> @@ -424,7 +424,7 @@
>                 case SQSSL_PROP_VERSION: return 1;
>                 case SQSSL_PROP_LOGLEVEL: return ssl->loglevel;
>                 default:
> -                       if(ssl->loglevel) printf("sqGetIntPropertySSL:
> Unknown property ID %d\n", propID);
> +                       if(ssl->loglevel) printf("sqGetIntPropertySSL:
> Unknown property ID %ld\n", (long)propID);
>                         return 0;
>         }
>         return 0;
> @@ -444,7 +444,7 @@
>         switch(propID) {
>                 case SQSSL_PROP_LOGLEVEL: ssl->loglevel = propValue; break;
>                 default:
> -                       if(ssl->loglevel) printf("sqSetIntPropertySSL:
> Unknown property ID %d\n", propID);
> +                       if(ssl->loglevel) printf("sqSetIntPropertySSL:
> Unknown property ID %ld\n", (long)propID);
>                         return 0;
>         }
>         return 1;
>
>


-- 
best,
Eliot
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/vm-dev/attachments/20150129/ab25efbc/attachment.htm


More information about the Vm-dev mailing list