Changeset 5 in libcf
- Timestamp:
- 01/30/13 13:12:40 (11 years ago)
- Location:
- trunk
- Files:
-
- 4 added
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/cf_file.h
r4 r5 7 7 #include "cf_base.h" 8 8 #include <fcntl.h> 9 10 #ifdef _WIN3211 # define O_RDONLY _O_RDONLY | _O_BINARY12 # define O_WRONLY _O_WRONLY | _O_BINARY13 # define O_RDWR _O_RDWR | _O_BINARY14 # define O_APPEND _O_APPEND | _O_BINARY15 # define O_CREAT _O_CREAT | _O_BINARY16 # define O_TRUNC _O_TRUNC17 #endif // #ifdef _WIN3218 9 19 10 #define CF_ERROR_FILE CF_ERROR_BASE * 2 -
trunk/include/cf_thread.h
r4 r5 9 9 #ifdef _WIN32 10 10 //# include <stddef.h> 11 # define CF_THREAD_RETURN u intptr_t11 # define CF_THREAD_RETURN unsigned int 12 12 # define CF_THREAD_CALL __stdcall 13 13 #else // #ifdef _WIN32 … … 16 16 #endif // #ifdef _WIN32 17 17 18 #define CF_THREAD_FUNCTION CF_THREAD_RETURN CF_THREAD_CALL 18 typedef CF_THREAD_RETURN (CF_THREAD_CALL * CF_Thread_Function) (void *); 19 19 20 20 #define CF_ERROR_THREAD CF_ERROR_BASE * 4 … … 35 35 CF_EXPORT int 36 36 CF_Thread_Create (CF_Thread * threadID, 37 CF_T HREAD_RETURNcallback,37 CF_Thread_Function callback, 38 38 void * arg); 39 39 -
trunk/src/cf_file.c
r4 r5 6 6 #ifdef _WIN32 7 7 # include <io.h> 8 # include <stdio.h> 8 9 #else // #ifdef _WIN32 9 10 # include <unistd.h> -
trunk/src/cf_socket.c
r4 r5 7 7 #ifdef _WIN32 8 8 # include <WinSock2.h> 9 # pragma comment (lib, "ws2_32.lib") 10 # define close(__sock) closesocket(__sock) 11 # define sa_family_t unsigned short 9 12 #else 10 13 # include <netinet/in.h> … … 74 77 CHECK_INVALID_SOCKET (sock); 75 78 76 result = /* continued */ 77 #ifdef _WIN32 78 closesocket (socket); 79 #else 80 close (sock); 81 #endif 79 result = close (sock); 82 80 83 81 if (result != 0) … … 143 141 int result = 0; 144 142 145 CHECK_INVALID_SOCKET (sock); 146 147 if (timeout < 0) 148 return CF_ERROR_SOCKET_INVALID_ARGS; 149 150 #ifndef _WIN32 143 #ifdef _WIN32 144 int time_ms = timeout * 1000; 145 #else 151 146 struct timeval timeval; 152 147 timeval.tv_sec = timeout; 153 148 timeval.tv_usec= 0; 154 #else 155 int time_ms = timeout * 1000; 156 #endif 149 #endif 150 151 CHECK_INVALID_SOCKET (sock); 152 153 if (timeout < 0) 154 return CF_ERROR_SOCKET_INVALID_ARGS; 157 155 158 156 result = CF_Socket_SetOption (sock, -
trunk/src/cf_thread.c
r4 r5 39 39 40 40 int 41 CF_Thread_Create (CF_Thread * threadID,42 CF_T HREAD_RETURNcallback,43 void * arg)41 CF_Thread_Create (CF_Thread * threadID, 42 CF_Thread_Function callback, 43 void * arg) 44 44 { 45 45 int result = 0; … … 86 86 87 87 #ifdef _WIN32 88 WaitForSingleObject ((THREAD_TYPE) *threa ID, INFINITE);88 WaitForSingleObject ((THREAD_TYPE) *threadID, INFINITE); 89 89 #else 90 90 int status;
Note:
See TracChangeset
for help on using the changeset viewer.