Ethereal-dev: [Ethereal-dev] [Patch] Win32 test programs

Note: This archive is from the project's previous web site, ethereal.com. This list is no longer active.

From: "Gisle Vanem" <giva@xxxxxxxxx>
Date: Fri, 31 Oct 2003 01:08:32 +0100
The test programs bf_opts.exe and bfspeed.exe fails to
compile on MSVC/MingW befause of missing
"struct tms" :

--- crypto\bf\bf_opts.c.orig  Wed Mar 07 12:00:27 2001
+++ crypto\bf\bf_opts.c       Thu Oct 30 16:52:58 2003
@@ -63,10 +63,6 @@
 #define TIMES
 #endif

+#if defined(WIN32) || defined(_WIN32)
+#undef TIMES
+#endif
+
 #include <stdio.h>

 #include <openssl/e_os2.h>

--- crypto\bf\bfspeed.c.orig  Wed Mar 07 12:00:28 2001
+++ crypto\bf\bfspeed.c       Thu Oct 30 16:56:20 2003
@@ -61,10 +61,6 @@

 #if !defined(OPENSSL_SYS_MSDOS) && (!defined(OPENSSL_SYS_VMS) || defined(__DECC)) && !defined(OPENSSL_SYS_MACOSX)
 #define TIMES
+#endif
+
+#if defined(WIN32) || defined(_WIN32)
+#undef TIMES
 #endif

 #include <stdio.h>

----------------------

I don't know why OPENSSL_EXPORT_VAR_AS_FUNCTION is
undef'ed n opensslconf.h.in. It's needed for MSVC (but not 
strictly required for MingW) :

+++ crypto\opensslconf.h.in.orig  Fri Dec 13 16:21:13 2002
--- crypto\opensslconf.h.in       Thu Oct 30 16:05:23 2003
@@ -12,7 +12,7 @@
 #undef OPENSSL_UNISTD
 #define OPENSSL_UNISTD <unistd.h>

+/* #undef OPENSSL_EXPORT_VAR_AS_FUNCTION */
-#undef OPENSSL_EXPORT_VAR_AS_FUNCTION

 #if defined(HEADER_IDEA_H) && !defined(IDEA_INT)
 #define IDEA_INT unsigned int

----------------------

And my recent patch for djgpp/Watt-32 in bss_file.c
fouled up compilation for Win32:

--- crypto\bio\bss_file.c.orig  Sun Sep 28 09:00:16 2003
+++ crypto\bio\bss_file.c       Fri Oct 24 21:55:47 2003
@@ -194,7 +194,6 @@
  FILE *fp=(FILE *)b->ptr;
  FILE **fpp;
  char p[4];
+ int fd;

  switch (cmd)
   {
@@ -214,13 +213,14 @@
   b->shutdown=(int)num&BIO_CLOSE;
   b->ptr=(char *)ptr;
   b->init=1;
+  fd = fileno((FILE*)ptr);
 #if defined(OPENSSL_SYS_WINDOWS)
   if (num & BIO_FP_TEXT)
    _setmode(fd,_O_TEXT);
   else
    _setmode(fd,_O_BINARY);
 #elif defined(OPENSSL_SYS_MSDOS)
-  {
-  int fd = fileno((FILE*)ptr);
   /* Set correct text/binary mode */
   if (num & BIO_FP_TEXT)
    _setmode(fd,_O_TEXT);
@@ -235,6 +235,7 @@
    else
     _setmode(fd,_O_BINARY);
    }
-  }
 #elif defined(OPENSSL_SYS_OS2)
   if (num & BIO_FP_TEXT)
    setmode(fileno((FILE *)ptr), O_TEXT);

----------------------

--gv