Changeset 125
- Timestamp:
- Jan 19, 2006 3:58:29 AM (19 years ago)
- Location:
- pjproject/trunk/pjlib
- Files:
-
- 11 added
- 25 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjlib/build/pjlib.dsp
r75 r125 165 165 # End Source File 166 166 # End Group 167 # Begin Group "src_compat" 168 169 # PROP Default_Filter "" 170 # Begin Source File 171 172 SOURCE=..\src\pj\compat\unicode_win32.c 173 # PROP Exclude_From_Build 1 174 # End Source File 175 # End Group 167 176 # Begin Source File 168 177 … … 426 435 427 436 SOURCE=..\include\pj\compat\time.h 437 # End Source File 438 # Begin Source File 439 440 SOURCE=..\include\pj\compat\unicode.h 428 441 # End Source File 429 442 # Begin Source File -
pjproject/trunk/pjlib/build/pjlib.vcproj
r124 r125 5 5 Name="pjlib" 6 6 SccProjectName=""$/pjproject/pjlib/build", UIAAAAAA" 7 SccLocalPath="."> 7 SccAuxPath="" 8 SccLocalPath="." 9 SccProvider="MSSCCI:Microsoft Visual SourceSafe"> 8 10 <Platforms> 9 11 <Platform … … 1309 1311 </File> 1310 1312 </Filter> 1313 <Filter 1314 Name="Src Compat" 1315 Filter=""> 1316 <File 1317 RelativePath="..\src\pj\compat\unicode_win32.c"> 1318 <FileConfiguration 1319 Name="Debug|Win32" 1320 ExcludedFromBuild="TRUE"> 1321 <Tool 1322 Name="VCCLCompilerTool"/> 1323 </FileConfiguration> 1324 <FileConfiguration 1325 Name="Release|Win32" 1326 ExcludedFromBuild="TRUE"> 1327 <Tool 1328 Name="VCCLCompilerTool"/> 1329 </FileConfiguration> 1330 </File> 1331 </Filter> 1311 1332 </Filter> 1312 1333 <Filter … … 1477 1498 <File 1478 1499 RelativePath="..\include\pj\compat\time.h"> 1500 </File> 1501 <File 1502 RelativePath="..\include\pj\compat\unicode.h"> 1479 1503 </File> 1480 1504 <File -
pjproject/trunk/pjlib/include/pj/compat/errno.h
r65 r125 20 20 #define __PJ_COMPAT_ERRNO_H__ 21 21 22 #if defined(PJ_WIN32) && PJ_WIN32 != 0 22 #if defined(PJ_WIN32) && PJ_WIN32 != 0 || \ 23 defined(PJ_WIN32_WINCE) && PJ_WIN32_WINCE != 0 23 24 24 25 typedef unsigned long pj_os_err_type; -
pjproject/trunk/pjlib/include/pj/compat/os_linux.h
r75 r125 78 78 #define PJ_HAS_MALLOC 1 79 79 #define PJ_OS_HAS_CHECK_STACK 0 80 #define PJ_NATIVE_STRING_IS_UNICODE 0 80 81 81 82 #define PJ_ATOMIC_VALUE_TYPE long -
pjproject/trunk/pjlib/include/pj/compat/os_linux_kernel.h
r75 r125 97 97 #define PJ_OS_HAS_CHECK_STACK 0 98 98 #define PJ_TERM_HAS_COLOR 0 99 #define PJ_NATIVE_STRING_IS_UNICODE 0 99 100 100 101 #define PJ_ATOMIC_VALUE_TYPE int -
pjproject/trunk/pjlib/include/pj/compat/os_palmos.h
r75 r125 76 76 #define PJ_HAS_HIGH_RES_TIMER 1 77 77 #define PJ_OS_HAS_CHECK_STACK 0 78 #define PJ_NATIVE_STRING_IS_UNICODE 0 78 79 79 80 #endif /* __PJ_COMPAT_OS_PALMOS_H__ */ -
pjproject/trunk/pjlib/include/pj/compat/os_sunos.h
r75 r125 78 78 #define PJ_HAS_MALLOC 1 79 79 #define PJ_OS_HAS_CHECK_STACK 0 80 #define PJ_NATIVE_STRING_IS_UNICODE 0 80 81 81 82 #define PJ_ATOMIC_VALUE_TYPE long -
pjproject/trunk/pjlib/include/pj/compat/os_win32.h
r75 r125 82 82 #define PJ_HAS_MALLOC 1 83 83 #define PJ_OS_HAS_CHECK_STACK 1 84 #define PJ_NATIVE_STRING_IS_UNICODE 0 84 85 85 86 #define PJ_ATOMIC_VALUE_TYPE long -
pjproject/trunk/pjlib/include/pj/compat/socket.h
r107 r125 96 96 * Linux kernel specifics 97 97 */ 98 #if def PJ_LINUX_KERNEL98 #if defined(PJ_LINUX_KERNEL) 99 99 # include <linux/net.h> 100 100 # include <asm/ioctls.h> /* FIONBIO */ … … 124 124 * Windows specific 125 125 */ 126 #if def PJ_WIN32127 typedef int socklen_t; ;126 #if defined(PJ_WIN32) || defined(PJ_WIN32_WINCE) 127 typedef int socklen_t; 128 128 #endif 129 129 -
pjproject/trunk/pjlib/include/pj/compat/string.h
r65 r125 36 36 #if defined(_MSC_VER) 37 37 # define strcasecmp stricmp 38 # define strncasecmp strnicmp 38 # if defined(PJ_WIN32_WINCE) && PJ_WIN32_WINCE!=0 39 # define strncasecmp _strnicmp 40 # else 41 # define strncasecmp strnicmp 42 # endif 39 43 # define snprintf _snprintf 40 44 #else -
pjproject/trunk/pjlib/include/pj/config.h
r70 r125 42 42 #if defined(PJ_WIN32) && PJ_WIN32!=0 43 43 # include <pj/compat/os_win32.h> 44 #elif defined(PJ_WIN32_WINCE) && PJ_WIN32_WINCE!=0 45 # include <pj/compat/os_win32_wince.h> 44 46 #elif defined(PJ_LINUX) && PJ_LINUX!=0 45 47 # include <pj/compat/os_linux.h> … … 66 68 #elif defined (PJ_M_SPARC) && PJ_M_SPARC != 0 67 69 # include <pj/compat/m_sparc.h> 70 #elif defined (PJ_M_ARMV4) && PJ_M_ARMV4 != 0 71 # include <pj/compat/m_arm.h> 68 72 #else 69 73 # error "Please specify target machine." -
pjproject/trunk/pjlib/include/pj/log.h
r66 r125 78 78 PJ_LOG_HAS_SENDER = 64, /**< Include sender in the log [yes]. */ 79 79 PJ_LOG_HAS_NEWLINE = 128, /**< Terminate each call with newline [yes].*/ 80 PJ_LOG_HAS_CR = 256, /**< Include carriage return [no]. */ 80 81 }; 81 82 -
pjproject/trunk/pjlib/include/pj/types.h
r106 r125 387 387 int wday; 388 388 389 /* *This represents day of the year, 0-365, where zero means389 /* This represents day of the year, 0-365, where zero means 390 390 * 1st of January. 391 391 */ 392 int yday;392 /*int yday; */ 393 393 394 394 /** This represents day of month: 1-31 */ -
pjproject/trunk/pjlib/src/pj/file_access_win32.c
r66 r125 18 18 */ 19 19 #include <pj/file_access.h> 20 #include <pj/compat/unicode.h> 20 21 #include <pj/assert.h> 21 22 #include <pj/errno.h> 23 #include <pj/string.h> 24 #include <pj/os.h> 22 25 #include <windows.h> 23 26 #include <time.h> … … 29 32 { 30 33 HANDLE hFile; 34 PJ_DECL_UNICODE_TEMP_BUF(wfilename,256); 31 35 32 36 PJ_ASSERT_RETURN(filename != NULL, 0); 33 37 34 hFile = CreateFile(filename, READ_CONTROL, FILE_SHARE_READ, NULL, 38 hFile = CreateFile(PJ_NATIVE_STRING(filename,wfilename), READ_CONTROL, 39 FILE_SHARE_READ, NULL, 35 40 OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); 36 41 if (hFile == INVALID_HANDLE_VALUE) … … 50 55 DWORD sizeLo, sizeHi; 51 56 pj_off_t size; 57 PJ_DECL_UNICODE_TEMP_BUF(wfilename,256); 52 58 53 59 PJ_ASSERT_RETURN(filename != NULL, -1); 54 60 55 hFile = CreateFile( filename, READ_CONTROL,61 hFile = CreateFile(PJ_NATIVE_STRING(filename, wfilename), READ_CONTROL, 56 62 FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, 57 63 OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); … … 81 87 PJ_DEF(pj_status_t) pj_file_delete(const char *filename) 82 88 { 89 PJ_DECL_UNICODE_TEMP_BUF(wfilename,256); 90 83 91 PJ_ASSERT_RETURN(filename != NULL, PJ_EINVAL); 84 92 85 if (DeleteFile( filename) == FALSE)93 if (DeleteFile(PJ_NATIVE_STRING(filename,wfilename)) == FALSE) 86 94 return PJ_RETURN_OS_ERROR(GetLastError()); 87 95 … … 96 104 { 97 105 BOOL rc; 106 PJ_DECL_UNICODE_TEMP_BUF(woldname,256); 107 PJ_DECL_UNICODE_TEMP_BUF(wnewname,256); 98 108 99 109 PJ_ASSERT_RETURN(oldname!=NULL && newname!=NULL, PJ_EINVAL); 100 110 101 111 #if PJ_WIN32_WINNT >= 0x0400 102 rc = MoveFileEx(oldname, newname, 112 rc = MoveFileEx(PJ_NATIVE_STRING(oldname,woldname), 113 PJ_NATIVE_STRING(newname,wnewname), 103 114 MOVEFILE_COPY_ALLOWED|MOVEFILE_REPLACE_EXISTING); 104 115 #else 105 rc = MoveFile(oldname, newname); 116 rc = MoveFile(PJ_NATIVE_STRING(oldname, woldname), 117 PJ_NATIVE_STRING(newname, wnewname)); 106 118 #endif 107 119 … … 116 128 pj_time_val *time_val) 117 129 { 118 SYSTEMTIME systemTime, localTime;119 struct tm tm;120 121 if (!FileTimeToSystemTime(file_time, &systemTime)) 122 return -1;123 124 if (!SystemTimeToTzSpecificLocalTime(NULL, &systemTime, &localTime)) 125 return -1;126 127 memset(&tm, 0, sizeof(struct tm)); 128 tm.tm_year = localTime.wYear - 1900;129 tm.tm_mon = localTime.wMonth - 1;130 tm.tm_mday = localTime.wDay; 131 tm.tm_hour = localTime.wHour;132 tm.tm_min = localTime.wMinute;133 tm.tm_sec = localTime.wSecond;134 tm.tm_isdst = 0;135 136 time_val->sec = mktime(&tm); 137 if (time_val->sec == (time_t)-1)138 return -1;139 140 time_val->msec = localTime.wMilliseconds;141 142 return PJ_SUCCESS;130 FILETIME local_file_time; 131 SYSTEMTIME localTime; 132 pj_parsed_time pt; 133 134 if (!FileTimeToLocalFileTime(file_time, &local_file_time)) 135 return PJ_RETURN_OS_ERROR(GetLastError()); 136 137 if (!FileTimeToSystemTime(file_time, &localTime)) 138 return PJ_RETURN_OS_ERROR(GetLastError()); 139 140 //if (!SystemTimeToTzSpecificLocalTime(NULL, &systemTime, &localTime)) 141 // return PJ_RETURN_OS_ERROR(GetLastError()); 142 143 pj_memset(&pt, 0, sizeof(pt)); 144 pt.year = localTime.wYear; 145 pt.mon = localTime.wMonth-1; 146 pt.day = localTime.wDay; 147 pt.wday = localTime.wDayOfWeek; 148 149 pt.hour = localTime.wHour; 150 pt.min = localTime.wMinute; 151 pt.sec = localTime.wSecond; 152 pt.msec = localTime.wMilliseconds; 153 154 return pj_time_encode(&pt, time_val); 143 155 } 144 156 … … 151 163 DWORD sizeLo, sizeHi; 152 164 FILETIME creationTime, accessTime, writeTime; 165 PJ_DECL_UNICODE_TEMP_BUF(wfilename,256); 153 166 154 167 PJ_ASSERT_RETURN(filename!=NULL && stat!=NULL, PJ_EINVAL); 155 168 156 hFile = CreateFile(filename, READ_CONTROL, FILE_SHARE_READ, NULL, 169 hFile = CreateFile(PJ_NATIVE_STRING(filename,wfilename), READ_CONTROL, 170 FILE_SHARE_READ, NULL, 157 171 OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); 158 172 if (hFile == INVALID_HANDLE_VALUE) -
pjproject/trunk/pjlib/src/pj/file_io_win32.c
r66 r125 18 18 */ 19 19 #include <pj/file_io.h> 20 #include <pj/compat/unicode.h> 20 21 #include <pj/errno.h> 21 22 #include <pj/assert.h> … … 44 45 pj_oshandle_t *fd) 45 46 { 47 PJ_DECL_UNICODE_TEMP_BUF(wpathname,256); 46 48 HANDLE hFile; 47 49 DWORD dwDesiredAccess = 0; … … 77 79 dwFlagsAndAttributes = FILE_ATTRIBUTE_NORMAL; 78 80 79 hFile = CreateFile(pathname, dwDesiredAccess, dwShareMode, NULL, 81 hFile = CreateFile(PJ_NATIVE_STRING(pathname,wpathname), 82 dwDesiredAccess, dwShareMode, NULL, 80 83 dwCreationDisposition, dwFlagsAndAttributes, NULL); 81 84 if (hFile == INVALID_HANDLE_VALUE) { -
pjproject/trunk/pjlib/src/pj/ioqueue_common_abs.c
r66 r125 216 216 * of suggestions from Douglas C. Schmidt and Ken Keys. 217 217 */ 218 int gp_rc; 219 struct sockaddr_in addr; 220 socklen_t addrlen = sizeof(addr); 221 222 gp_rc = getpeername(h->fd, (struct sockaddr*)&addr, &addrlen); 223 bytes_transfered = gp_rc; 218 { 219 int gp_rc; 220 struct sockaddr_in addr; 221 socklen_t addrlen = sizeof(addr); 222 223 gp_rc = getpeername(h->fd, (struct sockaddr*)&addr, &addrlen); 224 bytes_transfered = gp_rc; 225 } 224 226 #endif 225 227 … … 400 402 * that error is easier to catch. 401 403 */ 402 # if defined(PJ_WIN32) && PJ_WIN32 != 0 404 # if defined(PJ_WIN32) && PJ_WIN32 != 0 || \ 405 defined(PJ_WIN32_WINCE) && PJ_WIN32_WINCE != 0 403 406 rc = pj_sock_recv(h->fd, read_op->buf, &bytes_read, 0); 404 407 //rc = ReadFile((HANDLE)h->fd, read_op->buf, read_op->size, -
pjproject/trunk/pjlib/src/pj/ioqueue_select.c
r66 r125 222 222 /* Set socket to nonblocking. */ 223 223 value = 1; 224 #ifdef PJ_WIN32 224 #if defined(PJ_WIN32) && PJ_WIN32!=0 || \ 225 defined(PJ_WIN32_WINCE) && PJ_WIN32_WINCE!=0 225 226 if (ioctlsocket(sock, FIONBIO, (u_long*)&value)) { 226 227 #else -
pjproject/trunk/pjlib/src/pj/log.c
r66 r125 139 139 /* Print the whole message to the string log_buffer. */ 140 140 len = len + vsnprintf(pre, sizeof(log_buffer)-len, format, marker); 141 if (len > 0 && len < sizeof(log_buffer)-1) { 141 if (len > 0 && len < sizeof(log_buffer)-2) { 142 if (log_decor & PJ_LOG_HAS_CR) { 143 log_buffer[len++] = '\r'; 144 } 142 145 if (log_decor & PJ_LOG_HAS_NEWLINE) { 143 146 log_buffer[len++] = '\n'; … … 146 149 } else { 147 150 len = sizeof(log_buffer)-1; 151 if (log_decor & PJ_LOG_HAS_CR) { 152 log_buffer[sizeof(log_buffer)-3] = '\r'; 153 } 148 154 if (log_decor & PJ_LOG_HAS_NEWLINE) { 149 155 log_buffer[sizeof(log_buffer)-2] = '\n'; -
pjproject/trunk/pjlib/src/pj/os_core_win32.c
r107 r125 537 537 return InterlockedIncrement(&atomic_var->value); 538 538 #else 539 # error Fix Me 539 return InterlockedIncrement(&atomic_var->value); 540 540 #endif 541 541 } … … 559 559 return InterlockedDecrement(&atomic_var->value); 560 560 #else 561 # error Fix me 561 return InterlockedDecrement(&atomic_var->value); 562 562 #endif 563 563 } … … 580 580 InterlockedExchangeAdd( &atomic_var->value, value ); 581 581 #else 582 # error Fix me 582 InterlockedExchangeAdd( &atomic_var->value, value ); 583 583 #endif 584 584 } … … 594 594 return oldValue + value; 595 595 #else 596 # error Fix me 596 long oldValue = InterlockedExchangeAdd( &atomic_var->value, value); 597 return oldValue + value; 597 598 #endif 598 599 } -
pjproject/trunk/pjlib/src/pj/os_time_ansi.c
r66 r125 49 49 pt->sec = local_time->tm_sec; 50 50 pt->wday = local_time->tm_wday; 51 pt->yday = local_time->tm_yday;52 51 pt->msec = tv->msec; 53 52 … … 58 57 * Encode parsed time to time value. 59 58 */ 60 PJ_DEF(pj_status_t) pj_time_encode(const pj_parsed_time *pt, pj_time_val *tv); 59 PJ_DEF(pj_status_t) pj_time_encode(const pj_parsed_time *pt, pj_time_val *tv) 60 { 61 struct tm local_time; 62 63 local_time.tm_year = pt->year-1900; 64 local_time.tm_mon = pt->mon; 65 local_time.tm_mday = pt->day; 66 local_time.tm_hour = pt->hour; 67 local_time.tm_min = pt->min; 68 local_time.tm_sec = pt->sec; 69 local_time.tm_isdst = 0; 70 71 tv->sec = mktime(&local_time); 72 tv->msec = pt->msec; 73 74 return PJ_SUCCESS; 75 } 61 76 62 77 /** -
pjproject/trunk/pjlib/src/pj/os_timestamp_win32.c
r75 r125 25 25 defined(PJ_HAS_PENTIUM) && PJ_HAS_PENTIUM!=0 && \ 26 26 defined(_MSC_VER) 27 27 28 /* 28 29 * Use rdtsc to get the OS timestamp. … … 37 38 DWORD size; 38 39 40 #if defined(PJ_WIN32_WINCE) && PJ_WIN32_WINCE!=0 41 rc = RegOpenKeyEx(HKEY_LOCAL_MACHINE, 42 L"HARDWARE\\DESCRIPTION\\System\\CentralProcessor\\0", 43 0, 0, &key); 44 #else 39 45 rc = RegOpenKey( HKEY_LOCAL_MACHINE, 40 46 "HARDWARE\\DESCRIPTION\\System\\CentralProcessor\\0", 41 47 &key); 48 #endif 49 42 50 if (rc != ERROR_SUCCESS) 43 51 return PJ_RETURN_OS_ERROR(rc); -
pjproject/trunk/pjlib/src/pj/sock_bsd.c
r106 r125 363 363 364 364 PJ_CHECK_STACK(); 365 #if defined(PJ_WIN32) && PJ_WIN32==1 365 #if defined(PJ_WIN32) && PJ_WIN32!=0 || \ 366 defined(PJ_WIN32_WINCE) && PJ_WIN32_WINCE!=0 366 367 rc = closesocket(sock); 367 368 #else -
pjproject/trunk/pjlib/src/pjlib-test/main.c
r118 r125 91 91 } 92 92 93 pj_log_set_decor(PJ_LOG_HAS_NEWLINE | PJ_LOG_HAS_TIME | 94 PJ_LOG_HAS_MICRO_SEC); 95 93 96 rc = test_main(); 94 97 -
pjproject/trunk/pjlib/src/pjlib-test/main_mod.c
r65 r125 25 25 printk(KERN_INFO "PJLIB test module loaded. Starting tests...\n"); 26 26 27 pj_log_set_decor(PJ_LOG_HAS_NEWLINE | PJ_LOG_HAS_TIME | 28 PJ_LOG_HAS_MICRO_SEC); 29 27 30 test_main(); 28 31 -
pjproject/trunk/pjlib/src/pjlib-test/test.c
r71 r125 49 49 50 50 pj_log_set_level(3); 51 pj_log_set_decor(PJ_LOG_HAS_NEWLINE | PJ_LOG_HAS_TIME |52 PJ_LOG_HAS_MICRO_SEC);53 51 54 52 rc = pj_init();
Note: See TracChangeset
for help on using the changeset viewer.