diff options
author | Richard Levitte <levitte@openssl.org> | 2002-11-15 22:37:18 +0000 |
---|---|---|
committer | Richard Levitte <levitte@openssl.org> | 2002-11-15 22:37:18 +0000 |
commit | 0bf23d9b2055223c6e7a1398d2243a65dfa4c30d (patch) | |
tree | cd3b00d88ebc55c0ea232b6f43200097f20a16de /apps | |
parent | 813f256783a678b131a81ed1c8d05b70395a6255 (diff) |
WinCE patches
Diffstat (limited to 'apps')
-rw-r--r-- | apps/apps.c | 25 | ||||
-rw-r--r-- | apps/s_client.c | 16 | ||||
-rw-r--r-- | apps/s_server.c | 8 | ||||
-rw-r--r-- | apps/s_socket.c | 2 | ||||
-rw-r--r-- | apps/s_time.c | 12 |
5 files changed, 57 insertions, 6 deletions
diff --git a/apps/apps.c b/apps/apps.c index 305227d7ab..271dfa1439 100644 --- a/apps/apps.c +++ b/apps/apps.c @@ -345,6 +345,7 @@ void program_name(char *in, char *out, int size) #ifdef OPENSSL_SYS_WIN32 int WIN32_rename(char *from, char *to) { +#ifndef OPENSSL_SYS_WINCE /* Windows rename gives an error if 'to' exists, so delete it * first and ignore file not found errror */ @@ -352,6 +353,30 @@ int WIN32_rename(char *from, char *to) return -1; #undef rename return rename(from, to); +#else + /* convert strings to UNICODE */ + { + BOOL result = FALSE; + WCHAR* wfrom; + WCHAR* wto; + int i; + wfrom = malloc((strlen(from)+1)*2); + wto = malloc((strlen(to)+1)*2); + if (wfrom != NULL && wto != NULL) + { + for (i=0; i<(int)strlen(from)+1; i++) + wfrom[i] = (short)from[i]; + for (i=0; i<(int)strlen(to)+1; i++) + wto[i] = (short)to[i]; + result = MoveFile(wfrom, wto); + } + if (wfrom != NULL) + free(wfrom); + if (wto != NULL) + free(wto); + return result; + } +#endif } #endif diff --git a/apps/s_client.c b/apps/s_client.c index 1b670aa4ee..3b018ff0e0 100644 --- a/apps/s_client.c +++ b/apps/s_client.c @@ -140,6 +140,14 @@ typedef unsigned int u_int; #include <conio.h> #endif +#ifdef OPENSSL_SYS_WINCE +/* Windows CE incorrectly defines fileno as returning void*, so to avoid problems below... */ +#ifdef fileno +#undef fileno +#endif +#define fileno(a) (int)_fileno(a) +#endif + #if (defined(OPENSSL_SYS_VMS) && __VMS_VER < 70000000) /* FIONBIO used as a switch to enable ioctl, and that isn't in VMS < 7.0 */ @@ -662,7 +670,11 @@ re_start: tv.tv_usec = 0; i=select(width,(void *)&readfds,(void *)&writefds, NULL,&tv); +#ifdef OPENSSL_SYS_WINCE + if(!i && (!_kbhit() || !read_tty) ) continue; +#else if(!i && (!((_kbhit()) || (WAIT_OBJECT_0 == WaitForSingleObject(GetStdHandle(STD_INPUT_HANDLE), 0))) || !read_tty) ) continue; +#endif } else i=select(width,(void *)&readfds,(void *)&writefds, NULL,NULL); } @@ -828,7 +840,11 @@ printf("read=%d pending=%d peek=%d\n",k,SSL_pending(con),SSL_peek(con,zbuf,10240 } #ifdef OPENSSL_SYS_WINDOWS +#ifdef OPENSSL_SYS_WINCE + else if (_kbhit()) +#else else if ((_kbhit()) || (WAIT_OBJECT_0 == WaitForSingleObject(GetStdHandle(STD_INPUT_HANDLE), 0))) +#endif #else else if (FD_ISSET(fileno(stdin),&readfds)) #endif diff --git a/apps/s_server.c b/apps/s_server.c index 64ef2455bc..4d87567a62 100644 --- a/apps/s_server.c +++ b/apps/s_server.c @@ -149,6 +149,14 @@ typedef unsigned int u_int; #include <conio.h> #endif +#ifdef OPENSSL_SYS_WINCE +/* Windows CE incorrectly defines fileno as returning void*, so to avoid problems below... */ +#ifdef fileno +#undef fileno +#endif +#define fileno(a) (int)_fileno(a) +#endif + #if (defined(OPENSSL_SYS_VMS) && __VMS_VER < 70000000) /* FIONBIO used as a switch to enable ioctl, and that isn't in VMS < 7.0 */ #undef FIONBIO diff --git a/apps/s_socket.c b/apps/s_socket.c index ed15ce0c1d..a88de6c8c8 100644 --- a/apps/s_socket.c +++ b/apps/s_socket.c @@ -140,7 +140,9 @@ static void ssl_sock_cleanup(void) if (wsa_init_done) { wsa_init_done=0; +#ifndef OPENSSL_SYS_WINCE WSACancelBlockingCall(); +#endif WSACleanup(); } } diff --git a/apps/s_time.c b/apps/s_time.c index da7383ca21..181a7c82f6 100644 --- a/apps/s_time.c +++ b/apps/s_time.c @@ -487,7 +487,7 @@ int MAIN(int argc, char **argv) tm_Time_F(START); for (;;) { - if (finishtime < time(NULL)) break; + if (finishtime < (long)time(NULL)) break; #ifdef WIN32_STUFF if( flushWinMsgs(0) == -1 ) @@ -538,9 +538,9 @@ int MAIN(int argc, char **argv) } totalTime += tm_Time_F(STOP); /* Add the time for this iteration */ - i=(int)(time(NULL)-finishtime+maxTime); + i=(int)((long)time(NULL)-finishtime+maxTime); printf( "\n\n%d connections in %.2fs; %.2f connections/user sec, bytes read %ld\n", nConn, totalTime, ((double)nConn/totalTime),bytes_read); - printf( "%d connections in %ld real seconds, %ld bytes read per connection\n",nConn,time(NULL)-finishtime+maxTime,bytes_read/nConn); + printf( "%d connections in %ld real seconds, %ld bytes read per connection\n",nConn,(long)time(NULL)-finishtime+maxTime,bytes_read/nConn); /* Now loop and time connections using the same session id over and over */ @@ -572,7 +572,7 @@ next: nConn = 0; totalTime = 0.0; - finishtime=time(NULL)+maxTime; + finishtime=(long)time(NULL)+maxTime; printf( "starting\n" ); bytes_read=0; @@ -580,7 +580,7 @@ next: for (;;) { - if (finishtime < time(NULL)) break; + if (finishtime < (long)time(NULL)) break; #ifdef WIN32_STUFF if( flushWinMsgs(0) == -1 ) @@ -630,7 +630,7 @@ next: printf( "\n\n%d connections in %.2fs; %.2f connections/user sec, bytes read %ld\n", nConn, totalTime, ((double)nConn/totalTime),bytes_read); - printf( "%d connections in %ld real seconds, %ld bytes read per connection\n",nConn,time(NULL)-finishtime+maxTime,bytes_read/nConn); + printf( "%d connections in %ld real seconds, %ld bytes read per connection\n",nConn,(long)time(NULL)-finishtime+maxTime,bytes_read/nConn); ret=0; end: |