Changeset 4618
- Timestamp:
- Oct 16, 2013 8:04:59 AM (11 years ago)
- Location:
- pjproject/branches/projects/winphone
- Files:
-
- 75 added
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/branches/projects/winphone/pjlib/include/pj/config.h
r4537 r4618 77 77 # define PJ_WIN32 1 78 78 79 #elif defined(PJ_WIN32_WINPHONE) || defined(_WIN32_WINPHONE) 80 /* 81 * Windows Phone 82 */ 83 # undef PJ_WIN32_WINPHONE 84 # define PJ_WIN32_WINPHONE 1 85 # include <pj/compat/os_winphone.h> 86 87 /* Also define Win32 */ 88 # define PJ_WIN32 1 89 79 90 #elif defined(PJ_WIN32) || defined(_WIN32) || defined(__WIN32__) || \ 80 91 defined(WIN32) || defined(PJ_WIN64) || defined(_WIN64) || \ … … 236 247 # define PJ_IS_BIG_ENDIAN 1 237 248 238 #elif defined (PJ_M_ARMV4) || defined(ARM) || defined(_ARM_) || \239 defined(ARMV4) || defined(__arm__) 249 #elif defined(ARM) || defined(_ARM_) || defined(__arm__) || defined(_M_ARM) 250 # define PJ_HAS_PENTIUM 0 240 251 /* 241 252 * ARM, bi-endian, so raise error if endianness is not configured 242 253 */ 243 # undef PJ_M_ARMV4244 # define PJ_M_ARMV4 1245 # define PJ_M_NAME "armv4"246 # define PJ_HAS_PENTIUM 0247 254 # if !PJ_IS_LITTLE_ENDIAN && !PJ_IS_BIG_ENDIAN 248 255 # error Endianness must be declared for this processor 249 256 # endif 257 # if defined (PJ_M_ARMV7) || defined(ARMV7) 258 # undef PJ_M_ARMV7 259 # define PJ_M_ARM7 1 260 # define PJ_M_NAME "armv7" 261 # elif defined (PJ_M_ARMV4) || defined(ARMV4) 262 # undef PJ_M_ARMV4 263 # define PJ_M_ARMV4 1 264 # define PJ_M_NAME "armv4" 265 # endif 250 266 251 267 #elif defined (PJ_M_POWERPC) || defined(__powerpc) || defined(__powerpc__) || \ -
pjproject/branches/projects/winphone/pjlib/src/pj/file_access_win32.c
r3553 r4618 34 34 #endif 35 35 36 static HANDLE WINAPI create_file(LPCTSTR filename, DWORD desired_access, 37 DWORD share_mode, 38 LPSECURITY_ATTRIBUTES security_attributes, 39 DWORD creation_disposition, 40 DWORD flags_and_attributes, 41 HANDLE template_file) 42 { 43 #ifdef PJ_WIN32_WINPHONE 44 return CreateFile2(filename, desired_access, share_mode, 45 creation_disposition, NULL); 46 #else 47 return CreateFile(filename, desired_access, share_mode, 48 security_attributes, creation_disposition, 49 flags_and_attributes, template_file); 50 #endif 51 } 36 52 37 53 /* … … 45 61 PJ_ASSERT_RETURN(filename != NULL, 0); 46 62 47 hFile = CreateFile(PJ_STRING_TO_NATIVE(filename,wfilename,sizeof(wfilename)), 48 CONTROL_ACCESS, 49 FILE_SHARE_READ, NULL, 50 OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); 63 hFile = create_file(PJ_STRING_TO_NATIVE(filename, 64 wfilename,sizeof(wfilename)), 65 CONTROL_ACCESS, 66 FILE_SHARE_READ, NULL, 67 OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); 68 51 69 if (hFile == INVALID_HANDLE_VALUE) 52 70 return 0; … … 69 87 PJ_ASSERT_RETURN(filename != NULL, -1); 70 88 71 hFile = CreateFile(PJ_STRING_TO_NATIVE(filename, wfilename,sizeof(wfilename)), 72 CONTROL_ACCESS, 73 FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, 74 OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); 89 hFile = create_file(PJ_STRING_TO_NATIVE(filename, 90 wfilename,sizeof(wfilename)), 91 CONTROL_ACCESS, 92 FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, 93 OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); 75 94 if (hFile == INVALID_HANDLE_VALUE) 76 95 return -1; … … 178 197 PJ_ASSERT_RETURN(filename!=NULL && stat!=NULL, PJ_EINVAL); 179 198 180 hFile = CreateFile(PJ_STRING_TO_NATIVE(filename,wfilename,sizeof(wfilename)), 181 CONTROL_ACCESS, 182 FILE_SHARE_READ, NULL, 183 OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); 199 hFile = create_file(PJ_STRING_TO_NATIVE(filename, 200 wfilename,sizeof(wfilename)), 201 CONTROL_ACCESS, 202 FILE_SHARE_READ, NULL, 203 OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); 184 204 if (hFile == INVALID_HANDLE_VALUE) 185 205 return PJ_RETURN_OS_ERROR(GetLastError()); -
pjproject/branches/projects/winphone/pjlib/src/pj/file_io_win32.c
r4537 r4618 89 89 dwFlagsAndAttributes = FILE_ATTRIBUTE_NORMAL; 90 90 91 hFile = CreateFile(PJ_STRING_TO_NATIVE(pathname,wpathname,sizeof(wpathname)), 91 #ifdef PJ_WIN32_WINPHONE 92 hFile = CreateFile2(PJ_STRING_TO_NATIVE(pathname, 93 wpathname,sizeof(wpathname)), 94 dwDesiredAccess, dwShareMode, dwCreationDisposition, 95 NULL); 96 #else 97 hFile = CreateFile(PJ_STRING_TO_NATIVE(pathname, 98 wpathname,sizeof(wpathname)), 92 99 dwDesiredAccess, dwShareMode, NULL, 93 100 dwCreationDisposition, dwFlagsAndAttributes, NULL); 101 #endif 102 94 103 if (hFile == INVALID_HANDLE_VALUE) { 95 104 *fd = 0; -
pjproject/branches/projects/winphone/pjlib/src/pj/os_core_win32.c
r4537 r4618 39 39 #endif 40 40 41 #if PJ_WIN32_WINPHONE 42 # include "../../third_party/threademulation/include/ThreadEmulation.h" 43 #endif 44 45 #if PJ_WIN32_WINNT >= 0x0602 46 # include <synchapi.h> 47 #endif 48 41 49 /* Activate mutex related logging if PJ_DEBUG_MUTEX is set, otherwise 42 50 * use default level 6 logging. … … 298 306 PJ_DEF(int) pj_thread_get_prio(pj_thread_t *thread) 299 307 { 308 #if PJ_WIN32_WINPHONE 309 PJ_UNUSED_ARG(thread); 310 return -1; 311 #else 300 312 return GetThreadPriority(thread->hthread); 313 #endif 301 314 } 302 315 … … 507 520 rec->proc = proc; 508 521 rec->arg = arg; 522 523 #ifdef PJ_WIN32_WINPHONE 524 rec->hthread = CreateThread(NULL, stack_size, 525 thread_main, rec, 526 dwflags, NULL); 527 #else 509 528 rec->hthread = CreateThread(NULL, stack_size, 510 529 thread_main, rec, 511 530 dwflags, &rec->idthread); 531 #endif 532 512 533 if (rec->hthread == NULL) 513 534 return PJ_RETURN_OS_ERROR(GetLastError()); … … 552 573 PJ_DEF(pj_thread_t*) pj_thread_this(void) 553 574 { 554 pj_thread_t *rec = pj_thread_local_get(thread_tls_id);575 pj_thread_t *rec = (pj_thread_t *)pj_thread_local_get(thread_tls_id); 555 576 556 577 if (rec == NULL) { … … 585 606 PJ_LOG(6, (pj_thread_this()->obj_name, "Joining thread %s", p->obj_name)); 586 607 608 #if PJ_WIN32_WINPHONE 609 rc = WaitForSingleObjectEx(rec->hthread, INFINITE, FALSE); 610 #else 587 611 rc = WaitForSingleObject(rec->hthread, INFINITE); 612 #endif 588 613 589 614 if (rc==WAIT_OBJECT_0) … … 859 884 PJ_CHECK_STACK(); 860 885 861 #if PJ_WIN32_WINNT >= 0x0400 862 InitializeCriticalSection(&mutex->crit); 886 #if PJ_WIN32_WINPHONE 887 InitializeCriticalSectionEx(&mutex->crit, 0, 0); 888 #elif PJ_WIN32_WINNT >= 0x0400 889 InitializeCriticalSection(&mutex->crit); 863 890 #else 864 891 mutex->hMutex = CreateMutex(NULL, FALSE, NULL); … … 1112 1139 PJ_ASSERT_RETURN(pool && sem_ptr, PJ_EINVAL); 1113 1140 1114 sem = pj_pool_alloc(pool, sizeof(*sem)); 1141 sem = pj_pool_alloc(pool, sizeof(*sem)); 1142 #if PJ_WIN32_WINPHONE 1143 /** SEMAPHORE_ALL_ACCESS **/ 1144 sem->hSemaphore = CreateSemaphoreEx(NULL, initial, max, NULL, 0, 1145 SEMAPHORE_ALL_ACCESS); 1146 #else 1115 1147 sem->hSemaphore = CreateSemaphore(NULL, initial, max, NULL); 1148 #endif 1116 1149 if (!sem->hSemaphore) 1117 1150 return PJ_RETURN_OS_ERROR(GetLastError()); … … 1144 1177 pj_thread_this()->obj_name)); 1145 1178 1179 #if PJ_WIN32_WINPHONE 1180 result = WaitForSingleObjectEx(sem->hSemaphore, timeout, FALSE); 1181 #else 1146 1182 result = WaitForSingleObject(sem->hSemaphore, timeout); 1183 #endif 1184 1147 1185 if (result == WAIT_OBJECT_0) { 1148 1186 LOG_MUTEX((sem->obj_name, "Semaphore acquired by thread %s", … … 1241 1279 return PJ_ENOMEM; 1242 1280 1281 #if PJ_WIN32_WINPHONE 1282 event->hEvent = CreateEventEx(NULL, NULL, 1283 (manual_reset?0x1:0x0)|(initial?0x2:0x0), 1284 EVENT_ALL_ACCESS); 1285 #else 1243 1286 event->hEvent = CreateEvent(NULL, manual_reset?TRUE:FALSE, 1244 1287 initial?TRUE:FALSE, NULL); 1288 #endif 1245 1289 1246 1290 if (!event->hEvent) … … 1274 1318 pj_thread_this()->obj_name)); 1275 1319 1320 #if PJ_WIN32_WINPHONE 1321 result = WaitForSingleObjectEx(event->hEvent, timeout, FALSE); 1322 #else 1276 1323 result = WaitForSingleObject(event->hEvent, timeout); 1324 #endif 1277 1325 if (result == WAIT_OBJECT_0) { 1278 1326 PJ_LOG(6, (event->obj_name, "Event: thread %s is released", … … 1332 1380 PJ_DEF(pj_status_t) pj_event_pulse(pj_event_t *event) 1333 1381 { 1382 #ifdef PJ_WIN32_WINPHONE 1383 PJ_UNUSED_ARG(event); 1384 pj_assert(!"pj_event_pulse() not supported!"); 1385 return PJ_ENOTSUP; 1386 #else 1334 1387 PJ_CHECK_STACK(); 1335 1388 PJ_ASSERT_RETURN(event, PJ_EINVAL); … … 1341 1394 else 1342 1395 return PJ_RETURN_OS_ERROR(GetLastError()); 1396 #endif 1343 1397 } 1344 1398 -
pjproject/branches/projects/winphone/pjlib/src/pj/os_info.c
r4537 r4618 191 191 ovi.dwOSVersionInfoSize = sizeof(ovi); 192 192 193 #ifdef PJ_WIN32_WINPHONE 194 goto get_sdk_info; 195 #else 193 196 if (GetVersionEx(&ovi) == FALSE) 194 197 goto get_sdk_info; 198 #endif 195 199 196 200 si.os_ver = (ovi.dwMajorVersion << 24) |
Note: See TracChangeset
for help on using the changeset viewer.