diff options
author | Kai Engert <kaie@kuix.de> | 2019-09-24 00:31:15 +0000 |
---|---|---|
committer | Kai Engert <kaie@kuix.de> | 2019-09-24 00:31:15 +0000 |
commit | 0b459aa3d16773bf7bbc893af0baca9464d1bf75 (patch) | |
tree | dc5fb7e16f3fd5adda7e65c98b27c843c9614ccb /pr/src/md | |
parent | bd4448ee1d97d90adb236a6342bfc7121a3edc15 (diff) | |
download | nspr-hg-0b459aa3d16773bf7bbc893af0baca9464d1bf75.tar.gz |
Bug 1581890 - remove whitespace from end of line in h/c/cpp. r=glandium
Differential Revision: https://phabricator.services.mozilla.com/D46189
Diffstat (limited to 'pr/src/md')
36 files changed, 498 insertions, 498 deletions
diff --git a/pr/src/md/os2/os2_errors.c b/pr/src/md/os2/os2_errors.c index 98f5cde5..169253f7 100644 --- a/pr/src/md/os2/os2_errors.c +++ b/pr/src/md/os2/os2_errors.c @@ -383,7 +383,7 @@ void _MD_os2_map_read_error(PRInt32 err) break; case EBADF: PR_SetError(PR_BAD_DESCRIPTOR_ERROR, err); - break; + break; case ENOTSOCK: PR_SetError(PR_NOT_SOCKET_ERROR, err); break; diff --git a/pr/src/md/os2/os2cv.c b/pr/src/md/os2/os2cv.c index 2c424c50..089e7396 100644 --- a/pr/src/md/os2/os2cv.c +++ b/pr/src/md/os2/os2cv.c @@ -16,7 +16,7 @@ * until right after we unlock the lock. This way the awakened threads * have a better chance to reaquire the lock. */ - + #include "primpl.h" /* @@ -78,7 +78,7 @@ md_UnlockAndPostNotifies( lock->notified.link = NULL; #endif - /* + /* * Figure out how many threads we need to wake up. */ notified = &post; /* this is where we start */ @@ -87,7 +87,7 @@ md_UnlockAndPostNotifies( _MDCVar *cv = notified->cv[index].cv; PRThread *thred; int i; - + /* Fast special case: no waiting threads */ if (cv->waitHead == NULL) { notified->cv[index].notifyHead = NULL; @@ -215,7 +215,7 @@ _PR_MD_NEW_CV(_MDCVar *cv) * when the PRCondVar structure is created. */ return 0; -} +} void _PR_MD_FREE_CV(_MDCVar *cv) { @@ -241,7 +241,7 @@ _PR_MD_WAIT_CV(_MDCVar *cv, _MDLock *lock, PRIntervalTime timeout ) md_UnlockAndPostNotifies(lock, thred, cv); } else { AddThreadToCVWaitQueueInternal(thred, cv); - DosReleaseMutexSem(lock->mutex); + DosReleaseMutexSem(lock->mutex); } /* Wait for notification or timeout; don't really care which */ diff --git a/pr/src/md/os2/os2gc.c b/pr/src/md/os2/os2gc.c index 2bcbf785..79b6de57 100644 --- a/pr/src/md/os2/os2gc.c +++ b/pr/src/md/os2/os2gc.c @@ -9,7 +9,7 @@ */ #include "primpl.h" -PRWord *_MD_HomeGCRegisters(PRThread *t, int isCurrent, int *np) +PRWord *_MD_HomeGCRegisters(PRThread *t, int isCurrent, int *np) { CONTEXTRECORD context; context.ContextFlags = CONTEXT_INTEGER; @@ -34,7 +34,7 @@ PRWord *_MD_HomeGCRegisters(PRThread *t, int isCurrent, int *np) } /* This function is not used right now, but is left as a reference. - * If you ever need to get the fiberID from the currently running fiber, + * If you ever need to get the fiberID from the currently running fiber, * this is it. */ void * @@ -43,8 +43,8 @@ GetMyFiberID() void *fiberData = 0; /* A pointer to our tib entry is found at FS:[18] - * At offset 10h is the fiberData pointer. The context of the - * fiber is stored in there. + * At offset 10h is the fiberData pointer. The context of the + * fiber is stored in there. */ #ifdef HAVE_ASM __asm { @@ -53,6 +53,6 @@ GetMyFiberID() mov [fiberData], EAX } #endif - + return fiberData; } diff --git a/pr/src/md/os2/os2inrval.c b/pr/src/md/os2/os2inrval.c index aff99e2e..4164cdf2 100644 --- a/pr/src/md/os2/os2inrval.c +++ b/pr/src/md/os2/os2inrval.c @@ -14,7 +14,7 @@ static PRBool useHighResTimer = PR_FALSE; PRIntervalTime _os2_ticksPerSec = -1; PRIntn _os2_bitShift = 0; PRInt32 _os2_highMask = 0; - + void _PR_MD_INTERVAL_INIT() { @@ -59,8 +59,8 @@ _PR_MD_GET_INTERVAL() */ top = timestamp.ulHi & _os2_highMask; top = top << (32 - _os2_bitShift); - timestamp.ulLo = timestamp.ulLo >> _os2_bitShift; - timestamp.ulLo = timestamp.ulLo + top; + timestamp.ulLo = timestamp.ulLo >> _os2_bitShift; + timestamp.ulLo = timestamp.ulLo + top; return (PRUint32)timestamp.ulLo; } else { ULONG msCount = -1; diff --git a/pr/src/md/os2/os2io.c b/pr/src/md/os2/os2io.c index 3c81ae34..ad7d921f 100644 --- a/pr/src/md/os2/os2io.c +++ b/pr/src/md/os2/os2io.c @@ -45,7 +45,7 @@ _PR_MD_INIT_IO() HMODULE module; sock_init(); - + rc = DosLoadModule(NULL, 0, "DOSCALL1", &module); if (rc != NO_ERROR) { @@ -78,8 +78,8 @@ _PR_MD_WAIT(PRThread *thread, PRIntervalTime ticks) PRUint32 msecs = (ticks == PR_INTERVAL_NO_TIMEOUT) ? SEM_INDEFINITE_WAIT : PR_IntervalToMilliseconds(ticks); rv = DosWaitEventSem(thread->md.blocked_sema, msecs); - DosResetEventSem(thread->md.blocked_sema, &count); - switch(rv) + DosResetEventSem(thread->md.blocked_sema, &count); + switch(rv) { case NO_ERROR: return PR_SUCCESS; @@ -99,7 +99,7 @@ _PR_MD_WAIT(PRThread *thread, PRIntervalTime ticks) */ _PR_THREAD_UNLOCK(thread); rv = DosWaitEventSem(thread->md.blocked_sema, 0); - DosResetEventSem(thread->md.blocked_sema, &count); + DosResetEventSem(thread->md.blocked_sema, &count); PR_ASSERT(rv == NO_ERROR); } } @@ -113,7 +113,7 @@ _PR_MD_WAIT(PRThread *thread, PRIntervalTime ticks) PRStatus _PR_MD_WAKEUP_WAITER(PRThread *thread) { - if ( _PR_IS_NATIVE_THREAD(thread) ) + if ( _PR_IS_NATIVE_THREAD(thread) ) { if (DosPostEventSem(thread->md.blocked_sema) != NO_ERROR) return PR_FAILURE; @@ -132,7 +132,7 @@ _PR_MD_WAKEUP_WAITER(PRThread *thread) * The NSPR open flags (osflags) are translated into flags for OS/2 * * Mode seems to be passed in as a unix style file permissions argument - * as in 0666, in the case of opening the logFile. + * as in 0666, in the case of opening the logFile. * */ PRInt32 @@ -149,7 +149,7 @@ _PR_MD_OPEN(const char *name, PRIntn osflags, int mode) * All the pointer arguments (&file, &actionTaken and name) have to be in * low memory for DosOpen to use them. * The following moves name to low memory. - */ + */ if ((ULONG)name >= 0x20000000) { size_t len = strlen(name) + 1; @@ -178,7 +178,7 @@ _PR_MD_OPEN(const char *name, PRIntn osflags, int mode) flags = OPEN_ACTION_CREATE_IF_NEW | OPEN_ACTION_REPLACE_IF_EXISTS; else flags = OPEN_ACTION_CREATE_IF_NEW | OPEN_ACTION_OPEN_IF_EXISTS; - } + } else { if (osflags & PR_TRUNCATE) @@ -223,7 +223,7 @@ _PR_MD_OPEN(const char *name, PRIntn osflags, int mode) if (rc != NO_ERROR) { _PR_MD_MAP_OPEN_ERROR(rc); - return -1; + return -1; } return (PRInt32)file; @@ -239,8 +239,8 @@ _PR_MD_READ(PRFileDesc *fd, void *buf, PRInt32 len) (PVOID)buf, len, &bytes); - - if (rv != NO_ERROR) + + if (rv != NO_ERROR) { /* ERROR_HANDLE_EOF can only be returned by async io */ PR_ASSERT(rv != ERROR_HANDLE_EOF); @@ -258,14 +258,14 @@ PRInt32 _PR_MD_WRITE(PRFileDesc *fd, const void *buf, PRInt32 len) { PRInt32 bytes; - int rv; + int rv; rv = DosWrite((HFILE)fd->secret->md.osfd, (PVOID)buf, len, (PULONG)&bytes); - if (rv != NO_ERROR) + if (rv != NO_ERROR) { _PR_MD_MAP_WRITE_ERROR(rv); return -1; @@ -344,12 +344,12 @@ _PR_MD_LSEEK64(PRFileDesc *fd, PRInt64 offset, PRSeekWhence whence) { rc = DosSetFilePtr((HFILE)fd->secret->md.osfd, lo, where, (PULONG)&newLocation); } - + if (rc != NO_ERROR) { _PR_MD_MAP_LSEEK_ERROR(rc); return -1; } - + if (isWSEB) { return newLocationL; @@ -373,7 +373,7 @@ _PR_MD_FSYNC(PRFileDesc *fd) PRInt32 rc = DosResetBuffer((HFILE)fd->secret->md.osfd); if (rc != NO_ERROR) { - if (rc != ERROR_ACCESS_DENIED) { + if (rc != ERROR_ACCESS_DENIED) { _PR_MD_MAP_FSYNC_ERROR(rc); return -1; } @@ -385,7 +385,7 @@ PRInt32 _MD_CloseFile(PRInt32 osfd) { PRInt32 rv; - + rv = DosClose((HFILE)osfd); if (rv != NO_ERROR) _PR_MD_MAP_CLOSE_ERROR(rv); @@ -558,7 +558,7 @@ _PR_MD_STAT(const char *fn, struct stat *info) * can be handled by _stat() on NT but not on Win95. * * We remove the backslash or slash at the end and - * try again. + * try again. * * Not sure if this happens on OS/2 or not, * but it doesn't hurt to be careful. @@ -587,7 +587,7 @@ _PR_MD_GETFILEINFO(const char *fn, PRFileInfo *info) struct stat sb; PRInt32 rv; PRInt64 s, s2us; - + if ( (rv = _PR_MD_STAT(fn, &sb)) == 0 ) { if (info) { if (S_IFREG & sb.st_mode) @@ -622,7 +622,7 @@ _PR_MD_GETFILEINFO64(const char *fn, PRFileInfo64 *info) LL_UI2L(info->size,info32.size); info->modifyTime = info32.modifyTime; info->creationTime = info32.creationTime; - + if (isWSEB) { APIRET rc ; @@ -697,11 +697,11 @@ _PR_MD_GETOPENFILEINFO64(const PRFileDesc *fd, PRFileInfo64 *info) { info->type = info32.type; LL_UI2L(info->size,info32.size); - + info->modifyTime = info32.modifyTime; info->creationTime = info32.creationTime; } - + if (isWSEB) { APIRET rc ; @@ -792,7 +792,7 @@ _PR_MD_LOCKFILE(PRInt32 f) PRInt32 rv; FILELOCK lock, unlock; FILELOCKL lockL, unlockL; - + lock.lOffset = 0; lockL.lOffset = 0; lock.lRange = 0xffffffff; @@ -824,7 +824,7 @@ _PR_MD_LOCKFILE(PRInt32 f) if ( rv != NO_ERROR ) { DosSleep( 50 ); /* Sleep() a few milisecs and try again. */ - } + } } /* end for() */ return PR_SUCCESS; } /* end _PR_MD_LOCKFILE() */ @@ -842,7 +842,7 @@ _PR_MD_UNLOCKFILE(PRInt32 f) PRInt32 rv; FILELOCK lock, unlock; FILELOCKL lockL, unlockL; - + lock.lOffset = 0; lockL.lOffset = 0; lock.lRange = 0; @@ -851,7 +851,7 @@ _PR_MD_UNLOCKFILE(PRInt32 f) unlockL.lOffset = 0; unlock.lRange = 0xffffffff; unlockL.lRange = 0xffffffffffffffff; - + if (isWSEB) { rv = myDosSetFileLocksL( (HFILE) f, @@ -864,7 +864,7 @@ _PR_MD_UNLOCKFILE(PRInt32 f) &unlock, &lock, 0, 0); } - + if ( rv != NO_ERROR ) { return PR_SUCCESS; diff --git a/pr/src/md/os2/os2misc.c b/pr/src/md/os2/os2misc.c index f0e3ceea..8e44ca01 100644 --- a/pr/src/md/os2/os2misc.c +++ b/pr/src/md/os2/os2misc.c @@ -73,7 +73,7 @@ PR_Now(void) LL_MUL(ms, ms, ms2us); LL_MUL(s, s, s2us); LL_ADD(s, s, ms); - return s; + return s; } @@ -120,7 +120,7 @@ static int assembleCmdLine(char *const *argv, char **cmdLine) strcat(*cmdLine, " "); } strcat(*cmdLine, *arg); - } + } return 0; } @@ -221,7 +221,7 @@ PRProcess * _PR_CreateOS2Process( char *cmdLine = NULL; char **newEnvp = NULL; char *envBlock = NULL; - + STARTDATA startData = {0}; APIRET rc; ULONG ulAppType = 0; @@ -250,7 +250,7 @@ PRProcess * _PR_CreateOS2Process( PR_SetError(PR_OUT_OF_MEMORY_ERROR, 0); goto errorExit; } - + if (assembleCmdLine(argv, &cmdLine) == -1) { PR_SetError(PR_OUT_OF_MEMORY_ERROR, 0); goto errorExit; @@ -260,7 +260,7 @@ PRProcess * _PR_CreateOS2Process( /* * DosQueryAppType() fails if path (the char* in the first argument) is in * high memory. If that is the case, the following moves it to low memory. - */ + */ if ((ULONG)path >= 0x20000000) { size_t len = strlen(path) + 1; char *copy = (char *)alloca(len); @@ -268,7 +268,7 @@ PRProcess * _PR_CreateOS2Process( path = copy; } #endif - + if (envp == NULL) { newEnvp = NULL; } else { @@ -287,7 +287,7 @@ PRProcess * _PR_CreateOS2Process( PR_SetError(PR_OUT_OF_MEMORY_ERROR, 0); goto errorExit; } - + rc = DosQueryAppType(path, &ulAppType); if (rc != NO_ERROR) { char *pszDot = strrchr(path, '.'); @@ -307,7 +307,7 @@ PRProcess * _PR_CreateOS2Process( PR_SetError(PR_UNKNOWN_ERROR, 0); goto errorExit; } - + if ((ulAppType & FAPPTYP_WINDOWAPI) == FAPPTYP_WINDOWAPI) { startData.SessionType = SSF_TYPE_PM; } @@ -317,16 +317,16 @@ PRProcess * _PR_CreateOS2Process( else { startData.SessionType = SSF_TYPE_DEFAULT; } - + if (ulAppType & (FAPPTYP_WINDOWSPROT31 | FAPPTYP_WINDOWSPROT | FAPPTYP_WINDOWSREAL)) { strcpy(pszEXEName, "WINOS2.COM"); startData.SessionType = PROG_31_STDSEAMLESSVDM; strcpy(pszFormatString, "/3 %s %s"); } - + startData.InheritOpt = SSF_INHERTOPT_SHELL; - + if (pszEXEName[0]) { pszFormatResult = PR_MALLOC(strlen(pszFormatString)+strlen(path)+strlen(cmdLine)); sprintf(pszFormatResult, pszFormatString, path, cmdLine); @@ -336,13 +336,13 @@ PRProcess * _PR_CreateOS2Process( startData.PgmInputs = cmdLine; } startData.PgmName = pszEXEName; - + startData.Length = sizeof(startData); startData.Related = SSF_RELATED_INDEPENDENT; startData.ObjectBuffer = pszObjectBuffer; startData.ObjectBuffLen = CCHMAXPATH; startData.Environment = envBlock; - + if (attr) { /* On OS/2, there is really no way to pass file handles for stdin, * stdout, and stderr to a new process. Instead, we can make it @@ -407,7 +407,7 @@ PRProcess * _PR_CreateOS2Process( } proc->md.pid = procInfo.codeTerminate; - } else { + } else { /* * If no STDIN/STDOUT redirection is not needed, use DosStartSession * to create a new, independent session @@ -418,7 +418,7 @@ PRProcess * _PR_CreateOS2Process( PR_SetError(PR_UNKNOWN_ERROR, rc); goto errorExit; } - + proc->md.pid = pid; } @@ -453,7 +453,7 @@ errorExit: PRStatus _PR_DetachOS2Process(PRProcess *process) { - /* On OS/2, a process is either created as a child or not. + /* On OS/2, a process is either created as a child or not. * You can't 'detach' it later on. */ PR_DELETE(process); @@ -470,7 +470,7 @@ PRStatus _PR_WaitOS2Process(PRProcess *process, RESULTCODES results; PID pidEnded = 0; - ulRetVal = DosWaitChild(DCWA_PROCESS, DCWW_WAIT, + ulRetVal = DosWaitChild(DCWA_PROCESS, DCWW_WAIT, &results, &pidEnded, process->md.pid); @@ -509,7 +509,7 @@ void _PR_MD_WAKEUP_CPUS( void ) { return; -} +} /* ********************************************************************** diff --git a/pr/src/md/os2/os2poll.c b/pr/src/md/os2/os2poll.c index 9a0a0095..91101d43 100644 --- a/pr/src/md/os2/os2poll.c +++ b/pr/src/md/os2/os2poll.c @@ -24,8 +24,8 @@ PRBool IsSocketSet( PRInt32 osfd, int* socks, int start, int count ) if( socks[i] == osfd ) isSet = PR_TRUE; } - - return isSet; + + return isSet; } #endif @@ -55,7 +55,7 @@ PRInt32 _PR_MD_PR_POLL(PRPollDesc *pds, PRIntn npds, PRIntervalTime timeout) wt = 0; ex = 0; socks = (int) PR_MALLOC( npds * 3 * sizeof(int) ); - + if (!socks) { PR_SetError(PR_OUT_OF_MEMORY_ERROR, 0); @@ -115,7 +115,7 @@ PRInt32 _PR_MD_PR_POLL(PRPollDesc *pds, PRIntn npds, PRIntervalTime timeout) if (0 == ready) { PRInt32 osfd = bottom->secret->md.osfd; - if (osfd > maxfd) + if (osfd > maxfd) maxfd = osfd; if (in_flags_read & PR_POLL_READ) { @@ -124,7 +124,7 @@ PRInt32 _PR_MD_PR_POLL(PRPollDesc *pds, PRIntn npds, PRIntervalTime timeout) FD_SET(osfd, &rd); #else socks[rd] = osfd; - rd++; + rd++; #endif } if (in_flags_read & PR_POLL_WRITE) @@ -134,7 +134,7 @@ PRInt32 _PR_MD_PR_POLL(PRPollDesc *pds, PRIntn npds, PRIntervalTime timeout) FD_SET(osfd, &wt); #else socks[npds+wt] = osfd; - wt++; + wt++; #endif } if (in_flags_write & PR_POLL_READ) @@ -144,7 +144,7 @@ PRInt32 _PR_MD_PR_POLL(PRPollDesc *pds, PRIntn npds, PRIntervalTime timeout) FD_SET(osfd, &rd); #else socks[rd] = osfd; - rd++; + rd++; #endif } if (in_flags_write & PR_POLL_WRITE) @@ -154,7 +154,7 @@ PRInt32 _PR_MD_PR_POLL(PRPollDesc *pds, PRIntn npds, PRIntervalTime timeout) FD_SET(osfd, &wt); #else socks[npds+wt] = osfd; - wt++; + wt++; #endif } if (pd->in_flags & PR_POLL_EXCEPT) @@ -229,7 +229,7 @@ retry: socks[i] = socks[j]; for( i = rd+wt, j = npds*2; j < npds*2+ex; i++,j++ ) socks[i] = socks[j]; - + ready = os2_select(socks, rd, wt, ex, msecs); #endif @@ -272,31 +272,31 @@ retry: #ifdef BSD_SELECT if (FD_ISSET(osfd, &rd)) #else - if( IsSocketSet(osfd, socks, 0, rd) ) + if( IsSocketSet(osfd, socks, 0, rd) ) #endif { if (pd->out_flags & _PR_POLL_READ_SYS_READ) out_flags |= PR_POLL_READ; if (pd->out_flags & _PR_POLL_WRITE_SYS_READ) out_flags |= PR_POLL_WRITE; - } + } #ifdef BSD_SELECT if (FD_ISSET(osfd, &wt)) #else - if( IsSocketSet(osfd, socks, rd, wt) ) + if( IsSocketSet(osfd, socks, rd, wt) ) #endif { if (pd->out_flags & _PR_POLL_READ_SYS_WRITE) out_flags |= PR_POLL_READ; if (pd->out_flags & _PR_POLL_WRITE_SYS_WRITE) out_flags |= PR_POLL_WRITE; - } + } #ifdef BSD_SELECT if (FD_ISSET(osfd, &ex)) #else - if( IsSocketSet(osfd, socks, rd+wt, ex) ) + if( IsSocketSet(osfd, socks, rd+wt, ex) ) #endif { out_flags |= PR_POLL_EXCEPT; diff --git a/pr/src/md/os2/os2sem.c b/pr/src/md/os2/os2sem.c index b60f35a7..9c7d05cf 100644 --- a/pr/src/md/os2/os2sem.c +++ b/pr/src/md/os2/os2sem.c @@ -55,7 +55,7 @@ _PR_MD_POST_SEM(_MDSemaphore *md) { int rv; rv = DosPostEventSem(md->sem); - PR_ASSERT(rv == NO_ERROR); + PR_ASSERT(rv == NO_ERROR); } diff --git a/pr/src/md/os2/os2sock.c b/pr/src/md/os2/os2sock.c index b32794f3..490c4af6 100644 --- a/pr/src/md/os2/os2sock.c +++ b/pr/src/md/os2/os2sock.c @@ -12,7 +12,7 @@ /*There is standard BSD (which is kind of slow) and a new flavor of select() that takes */ /*an integer list of sockets, the number of read sockets, write sockets, except sockets, and */ /*a millisecond count for timeout. In the interest of performance I have choosen the OS/2 */ -/*specific version of select(). See OS/2 TCP/IP Programmer's Toolkit for more info. */ +/*specific version of select(). See OS/2 TCP/IP Programmer's Toolkit for more info. */ #include "primpl.h" @@ -32,7 +32,7 @@ _PR_MD_SOCKET(int domain, int type, int flags) osfd = socket(domain, type, flags); - if (osfd == -1) + if (osfd == -1) { err = sock_errno(); _PR_MD_MAP_SOCKET_ERROR(err); @@ -106,14 +106,14 @@ socket_io_wait( PRInt32 osfd, PRInt32 fd_type, PRIntervalTime timeout ) else rv = bsdselect(osfd + 1, NULL, &rd_wr, NULL, &tv); #else - lTimeout = _PR_INTERRUPT_CHECK_INTERVAL_SECS * 1000; + lTimeout = _PR_INTERRUPT_CHECK_INTERVAL_SECS * 1000; do { socks[0] = osfd; if (fd_type == READ_FD) rv = os2_select(socks, 1, 0, 0, lTimeout); else rv = os2_select(socks, 0, 1, 0, lTimeout); -#endif +#endif if (rv == -1 && (syserror = sock_errno()) != EINTR) { _PR_MD_MAP_SELECT_ERROR(syserror); break; @@ -253,7 +253,7 @@ done: } PRInt32 -_PR_MD_CONNECT(PRFileDesc *fd, const PRNetAddr *addr, PRUint32 addrlen, +_PR_MD_CONNECT(PRFileDesc *fd, const PRNetAddr *addr, PRUint32 addrlen, PRIntervalTime timeout) { PRInt32 rv, err; @@ -313,7 +313,7 @@ retry: } return 0; } - + _PR_MD_MAP_CONNECT_ERROR(err); } @@ -347,7 +347,7 @@ _PR_MD_LISTEN(PRFileDesc *fd, PRIntn backlog) PRInt32 -_PR_MD_RECV(PRFileDesc *fd, void *buf, PRInt32 amount, PRIntn flags, +_PR_MD_RECV(PRFileDesc *fd, void *buf, PRInt32 amount, PRIntn flags, PRIntervalTime timeout) { PRInt32 osfd = fd->secret->md.osfd; @@ -639,7 +639,7 @@ _MD_MakeNonblock(PRFileDesc *fd) PRInt32 osfd = fd->secret->md.osfd; PRInt32 err; PRUint32 one = 1; - + if (osfd <= 2) { /* Don't mess around with stdin, stdout or stderr */ return; diff --git a/pr/src/md/os2/os2thred.c b/pr/src/md/os2/os2thred.c index edb9f5f0..ab26f181 100644 --- a/pr/src/md/os2/os2thred.c +++ b/pr/src/md/os2/os2thred.c @@ -19,7 +19,7 @@ _PR_MD_ENSURE_TLS(void) if(!pThreadLocalStorage) { /* Allocate thread local storage (TLS). Note, that only 32 bytes can - * be allocated at a time. + * be allocated at a time. */ int rc = DosAllocThreadLocalMemory(sizeof(_NSPR_TLS) / 4, (PULONG*)&pThreadLocalStorage); PR_ASSERT(rc == NO_ERROR); @@ -169,18 +169,18 @@ ExcpStartFunc(void* arg) } PRStatus -_PR_MD_CREATE_THREAD(PRThread *thread, - void (*start)(void *), - PRThreadPriority priority, - PRThreadScope scope, - PRThreadState state, +_PR_MD_CREATE_THREAD(PRThread *thread, + void (*start)(void *), + PRThreadPriority priority, + PRThreadScope scope, + PRThreadState state, PRUint32 stackSize) { PARAMSTORE* params = PR_Malloc(sizeof(PARAMSTORE)); params->start = start; params->thread = thread; thread->md.handle = thread->id = (TID) _beginthread(ExcpStartFunc, - NULL, + NULL, thread->stack->stackSize, params); if(thread->md.handle == -1) { @@ -268,7 +268,7 @@ _PR_MD_EXIT(PRIntn status) } #ifdef HAVE_THREAD_AFFINITY -PR_EXTERN(PRInt32) +PR_EXTERN(PRInt32) _PR_MD_SETTHREADAFFINITYMASK(PRThread *thread, PRUint32 mask ) { /* Can we do this on OS/2? Only on SMP versions? */ @@ -295,14 +295,14 @@ _PR_MD_GETTHREADAFFINITYMASK(PRThread *thread, PRUint32 *mask) PRInt32 rv, system_mask; rv = GetProcessAffinityMask(GetCurrentProcess(), mask, &system_mask); - + return rv?0:-1; */ } #endif /* HAVE_THREAD_AFFINITY */ void -_PR_MD_SUSPEND_CPU(_PRCPU *cpu) +_PR_MD_SUSPEND_CPU(_PRCPU *cpu) { _PR_MD_SUSPEND_THREAD(cpu->thread); } diff --git a/pr/src/md/prosdep.c b/pr/src/md/prosdep.c index 20b0a46e..17441718 100644 --- a/pr/src/md/prosdep.c +++ b/pr/src/md/prosdep.c @@ -11,7 +11,7 @@ #endif #ifdef _WIN32 #include <windows.h> -#endif +#endif PRInt32 _pr_pageShift; PRInt32 _pr_pageSize; diff --git a/pr/src/md/unix/hpux.c b/pr/src/md/unix/hpux.c index 56fddba2..4f5435b9 100644 --- a/pr/src/md/unix/hpux.c +++ b/pr/src/md/unix/hpux.c @@ -208,7 +208,7 @@ strchr(const char *s, int c) * A.09.07, and B.10.10) dumps core if called with: * 1. First operand with address = 1(mod 4). * 2. Size = 1(mod 4) - * 3. Last byte of the second operand is the last byte of the page and + * 3. Last byte of the second operand is the last byte of the page and * next page is not accessible(not mapped or protected) * Thus, using the following naive version (tons of optimizations are * possible;^) @@ -220,10 +220,10 @@ int memcmp(const void *s1, const void *s2, size_t n) *p2 = (unsigned char *) s2; while (n-- > 0) { - register int r = ((int) ((unsigned int) *p1)) + register int r = ((int) ((unsigned int) *p1)) - ((int) ((unsigned int) *p2)); if (r) return r; p1++; p2++; } - return 0; + return 0; } diff --git a/pr/src/md/unix/pthreads_user.c b/pr/src/md/unix/pthreads_user.c index bb64b9f4..69061205 100644 --- a/pr/src/md/unix/pthreads_user.c +++ b/pr/src/md/unix/pthreads_user.c @@ -68,7 +68,7 @@ PR_IMPLEMENT(void) _MD_FREE_LOCK(struct _MDLock *lockp) PRThread *me = _PR_MD_CURRENT_THREAD(); if (me && !_PR_IS_NATIVE_THREAD(me)) - _PR_INTSOFF(_is); + _PR_INTSOFF(_is); pthread_mutex_destroy(&lockp->mutex); if (me && !_PR_IS_NATIVE_THREAD(me)) _PR_FAST_INTSON(_is); @@ -80,7 +80,7 @@ PR_IMPLEMENT(PRStatus) _MD_NEW_LOCK(struct _MDLock *lockp) { PRStatus rv; PRIntn is; - PRThread *me = _PR_MD_CURRENT_THREAD(); + PRThread *me = _PR_MD_CURRENT_THREAD(); if (me && !_PR_IS_NATIVE_THREAD(me)) _PR_INTSOFF(is); @@ -317,7 +317,7 @@ _MD_WakeupWaiter(PRThread *thread) if (!_PR_IS_NATIVE_THREAD(me)) _PR_FAST_INTSON(is); - } + } return PR_SUCCESS; } @@ -339,7 +339,7 @@ _MD_CreateThread( { PRIntn is; int rv; - PRThread *me = _PR_MD_CURRENT_THREAD(); + PRThread *me = _PR_MD_CURRENT_THREAD(); pthread_attr_t attr; if (!_PR_IS_NATIVE_THREAD(me)) @@ -437,7 +437,7 @@ _MD_CleanupBeforeExit(void) thread = _PR_THREAD_PTR(ptr); _MD_CVAR_POST_SEM(thread); ptr = ptr->next; - } + } } _PR_DEADQ_UNLOCK; while(_PR_NUM_DEADNATIVE > 1) { diff --git a/pr/src/md/unix/solaris.c b/pr/src/md/unix/solaris.c index 4fe2043b..3b7d1280 100644 --- a/pr/src/md/unix/solaris.c +++ b/pr/src/md/unix/solaris.c @@ -136,7 +136,7 @@ PRWord *_MD_HomeGCRegisters(PRThread *t, PRIntn isCurrent, PRIntn *np) #ifndef _PR_PTHREADS #if defined(i386) && defined(SOLARIS2_4) -/* +/* * Because clock_gettime() on Solaris/x86 2.4 always generates a * segmentation fault, we use an emulated version _pr_solx86_clock_gettime(), * which is implemented using gettimeofday(). diff --git a/pr/src/md/unix/unix.c b/pr/src/md/unix/unix.c index 0ae866a2..61be5229 100644 --- a/pr/src/md/unix/unix.c +++ b/pr/src/md/unix/unix.c @@ -97,9 +97,9 @@ static PRInt32 local_io_wait(PRInt32 osfd, PRInt32 wait_flag, PRIntervalTime timeout); _PRInterruptTable _pr_interruptTable[] = { - { + { "clock", _PR_MISSED_CLOCK, _PR_ClockInterrupt, }, - { + { 0 } }; @@ -153,7 +153,7 @@ int err; err = _MD_ERRNO(); _PR_MD_MAP_READDIR_ERROR(err); return 0; - } + } if ((flags & PR_SKIP_DOT) && (de->d_name[0] == '.') && (de->d_name[1] == 0)) continue; @@ -307,7 +307,7 @@ PRInt32 osfd = fd->secret->md.osfd; if (!_PR_IS_NATIVE_THREAD(me)) { if ((rv = local_io_wait(osfd, _PR_UNIX_POLL_READ, PR_INTERVAL_NO_TIMEOUT)) < 0) - goto done; + goto done; } else { #ifndef _PR_USE_POLL while ((rv = _MD_SELECT(osfd + 1, &rd, NULL, NULL, NULL)) @@ -1267,7 +1267,7 @@ PRStatus _MD_getsockopt(PRFileDesc *fd, PRInt32 level, return rv==0?PR_SUCCESS:PR_FAILURE; } -PRStatus _MD_setsockopt(PRFileDesc *fd, PRInt32 level, +PRStatus _MD_setsockopt(PRFileDesc *fd, PRInt32 level, PRInt32 optname, const char* optval, PRInt32 optlen) { PRInt32 rv, err; @@ -2993,7 +2993,7 @@ PRInt32 _PR_WaitForMultipleFDs( } _PR_IOQ_OSFD_CNT(me->cpu) += pdcnt; - + _PR_SLEEPQ_LOCK(me->cpu); _PR_ADD_SLEEPQ(me, timeout); me->state = _PR_IO_WAIT; @@ -3009,7 +3009,7 @@ PRInt32 _PR_WaitForMultipleFDs( me->io_suspended = PR_FALSE; /* - * This thread should run on the same cpu on which it was blocked; when + * This thread should run on the same cpu on which it was blocked; when * the IO request times out the fd sets and fd counts for the * cpu are updated below. */ @@ -3090,12 +3090,12 @@ void _PR_Unblock_IO_Wait(PRThread *thr) { int pri = thr->priority; _PRCPU *cpu = thr->cpu; - + /* * GLOBAL threads wakeup periodically to check for interrupt */ if (_PR_IS_NATIVE_THREAD(thr)) { - _PR_THREAD_UNLOCK(thr); + _PR_THREAD_UNLOCK(thr); return; } diff --git a/pr/src/md/unix/unix_errors.c b/pr/src/md/unix/unix_errors.c index bcea0993..fcc8320f 100644 --- a/pr/src/md/unix/unix_errors.c +++ b/pr/src/md/unix/unix_errors.c @@ -144,7 +144,7 @@ void _MD_unix_map_default_error(int err) case ENOLCK: prError = PR_FILE_IS_LOCKED_ERROR; break; -#ifdef ENOLINK +#ifdef ENOLINK case ENOLINK: prError = PR_REMOTE_FILE_ERROR; break; @@ -530,8 +530,8 @@ void _MD_unix_map_connect_error(int err) switch (err) { #if defined(UNIXWARE) /* - * On some platforms, if we connect to a port on the local host - * (the loopback address) that no process is listening on, we get + * On some platforms, if we connect to a port on the local host + * (the loopback address) that no process is listening on, we get * EIO instead of ECONNREFUSED. */ case EIO: diff --git a/pr/src/md/unix/unixware.c b/pr/src/md/unix/unixware.c index 638af5f2..4ddb23d6 100644 --- a/pr/src/md/unix/unixware.c +++ b/pr/src/md/unix/unixware.c @@ -230,29 +230,29 @@ void _MD_EarlyInit(void) sigaddset(&set, SIGALRM); } -PRStatus _MD_CREATE_THREAD(PRThread *thread, - void (*start)(void *), +PRStatus _MD_CREATE_THREAD(PRThread *thread, + void (*start)(void *), PRThreadPriority priority, - PRThreadScope scope, - PRThreadState state, - PRUint32 stackSize) + PRThreadScope scope, + PRThreadState state, + PRUint32 stackSize) { long flags; - + /* mask out SIGALRM for native thread creation */ - thr_sigsetmask(SIG_BLOCK, &set, &oldset); + thr_sigsetmask(SIG_BLOCK, &set, &oldset); - flags = (state == PR_JOINABLE_THREAD ? THR_SUSPENDED/*|THR_NEW_LWP*/ + flags = (state == PR_JOINABLE_THREAD ? THR_SUSPENDED/*|THR_NEW_LWP*/ : THR_SUSPENDED|THR_DETACHED/*|THR_NEW_LWP*/); if (_PR_IS_GCABLE_THREAD(thread) || (scope == PR_GLOBAL_BOUND_THREAD)) flags |= THR_BOUND; if (thr_create(NULL, thread->stack->stackSize, - (void *(*)(void *)) start, (void *) thread, + (void *(*)(void *)) start, (void *) thread, flags, &thread->md.handle)) { - thr_sigsetmask(SIG_SETMASK, &oldset, NULL); + thr_sigsetmask(SIG_SETMASK, &oldset, NULL); return PR_FAILURE; } @@ -262,15 +262,15 @@ PRStatus _MD_CREATE_THREAD(PRThread *thread, * its register state is initialized properly for GC */ thread->md.lwpid = -1; - thr_sigsetmask(SIG_SETMASK, &oldset, NULL); + thr_sigsetmask(SIG_SETMASK, &oldset, NULL); _MD_NEW_SEM(&thread->md.waiter_sem, 0); if ((scope == PR_GLOBAL_THREAD) || (scope == PR_GLOBAL_BOUND_THREAD)) { thread->flags |= _PR_GLOBAL_SCOPE; } - /* - ** Set the thread priority. This will also place the thread on + /* + ** Set the thread priority. This will also place the thread on ** the runQ. ** ** Force PR_SetThreadPriority to set the priority by @@ -282,7 +282,7 @@ PRStatus _MD_CREATE_THREAD(PRThread *thread, thread->priority = 100; PR_SetThreadPriority( thread, pri ); - PR_LOG(_pr_thread_lm, PR_LOG_MIN, + PR_LOG(_pr_thread_lm, PR_LOG_MIN, ("(0X%x)[Start]: on to runq at priority %d", thread, thread->priority)); } @@ -301,7 +301,7 @@ void _MD_cleanup_thread(PRThread *thread) hdl = thread->md.handle; - /* + /* ** First, suspend the thread (unless it's the active one) ** Because we suspend it first, we don't have to use LOCK_SCHEDULER to ** prevent both of us modifying the thread structure at the same time. @@ -456,7 +456,7 @@ void unixware_preempt_off() void unixware_preempt_on() { - sigprocmask (SIG_SETMASK, &old_mask, NULL); + sigprocmask (SIG_SETMASK, &old_mask, NULL); } void _MD_Begin_SuspendAll() @@ -466,7 +466,7 @@ void _MD_Begin_SuspendAll() PR_LOG(_pr_gc_lm, PR_LOG_ALWAYS, ("Begin_SuspendAll\n")); /* run at highest prio so I cannot be preempted */ thr_getprio(thr_self(), &gcprio); - thr_setprio(thr_self(), 0x7fffffff); + thr_setprio(thr_self(), 0x7fffffff); suspendAllOn = 1; } @@ -493,7 +493,7 @@ void _MD_Suspend(PRThread *thr) /* XXX Primordial thread can't be bound to an lwp, hence there is no * way we can assume that we can get the lwp status for primordial * thread reliably. Hence we skip this for primordial thread, hoping - * that the SP is saved during lock and cond. wait. + * that the SP is saved during lock and cond. wait. * XXX - Again this is concern only for java interpreter, not for the * server, 'cause primordial thread in the server does not do java work */ @@ -518,7 +518,7 @@ void _MD_Resume(PRThread *thr) } if (thr->md.lwpid == -1) return; - + if ( _lwp_continue(thr->md.lwpid) < 0) { PR_ASSERT(0); /* ARGH, we are hosed! */ } @@ -540,7 +540,7 @@ int _pr_unixware_clock_gettime (struct timespec *tp) { struct timeval tv; - + gettimeofday(&tv, NULL); tp->tv_sec = tv.tv_sec; tp->tv_nsec = tv.tv_usec * 1000; diff --git a/pr/src/md/unix/uxpoll.c b/pr/src/md/unix/uxpoll.c index 8a618ed8..101ff3f8 100644 --- a/pr/src/md/unix/uxpoll.c +++ b/pr/src/md/unix/uxpoll.c @@ -419,14 +419,14 @@ retry: out_flags |= PR_POLL_READ; if (pd->out_flags & _PR_POLL_WRITE_SYS_READ) out_flags |= PR_POLL_WRITE; - } + } if (FD_ISSET(osfd, &wt)) { if (pd->out_flags & _PR_POLL_READ_SYS_WRITE) out_flags |= PR_POLL_READ; if (pd->out_flags & _PR_POLL_WRITE_SYS_WRITE) out_flags |= PR_POLL_WRITE; - } + } if (FD_ISSET(osfd, &ex)) out_flags |= PR_POLL_EXCEPT; } pd->out_flags = out_flags; @@ -670,7 +670,7 @@ PRInt32 _MD_pr_poll(PRPollDesc *pds, PRIntn npds, PRIntervalTime timeout) return rv; } /* _MD_pr_poll */ -#endif /* defined(_PR_PTHREADS) */ +#endif /* defined(_PR_PTHREADS) */ /* uxpoll.c */ diff --git a/pr/src/md/unix/uxproces.c b/pr/src/md/unix/uxproces.c index c4c5b8da..8665992f 100644 --- a/pr/src/md/unix/uxproces.c +++ b/pr/src/md/unix/uxproces.c @@ -555,7 +555,7 @@ static void WaitPidDaemonThread(void *unused) /* * waitpid() cannot return 0 because we did not invoke it * with the WNOHANG option. - */ + */ PR_ASSERT(0 != pid); /* @@ -612,7 +612,7 @@ static void WaitPidDaemonThread(void *unused) } PR_Lock(pr_wp.ml); #endif - + do { rv = read(pr_wp.pipefd[0], buf, sizeof(buf)); } while (sizeof(buf) == rv || (-1 == rv && EINTR == errno)); diff --git a/pr/src/md/unix/uxrng.c b/pr/src/md/unix/uxrng.c index 4eeb9bdc..36638f8e 100644 --- a/pr/src/md/unix/uxrng.c +++ b/pr/src/md/unix/uxrng.c @@ -100,7 +100,7 @@ static size_t GetDevURandom( void *buf, size_t size ) static size_t GetHighResClock(void *buf, size_t maxbytes) -{ +{ return(GetDevURandom( buf, maxbytes )); } diff --git a/pr/src/md/unix/uxshm.c b/pr/src/md/unix/uxshm.c index 2a605b1f..92bd5b9f 100644 --- a/pr/src/md/unix/uxshm.c +++ b/pr/src/md/unix/uxshm.c @@ -14,7 +14,7 @@ #include <prshm.h> #include <prerr.h> #include <prmem.h> -#include "primpl.h" +#include "primpl.h" #include <fcntl.h> extern PRLogModuleInfo *_pr_shm_lm; @@ -36,7 +36,7 @@ extern PRLogModuleInfo *_pr_shm_lm; #define _MD_CLOSE_SHARED_MEMORY _MD_CloseSharedMemory #define _MD_DELETE_SHARED_MEMORY _MD_DeleteSharedMemory -extern PRSharedMemory * _MD_OpenSharedMemory( +extern PRSharedMemory * _MD_OpenSharedMemory( const char *name, PRSize size, PRIntn flags, @@ -52,16 +52,16 @@ extern PRSharedMemory * _MD_OpenSharedMemory( if ( PR_FAILURE == rc ) { _PR_MD_MAP_DEFAULT_ERROR( errno ); - PR_LOG( _pr_shm_lm, PR_LOG_DEBUG, + PR_LOG( _pr_shm_lm, PR_LOG_DEBUG, ("_MD_OpenSharedMemory(): _PR_MakeNativeIPCName() failed: %s", name )); return( NULL ); } shm = PR_NEWZAP( PRSharedMemory ); - if ( NULL == shm ) + if ( NULL == shm ) { PR_SetError(PR_OUT_OF_MEMORY_ERROR, 0 ); - PR_LOG(_pr_shm_lm, PR_LOG_DEBUG, ( "PR_OpenSharedMemory: New PRSharedMemory out of memory")); + PR_LOG(_pr_shm_lm, PR_LOG_DEBUG, ( "PR_OpenSharedMemory: New PRSharedMemory out of memory")); return( NULL ); } @@ -69,7 +69,7 @@ extern PRSharedMemory * _MD_OpenSharedMemory( if ( NULL == shm->ipcname ) { PR_SetError(PR_OUT_OF_MEMORY_ERROR, 0 ); - PR_LOG(_pr_shm_lm, PR_LOG_DEBUG, ( "PR_OpenSharedMemory: New shm->ipcname out of memory")); + PR_LOG(_pr_shm_lm, PR_LOG_DEBUG, ( "PR_OpenSharedMemory: New shm->ipcname out of memory")); PR_DELETE( shm ); return( NULL ); } @@ -89,7 +89,7 @@ extern PRSharedMemory * _MD_OpenSharedMemory( PR_FREEIF( shm->ipcname ); PR_DELETE( shm ); return( NULL ); - } + } if ( close(osfd) == -1 ) { _PR_MD_MAP_CLOSE_ERROR( errno ); PR_FREEIF( shm->ipcname ); @@ -104,7 +104,7 @@ extern PRSharedMemory * _MD_OpenSharedMemory( { rc = PR_FAILURE; _PR_MD_MAP_DEFAULT_ERROR( errno ); - PR_LOG( _pr_shm_lm, PR_LOG_DEBUG, + PR_LOG( _pr_shm_lm, PR_LOG_DEBUG, ("_MD_OpenSharedMemory(): ftok() failed on name: %s", shm->ipcname)); PR_FREEIF( shm->ipcname ); PR_DELETE( shm ); @@ -119,18 +119,18 @@ extern PRSharedMemory * _MD_OpenSharedMemory( } if ((errno == EEXIST) && (flags & PR_SHM_EXCL)) { PR_SetError( PR_FILE_EXISTS_ERROR, errno ); - PR_LOG( _pr_shm_lm, PR_LOG_DEBUG, + PR_LOG( _pr_shm_lm, PR_LOG_DEBUG, ("_MD_OpenSharedMemory(): shmget() exclusive failed, errno: %d", errno)); PR_FREEIF(shm->ipcname); PR_DELETE(shm); return(NULL); } - } + } shm->id = shmget( key, shm->size, shm->mode ); if ( -1 == shm->id ) { _PR_MD_MAP_DEFAULT_ERROR( errno ); - PR_LOG( _pr_shm_lm, PR_LOG_DEBUG, + PR_LOG( _pr_shm_lm, PR_LOG_DEBUG, ("_MD_OpenSharedMemory(): shmget() failed, errno: %d", errno)); PR_FREEIF(shm->ipcname); PR_DELETE(shm); @@ -153,14 +153,14 @@ extern void * _MD_AttachSharedMemory( PRSharedMemory *shm, PRIntn flags ) if ( (void*)-1 == addr ) { _PR_MD_MAP_DEFAULT_ERROR( errno ); - PR_LOG( _pr_shm_lm, PR_LOG_DEBUG, - ("_MD_AttachSharedMemory(): shmat() failed on name: %s, OsError: %d", + PR_LOG( _pr_shm_lm, PR_LOG_DEBUG, + ("_MD_AttachSharedMemory(): shmat() failed on name: %s, OsError: %d", shm->ipcname, PR_GetOSError() )); addr = NULL; } return addr; -} +} extern PRStatus _MD_DetachSharedMemory( PRSharedMemory *shm, void *addr ) { @@ -174,12 +174,12 @@ extern PRStatus _MD_DetachSharedMemory( PRSharedMemory *shm, void *addr ) { rc = PR_FAILURE; _PR_MD_MAP_DEFAULT_ERROR( errno ); - PR_LOG( _pr_shm_lm, PR_LOG_DEBUG, + PR_LOG( _pr_shm_lm, PR_LOG_DEBUG, ("_MD_DetachSharedMemory(): shmdt() failed on name: %s", shm->ipcname )); } return rc; -} +} extern PRStatus _MD_CloseSharedMemory( PRSharedMemory *shm ) { @@ -189,7 +189,7 @@ extern PRStatus _MD_CloseSharedMemory( PRSharedMemory *shm ) PR_DELETE(shm); return PR_SUCCESS; -} +} extern PRStatus _MD_DeleteSharedMemory( const char *name ) { @@ -203,18 +203,18 @@ extern PRStatus _MD_DeleteSharedMemory( const char *name ) if ( PR_FAILURE == rc ) { PR_SetError( PR_UNKNOWN_ERROR , errno ); - PR_LOG( _pr_shm_lm, PR_LOG_DEBUG, + PR_LOG( _pr_shm_lm, PR_LOG_DEBUG, ("_MD_DeleteSharedMemory(): _PR_MakeNativeIPCName() failed: %s", name )); return(PR_FAILURE); } - /* create the file first */ + /* create the file first */ { int osfd = open( ipcname, (O_RDWR | O_CREAT), 0666 ); if ( -1 == osfd ) { _PR_MD_MAP_OPEN_ERROR( errno ); return( PR_FAILURE ); - } + } if ( close(osfd) == -1 ) { _PR_MD_MAP_CLOSE_ERROR( errno ); return( PR_FAILURE ); @@ -227,14 +227,14 @@ extern PRStatus _MD_DeleteSharedMemory( const char *name ) { rc = PR_FAILURE; _PR_MD_MAP_DEFAULT_ERROR( errno ); - PR_LOG( _pr_shm_lm, PR_LOG_DEBUG, + PR_LOG( _pr_shm_lm, PR_LOG_DEBUG, ("_MD_DeleteSharedMemory(): ftok() failed on name: %s", ipcname)); } id = shmget( key, 0, 0 ); if ( -1 == id ) { _PR_MD_MAP_DEFAULT_ERROR( errno ); - PR_LOG( _pr_shm_lm, PR_LOG_DEBUG, + PR_LOG( _pr_shm_lm, PR_LOG_DEBUG, ("_MD_DeleteSharedMemory(): shmget() failed, errno: %d", errno)); return(PR_FAILURE); } @@ -243,7 +243,7 @@ extern PRStatus _MD_DeleteSharedMemory( const char *name ) if ( -1 == urc ) { _PR_MD_MAP_DEFAULT_ERROR( errno ); - PR_LOG( _pr_shm_lm, PR_LOG_DEBUG, + PR_LOG( _pr_shm_lm, PR_LOG_DEBUG, ("_MD_DeleteSharedMemory(): shmctl() failed on name: %s", ipcname )); return(PR_FAILURE); } @@ -251,7 +251,7 @@ extern PRStatus _MD_DeleteSharedMemory( const char *name ) urc = unlink( ipcname ); if ( -1 == urc ) { _PR_MD_MAP_UNLINK_ERROR( errno ); - PR_LOG( _pr_shm_lm, PR_LOG_DEBUG, + PR_LOG( _pr_shm_lm, PR_LOG_DEBUG, ("_MD_DeleteSharedMemory(): unlink() failed: %s", ipcname )); return(PR_FAILURE); } @@ -275,7 +275,7 @@ struct _MDSharedMemory { int handle; }; -extern PRSharedMemory * _MD_OpenSharedMemory( +extern PRSharedMemory * _MD_OpenSharedMemory( const char *name, PRSize size, PRIntn flags, @@ -291,16 +291,16 @@ extern PRSharedMemory * _MD_OpenSharedMemory( if ( PR_FAILURE == rc ) { PR_SetError( PR_UNKNOWN_ERROR , errno ); - PR_LOG( _pr_shm_lm, PR_LOG_DEBUG, + PR_LOG( _pr_shm_lm, PR_LOG_DEBUG, ("_MD_OpenSharedMemory(): _PR_MakeNativeIPCName() failed: %s", name )); return( NULL ); } shm = PR_NEWZAP( PRSharedMemory ); - if ( NULL == shm ) + if ( NULL == shm ) { PR_SetError(PR_OUT_OF_MEMORY_ERROR, 0 ); - PR_LOG(_pr_shm_lm, PR_LOG_DEBUG, ( "PR_OpenSharedMemory: New PRSharedMemory out of memory")); + PR_LOG(_pr_shm_lm, PR_LOG_DEBUG, ( "PR_OpenSharedMemory: New PRSharedMemory out of memory")); return( NULL ); } @@ -308,13 +308,13 @@ extern PRSharedMemory * _MD_OpenSharedMemory( if ( NULL == shm->ipcname ) { PR_SetError(PR_OUT_OF_MEMORY_ERROR, 0 ); - PR_LOG(_pr_shm_lm, PR_LOG_DEBUG, ( "PR_OpenSharedMemory: New shm->ipcname out of memory")); + PR_LOG(_pr_shm_lm, PR_LOG_DEBUG, ( "PR_OpenSharedMemory: New shm->ipcname out of memory")); return( NULL ); } /* copy args to struct */ strcpy( shm->ipcname, ipcname ); - shm->size = size; + shm->size = size; shm->mode = mode; shm->flags = flags; shm->ident = _PR_SHM_IDENT; @@ -324,7 +324,7 @@ extern PRSharedMemory * _MD_OpenSharedMemory( */ if ( flags & PR_SHM_CREATE ) { int oflag = (O_CREAT | O_RDWR); - + if ( flags & PR_SHM_EXCL ) oflag |= O_EXCL; shm->id = shm_open( shm->ipcname, oflag, shm->mode ); @@ -334,9 +334,9 @@ extern PRSharedMemory * _MD_OpenSharedMemory( if ( -1 == shm->id ) { _PR_MD_MAP_DEFAULT_ERROR( errno ); - PR_LOG(_pr_shm_lm, PR_LOG_DEBUG, + PR_LOG(_pr_shm_lm, PR_LOG_DEBUG, ("_MD_OpenSharedMemory(): shm_open failed: %s, OSError: %d", - shm->ipcname, PR_GetOSError())); + shm->ipcname, PR_GetOSError())); PR_DELETE( shm->ipcname ); PR_DELETE( shm ); return(NULL); @@ -345,7 +345,7 @@ extern PRSharedMemory * _MD_OpenSharedMemory( end = ftruncate( shm->id, shm->size ); if ( -1 == end ) { _PR_MD_MAP_DEFAULT_ERROR( errno ); - PR_LOG(_pr_shm_lm, PR_LOG_DEBUG, + PR_LOG(_pr_shm_lm, PR_LOG_DEBUG, ("_MD_OpenSharedMemory(): ftruncate failed, OSError: %d", PR_GetOSError())); PR_DELETE( shm->ipcname ); @@ -370,17 +370,17 @@ extern void * _MD_AttachSharedMemory( PRSharedMemory *shm, PRIntn flags ) if ((void*)-1 == addr ) { _PR_MD_MAP_DEFAULT_ERROR( errno ); - PR_LOG( _pr_shm_lm, PR_LOG_DEBUG, + PR_LOG( _pr_shm_lm, PR_LOG_DEBUG, ("_MD_AttachSharedMemory(): mmap failed: %s, errno: %d", shm->ipcname, PR_GetOSError())); addr = NULL; } else { - PR_LOG( _pr_shm_lm, PR_LOG_DEBUG, + PR_LOG( _pr_shm_lm, PR_LOG_DEBUG, ("_MD_AttachSharedMemory(): name: %s, attached at: %p", shm->ipcname, addr)); } - + return addr; -} +} extern PRStatus _MD_DetachSharedMemory( PRSharedMemory *shm, void *addr ) { @@ -394,30 +394,30 @@ extern PRStatus _MD_DetachSharedMemory( PRSharedMemory *shm, void *addr ) { rc = PR_FAILURE; _PR_MD_MAP_DEFAULT_ERROR( errno ); - PR_LOG( _pr_shm_lm, PR_LOG_DEBUG, - ("_MD_DetachSharedMemory(): munmap failed: %s, errno: %d", + PR_LOG( _pr_shm_lm, PR_LOG_DEBUG, + ("_MD_DetachSharedMemory(): munmap failed: %s, errno: %d", shm->ipcname, PR_GetOSError())); } return rc; -} +} extern PRStatus _MD_CloseSharedMemory( PRSharedMemory *shm ) { int urc; - + PR_ASSERT( shm->ident == _PR_SHM_IDENT ); urc = close( shm->id ); if ( -1 == urc ) { _PR_MD_MAP_CLOSE_ERROR( errno ); - PR_LOG( _pr_shm_lm, PR_LOG_DEBUG, + PR_LOG( _pr_shm_lm, PR_LOG_DEBUG, ("_MD_CloseSharedMemory(): close() failed, error: %d", PR_GetOSError())); return(PR_FAILURE); } PR_DELETE( shm->ipcname ); PR_DELETE( shm ); return PR_SUCCESS; -} +} extern PRStatus _MD_DeleteSharedMemory( const char *name ) { @@ -429,7 +429,7 @@ extern PRStatus _MD_DeleteSharedMemory( const char *name ) if ( PR_FAILURE == rc ) { PR_SetError( PR_UNKNOWN_ERROR , errno ); - PR_LOG( _pr_shm_lm, PR_LOG_DEBUG, + PR_LOG( _pr_shm_lm, PR_LOG_DEBUG, ("_MD_OpenSharedMemory(): _PR_MakeNativeIPCName() failed: %s", name )); return rc; } @@ -438,11 +438,11 @@ extern PRStatus _MD_DeleteSharedMemory( const char *name ) if ( -1 == urc ) { rc = PR_FAILURE; _PR_MD_MAP_DEFAULT_ERROR( errno ); - PR_LOG( _pr_shm_lm, PR_LOG_DEBUG, - ("_MD_DeleteSharedMemory(): shm_unlink failed: %s, errno: %d", + PR_LOG( _pr_shm_lm, PR_LOG_DEBUG, + ("_MD_DeleteSharedMemory(): shm_unlink failed: %s, errno: %d", ipcname, PR_GetOSError())); } else { - PR_LOG( _pr_shm_lm, PR_LOG_DEBUG, + PR_LOG( _pr_shm_lm, PR_LOG_DEBUG, ("_MD_DeleteSharedMemory(): %s, success", ipcname)); } @@ -459,7 +459,7 @@ extern PRLogModuleInfo *_pr_shma_lm; #include <unistd.h> -extern PRFileMap* _md_OpenAnonFileMap( +extern PRFileMap* _md_OpenAnonFileMap( const char *dirName, PRSize size, PRFileMapProtect prot @@ -526,7 +526,7 @@ extern PRFileMap* _md_OpenAnonFileMap( ("_md_OpenAnonFileMap(): failed on unlink(), errno: %d", errno)); PR_smprintf_free( genName ); close( osfd ); - goto Finished; + goto Finished; } PR_LOG( _pr_shma_lm, PR_LOG_DEBUG, ("_md_OpenAnonFileMap(): unlink(): %s", genName )); @@ -537,7 +537,7 @@ extern PRFileMap* _md_OpenAnonFileMap( if ( NULL == fd ) { PR_LOG( _pr_shma_lm, PR_LOG_DEBUG, ("_md_OpenAnonFileMap(): PR_ImportFile(): failed")); - goto Finished; + goto Finished; } PR_LOG( _pr_shma_lm, PR_LOG_DEBUG, ("_md_OpenAnonFileMap(): fd: %p", fd )); @@ -548,7 +548,7 @@ extern PRFileMap* _md_OpenAnonFileMap( PR_LOG( _pr_shma_lm, PR_LOG_DEBUG, ("_md_OpenAnonFileMap(): failed on ftruncate(), errno: %d", errno)); PR_Close( fd ); - goto Finished; + goto Finished; } PR_LOG( _pr_shma_lm, PR_LOG_DEBUG, ("_md_OpenAnonFileMap(): ftruncate(): size: %d", size )); @@ -559,14 +559,14 @@ extern PRFileMap* _md_OpenAnonFileMap( PR_LOG( _pr_shma_lm, PR_LOG_DEBUG, ("PR_OpenAnonFileMap(): failed")); PR_Close( fd ); - goto Finished; + goto Finished; } fm->md.isAnonFM = PR_TRUE; /* set fd close */ PR_LOG( _pr_shma_lm, PR_LOG_DEBUG, ("_md_OpenAnonFileMap(): PR_CreateFileMap(): fm: %p", fm )); -Finished: +Finished: return(fm); } /* end md_OpenAnonFileMap() */ @@ -583,10 +583,10 @@ extern PRStatus _md_ExportFileMapAsString( { PRIntn written; PRIntn prot = (PRIntn)fm->prot; - + written = PR_snprintf( buf, bufSize, "%ld:%d", fm->fd->secret->md.osfd, prot ); - + return((written == -1)? PR_FAILURE : PR_SUCCESS); } /* end _md_ExportFileMapAsString() */ @@ -615,14 +615,14 @@ extern PRFileMap * _md_ImportFileMapFromString( rc = PR_GetOpenFileInfo64( fd, &info ); if ( PR_FAILURE == rc ) { PR_LOG( _pr_shma_lm, PR_LOG_DEBUG, - ("_md_ImportFileMapFromString(): PR_GetOpenFileInfo64() failed")); + ("_md_ImportFileMapFromString(): PR_GetOpenFileInfo64() failed")); goto Finished; } fm = PR_CreateFileMap( fd, info.size, (PRFileMapProtect)prot ); if ( NULL == fm ) { PR_LOG( _pr_shma_lm, PR_LOG_DEBUG, - ("_md_ImportFileMapFromString(): PR_CreateFileMap() failed")); + ("_md_ImportFileMapFromString(): PR_CreateFileMap() failed")); } Finished: diff --git a/pr/src/md/unix/uxwrap.c b/pr/src/md/unix/uxwrap.c index e03b030a..70569229 100644 --- a/pr/src/md/unix/uxwrap.c +++ b/pr/src/md/unix/uxwrap.c @@ -32,11 +32,11 @@ /* see comments in ns/cmd/xfe/mozilla.c (look for "PR_XGetXtHackFD") */ static int _pr_xt_hack_fd = -1; - + int PR_XGetXtHackFD(void) { int fds[2]; - + if (_pr_xt_hack_fd == -1) { if (!pipe(fds)) { _pr_xt_hack_fd = fds[0]; @@ -49,7 +49,7 @@ static int (*_pr_xt_hack_okayToReleaseXLock)(void) = 0; void PR_SetXtHackOkayToReleaseXLockFn(int (*fn)(void)) { - _pr_xt_hack_okayToReleaseXLock = fn; + _pr_xt_hack_okayToReleaseXLock = fn; } @@ -103,10 +103,10 @@ int select(int width, fd_set *rd, fd_set *wr, fd_set *ex, struct timeval *tv) if (!_pr_initialized) { _PR_ImplicitInitialization(); } - + #ifndef _PR_LOCAL_THREADS_ONLY if (_PR_IS_NATIVE_THREAD(_PR_MD_CURRENT_THREAD())) { - return _MD_SELECT(width, rd, wr, ex, tv); + return _MD_SELECT(width, rd, wr, ex, tv); } #endif @@ -184,7 +184,7 @@ int select(int width, fd_set *rd, fd_set *wr, fd_set *ex, struct timeval *tv) */ { int needToLockXAgain; - + needToLockXAgain = 0; if (rd && (_pr_xt_hack_fd != -1) && FD_ISSET(_pr_xt_hack_fd, rd) && PR_XIsLocked() @@ -281,7 +281,7 @@ int select(int width, fd_set *rd, fd_set *wr, fd_set *ex, struct timeval *tv) *----------------------------------------------------------------------- * poll() -- * - * RETURN VALUES: + * RETURN VALUES: * -1: fails, errno indicates the error. * 0: timed out, the revents bitmasks are not set. * positive value: the number of file descriptors for which poll() diff --git a/pr/src/md/windows/ntgc.c b/pr/src/md/windows/ntgc.c index 55ac92fb..20ad8a81 100644 --- a/pr/src/md/windows/ntgc.c +++ b/pr/src/md/windows/ntgc.c @@ -10,7 +10,7 @@ #include <windows.h> #include "primpl.h" -PRWord *_MD_HomeGCRegisters(PRThread *t, int isCurrent, int *np) +PRWord *_MD_HomeGCRegisters(PRThread *t, int isCurrent, int *np) { #if defined(_X86_) CONTEXT context; @@ -34,8 +34,8 @@ PRWord *_MD_HomeGCRegisters(PRThread *t, int isCurrent, int *np) } else { /* WARNING WARNING WARNING WARNING WARNING WARNING WARNING * - * This code is extremely machine dependant and completely - * undocumented by MS. Its only known to work experimentally. + * This code is extremely machine dependant and completely + * undocumented by MS. Its only known to work experimentally. * Ready for a walk on the wild * side? * * WARNING WARNING WARNING WARNING WARNING WARNING WARNING */ @@ -47,7 +47,7 @@ PRWord *_MD_HomeGCRegisters(PRThread *t, int isCurrent, int *np) * Are your palms sweating yet? */ - /* + /* ** EAX is on the stack (ESP+0) ** EDX is on the stack (ESP+4) ** ECX is on the stack (ESP+8) @@ -71,7 +71,7 @@ PRWord *_MD_HomeGCRegisters(PRThread *t, int isCurrent, int *np) } /* This function is not used right now, but is left as a reference. - * If you ever need to get the fiberID from the currently running fiber, + * If you ever need to get the fiberID from the currently running fiber, * this is it. */ void * @@ -81,15 +81,15 @@ GetMyFiberID() void *fiberData; /* A pointer to our tib entry is found at FS:[18] - * At offset 10h is the fiberData pointer. The context of the - * fiber is stored in there. + * At offset 10h is the fiberData pointer. The context of the + * fiber is stored in there. */ __asm { mov EDX, FS:[18h] mov EAX, DWORD PTR [EDX+10h] mov [fiberData], EAX } - + return fiberData; #else PR_NOT_REACHED("not implemented"); diff --git a/pr/src/md/windows/ntinrval.c b/pr/src/md/windows/ntinrval.c index 10aca11b..1e99c4c8 100644 --- a/pr/src/md/windows/ntinrval.c +++ b/pr/src/md/windows/ntinrval.c @@ -33,7 +33,7 @@ _PR_MD_INTERVAL_INIT() #endif } -PRIntervalTime +PRIntervalTime _PR_MD_GET_INTERVAL() { /* milliseconds since system start */ @@ -44,7 +44,7 @@ _PR_MD_GET_INTERVAL() #endif } -PRIntervalTime +PRIntervalTime _PR_MD_INTERVAL_PER_SEC() { return 1000; diff --git a/pr/src/md/windows/ntio.c b/pr/src/md/windows/ntio.c index aba53dc8..105fdecb 100644 --- a/pr/src/md/windows/ntio.c +++ b/pr/src/md/windows/ntio.c @@ -9,7 +9,7 @@ * For LOCAL_SCOPE threads, we're using NT fibers. For GLOBAL_SCOPE threads * we're using NT-native threads. * - * When doing IO, we want to use completion ports for optimal performance + * When doing IO, we want to use completion ports for optimal performance * with fibers. But if we use completion ports for all IO, it is difficult * to project a blocking model with GLOBAL_SCOPE threads. To handle this * we create an extra thread for completing IO for GLOBAL_SCOPE threads. @@ -32,9 +32,9 @@ static PRThread *_pr_io_completion_thread; #define RECYCLE_SIZE 512 static struct _MDLock _pr_recycle_lock; static PRInt32 _pr_recycle_INET_array[RECYCLE_SIZE]; -static PRInt32 _pr_recycle_INET_tail = 0; +static PRInt32 _pr_recycle_INET_tail = 0; static PRInt32 _pr_recycle_INET6_array[RECYCLE_SIZE]; -static PRInt32 _pr_recycle_INET6_tail = 0; +static PRInt32 _pr_recycle_INET6_tail = 0; __declspec(thread) PRThread *_pr_io_restarted_io = NULL; DWORD _pr_io_restartedIOIndex; /* The thread local storage slot for each @@ -97,14 +97,14 @@ static PRInt32 _nt_nonblock_recvfrom(PRFileDesc *, char *, int, struct sockaddr * An inheritable fd cannot be associated with an I/O completion port * because the completion notification of async I/O initiated by the * child process is still posted to the I/O completion port in the - * parent process. + * parent process. */ #define _NT_USE_NB_IO(fd) \ ((fd)->secret->nonblocking || (fd)->secret->inheritable == _PR_TRI_TRUE) /* * UDP support - * + * * UDP is supported on NT by the continuation thread mechanism. * The code is borrowed from ptio.c in pthreads nspr, hence the * PT and pt prefixes. This mechanism is in fact general and @@ -139,7 +139,7 @@ struct pt_Continuation union { PRIntn amount; } arg3; /* #3 - size of 'buffer' */ union { PRIntn flags; } arg4; /* #4 - read/write flags */ union { PRNetAddr *addr; } arg5; /* #5 - send/recv address */ - + PRIntervalTime timeout; /* representation of the timeout */ PRIntn event; /* flags for select()'s events */ @@ -218,7 +218,7 @@ _PR_MD_PAUSE_CPU(PRIntervalTime ticks) if ( !_PR_IS_NATIVE_THREAD(deadThread) ){ /* Spinlock while user thread is still running. * There is no way to use a condition variable here. The thread - * is dead, and we have to wait until we switch off the dead + * is dead, and we have to wait until we switch off the dead * thread before we can kill the fiber completely. */ while ( deadThread->no_sched) @@ -248,7 +248,7 @@ _PR_MD_PAUSE_CPU(PRIntervalTime ticks) */ timeout = 5000; #endif - else + else timeout = PR_IntervalToMilliseconds(ticks); /* @@ -261,7 +261,7 @@ _PR_MD_PAUSE_CPU(PRIntervalTime ticks) &bytes, &key, &olp, - timeout); + timeout); if (rv == 0 && olp == NULL) { /* Error in GetQueuedCompetionStatus */ if (GetLastError() != WAIT_TIMEOUT) { @@ -273,7 +273,7 @@ _PR_MD_PAUSE_CPU(PRIntervalTime ticks) } } - if (olp == NULL) + if (olp == NULL) return 0; mdOlp = (_MDOverlapped *)olp; @@ -354,7 +354,7 @@ _PR_MD_PAUSE_CPU(PRIntervalTime ticks) /* The KEY_CVAR notification only occurs when a native thread * is notifying a user thread. For user-user notifications - * the wakeup occurs by having the notifier place the thread + * the wakeup occurs by having the notifier place the thread * on the runq directly; for native-native notifications the * wakeup occurs by calling ReleaseSemaphore. */ @@ -648,7 +648,7 @@ _native_thread_io_wait(PRThread *thread, PRIntervalTime ticks) break; case WAIT_OBJECT_0 + _NATIVE_WAKEUP_EVENT_INDEX: /* - * I/O interrupted; + * I/O interrupted; */ #ifdef DEBUG _PR_THREAD_LOCK(thread); @@ -696,7 +696,7 @@ _NT_IO_WAIT(PRThread *thread, PRIntervalTime timeout) _PR_THREAD_LOCK(thread); - /* The IO may have already completed; if so, don't add to sleepQ, + /* The IO may have already completed; if so, don't add to sleepQ, * since we are already on the runQ! */ if (thread->io_pending == PR_TRUE) { @@ -724,7 +724,7 @@ void _PR_Unblock_IO_Wait(PRThread *thr) { PRStatus rv; _PRCPU *cpu = thr->cpu; - + PR_ASSERT(thr->state == _PR_IO_WAIT); /* * A thread for which an I/O timed out or was interrupted cannot be @@ -776,10 +776,10 @@ _NT_ResumeIO(PRThread *thread, PRIntervalTime ticks) if (!thread->io_pending) fWait = PR_FALSE; thread->io_suspended = PR_FALSE; - + _PR_THREAD_UNLOCK(thread); } - /* We don't put ourselves back on the sleepQ yet; until we + /* We don't put ourselves back on the sleepQ yet; until we * set the suspended bit to false, we can't do that. Just save * the sleep time here, and then continue. The restarted_io handler * will add us to the sleepQ if needed. @@ -800,10 +800,10 @@ _PR_MD_WAKEUP_WAITER(PRThread *thread) { if (thread == NULL) { /* If thread is NULL, we aren't waking a thread, we're just poking - * idle thread + * idle thread */ - if ( PostQueuedCompletionStatus(_pr_completion_port, 0, - KEY_CVAR, NULL) == FALSE) + if ( PostQueuedCompletionStatus(_pr_completion_port, 0, + KEY_CVAR, NULL) == FALSE) return PR_FAILURE; return PR_SUCCESS; } @@ -818,17 +818,17 @@ _PR_MD_WAKEUP_WAITER(PRThread *thread) /* When a Native thread has to awaken a user thread, it has to poke * the completion port because all user threads might be idle, and - * thus the CPUs are just waiting for a completion. + * thus the CPUs are just waiting for a completion. * - * XXXMB - can we know when we are truely idle (and not checking + * XXXMB - can we know when we are truely idle (and not checking * the runq)? */ if ((_PR_IS_NATIVE_THREAD(me) || (thread->cpu != me->cpu)) && (!thread->md.thr_bound_cpu)) { /* The thread should not be in any queue */ PR_ASSERT(thread->queueCount == 0); - if ( PostQueuedCompletionStatus(_pr_completion_port, 0, - KEY_CVAR, &(thread->md.overlapped.overlapped)) == FALSE) + if ( PostQueuedCompletionStatus(_pr_completion_port, 0, + KEY_CVAR, &(thread->md.overlapped.overlapped)) == FALSE) return PR_FAILURE; } return PR_SUCCESS; @@ -845,12 +845,12 @@ _PR_MD_INIT_IO() err = WSAStartup( WSAVersion, &WSAData ); PR_ASSERT(0 == err); - - _pr_completion_port = CreateIoCompletionPort(INVALID_HANDLE_VALUE, - NULL, - 0, + + _pr_completion_port = CreateIoCompletionPort(INVALID_HANDLE_VALUE, + NULL, + 0, 0); - + _MD_NEW_LOCK(&_pr_recycle_lock); _MD_NEW_LOCK(&_pr_ioq_lock); @@ -860,7 +860,7 @@ _PR_MD_INIT_IO() if (OSversion.dwMajorVersion >= 4) { _nt_version_gets_lockfile_completion = PR_TRUE; } - } else + } else PR_ASSERT(0); #ifdef _NEED_351_FILE_LOCKING_HACK @@ -972,7 +972,7 @@ _md_put_recycled_socket(SOCKET newsock, int af) _MD_UNLOCK(&_pr_recycle_lock); closesocket(newsock); } - + return; } @@ -986,8 +986,8 @@ _md_Associate(HANDLE file) HANDLE port; if (!_native_threads_only) { - port = CreateIoCompletionPort((HANDLE)file, - _pr_completion_port, + port = CreateIoCompletionPort((HANDLE)file, + _pr_completion_port, KEY_IO, 0); @@ -1026,7 +1026,7 @@ _NT_IO_ABORT(PROsfd sock) int loop_count; /* This is a clumsy way to abort the IO, but it is all we can do. - * It looks a bit racy, but we handle all the cases. + * It looks a bit racy, but we handle all the cases. * case 1: IO completes before calling closesocket * case 1a: fWait is set to PR_FALSE * This should e the most likely case. We'll properly @@ -1147,7 +1147,7 @@ _PR_MD_connect_thread(void *cdata) PRInt32 -_PR_MD_CONNECT(PRFileDesc *fd, const PRNetAddr *addr, PRUint32 addrlen, +_PR_MD_CONNECT(PRFileDesc *fd, const PRNetAddr *addr, PRUint32 addrlen, PRIntervalTime timeout) { PROsfd osfd = fd->secret->md.osfd; @@ -1207,7 +1207,7 @@ _PR_MD_BIND(PRFileDesc *fd, const PRNetAddr *addr, PRUint32 addrlen) #if 0 /* Disable nagle- so far unknown if this is good or not... */ - rv = setsockopt(fd->secret->md.osfd, + rv = setsockopt(fd->secret->md.osfd, SOL_SOCKET, TCP_NODELAY, (const char *)&one, @@ -1221,19 +1221,19 @@ _PR_MD_BIND(PRFileDesc *fd, const PRNetAddr *addr, PRUint32 addrlen) void _PR_MD_UPDATE_ACCEPT_CONTEXT(PROsfd accept_sock, PROsfd listen_sock) { /* Sockets accept()'d with AcceptEx need to call this setsockopt before - * calling anything other than ReadFile(), WriteFile(), send(), recv(), - * Transmitfile(), and closesocket(). In order to call any other + * calling anything other than ReadFile(), WriteFile(), send(), recv(), + * Transmitfile(), and closesocket(). In order to call any other * winsock functions, we have to make this setsockopt call. * * XXXMB - For the server, we *NEVER* need this in * the "normal" code path. But now we have to call it. This is a waste - * of a system call. We'd like to only call it before calling the + * of a system call. We'd like to only call it before calling the * obscure socket calls, but since we don't know at that point what the * original socket was (or even if it is still alive) we can't do it - * at that point... + * at that point... */ - setsockopt((SOCKET)accept_sock, - SOL_SOCKET, + setsockopt((SOCKET)accept_sock, + SOL_SOCKET, SO_UPDATE_ACCEPT_CONTEXT, (char *)&listen_sock, sizeof(listen_sock)); @@ -1243,7 +1243,7 @@ void _PR_MD_UPDATE_ACCEPT_CONTEXT(PROsfd accept_sock, PROsfd listen_sock) #define INET_ADDR_PADDED (sizeof(PRNetAddr) + 16) PROsfd _PR_MD_FAST_ACCEPT(PRFileDesc *fd, PRNetAddr *raddr, PRUint32 *rlen, - PRIntervalTime timeout, PRBool fast, + PRIntervalTime timeout, PRBool fast, _PR_AcceptTimeoutCallback callback, void *callbackArg) { PROsfd osfd = fd->secret->md.osfd; @@ -1393,9 +1393,9 @@ _PR_MD_FAST_ACCEPT(PRFileDesc *fd, PRNetAddr *raddr, PRUint32 *rlen, } PRInt32 -_PR_MD_FAST_ACCEPT_READ(PRFileDesc *sd, PROsfd *newSock, PRNetAddr **raddr, - void *buf, PRInt32 amount, PRIntervalTime timeout, - PRBool fast, _PR_AcceptTimeoutCallback callback, +_PR_MD_FAST_ACCEPT_READ(PRFileDesc *sd, PROsfd *newSock, PRNetAddr **raddr, + void *buf, PRInt32 amount, PRIntervalTime timeout, + PRBool fast, _PR_AcceptTimeoutCallback callback, void *callbackArg) { PROsfd sock = sd->secret->md.osfd; @@ -1481,7 +1481,7 @@ retry: PR_ASSERT(timeout != PR_INTERVAL_NO_TIMEOUT); - err = getsockopt(*newSock, + err = getsockopt(*newSock, SOL_SOCKET, SO_CONNECT_TIME, (char *)&seconds, @@ -1489,9 +1489,9 @@ retry: if ( err == NO_ERROR ) { PRIntervalTime elapsed = PR_SecondsToInterval(seconds); - if (seconds == 0xffffffff) + if (seconds == 0xffffffff) isConnected = PR_FALSE; - else + else isConnected = PR_TRUE; if (!isConnected) { @@ -1527,9 +1527,9 @@ retry: PR_ASSERT(me->io_pending == PR_FALSE); PR_ASSERT(me->io_suspended == PR_FALSE); PR_ASSERT(me->md.thr_bound_cpu == NULL); - /* If the IO is still suspended, it means we didn't get any + /* If the IO is still suspended, it means we didn't get any * completion from NT_IO_WAIT. This is not disasterous, I hope, - * but it may mean we still have an IO outstanding... Try to + * but it may mean we still have an IO outstanding... Try to * recover by just allowing ourselves to continue. */ me->io_suspended = PR_FALSE; @@ -1554,7 +1554,7 @@ retry: return -1; } - if (!fast) + if (!fast) _PR_MD_UPDATE_ACCEPT_CONTEXT((SOCKET)*newSock, (SOCKET)sock); /* IO is done */ @@ -1677,7 +1677,7 @@ _PR_MD_SENDFILE(PRFileDesc *sock, PRSendFileData *sfd, } PRInt32 -_PR_MD_RECV(PRFileDesc *fd, void *buf, PRInt32 amount, PRIntn flags, +_PR_MD_RECV(PRFileDesc *fd, void *buf, PRInt32 amount, PRIntn flags, PRIntervalTime timeout) { PROsfd osfd = fd->secret->md.osfd; @@ -1722,7 +1722,7 @@ _PR_MD_RECV(PRFileDesc *fd, void *buf, PRInt32 amount, PRIntn flags, me->io_fd = osfd; rv = ReadFile((HANDLE)osfd, - buf, + buf, amount, &bytes, &(me->md.overlapped.overlapped)); @@ -1821,7 +1821,7 @@ _PR_MD_SEND(PRFileDesc *fd, const void *buf, PRInt32 amount, PRIntn flags, me->io_fd = osfd; rv = WriteFile((HANDLE)osfd, - buf, + buf, amount, &bytes, &(me->md.overlapped.overlapped)); @@ -1927,7 +1927,7 @@ _PR_MD_WRITEV(PRFileDesc *fd, const PRIOVec *iov, PRInt32 iov_size, PRIntervalTi for (index=0; index<iov_size; index++) { rv = _PR_MD_SEND(fd, iov[index].iov_base, iov[index].iov_len, 0, timeout); - if (rv > 0) + if (rv > 0) sent += rv; if ( rv != iov[index].iov_len ) { if (sent <= 0) @@ -1996,7 +1996,7 @@ _PR_MD_GETPEERNAME(PRFileDesc *fd, PRNetAddr *addr, PRUint32 *len) * Determine if the socket is connected. */ - rv = getsockopt(fd->secret->md.osfd, + rv = getsockopt(fd->secret->md.osfd, SOL_SOCKET, SO_CONNECT_TIME, (char *) &seconds, @@ -2013,7 +2013,7 @@ _PR_MD_GETPEERNAME(PRFileDesc *fd, PRNetAddr *addr, PRUint32 *len) _PR_MD_MAP_GETSOCKOPT_ERROR(WSAGetLastError()); return PR_FAILURE; } - } else { + } else { rv = getpeername((SOCKET)fd->secret->md.osfd, (struct sockaddr *) addr, len); if (rv == 0) { @@ -2062,9 +2062,9 @@ _PR_MD_OPEN(const char *name, PRIntn osflags, PRIntn mode) PRInt32 access = 0; PRInt32 flags = 0; PRInt32 flag6 = 0; - + if (osflags & PR_SYNC) flag6 = FILE_FLAG_WRITE_THROUGH; - + if (osflags & PR_RDONLY || osflags & PR_RDWR) access |= GENERIC_READ; if (osflags & PR_WRONLY || osflags & PR_RDWR) access |= GENERIC_WRITE; @@ -2078,11 +2078,11 @@ _PR_MD_OPEN(const char *name, PRIntn osflags, PRIntn mode) flag6 |= FILE_FLAG_OVERLAPPED; - file = CreateFile(name, - access, + file = CreateFile(name, + access, FILE_SHARE_READ|FILE_SHARE_WRITE, NULL, - flags, + flags, flag6, NULL); if (file == INVALID_HANDLE_VALUE) { @@ -2114,7 +2114,7 @@ _PR_MD_OPEN_FILE(const char *name, PRIntn osflags, PRIntn mode) PACL pACL = NULL; if (osflags & PR_SYNC) flag6 = FILE_FLAG_WRITE_THROUGH; - + if (osflags & PR_RDONLY || osflags & PR_RDWR) access |= GENERIC_READ; if (osflags & PR_WRONLY || osflags & PR_RDWR) access |= GENERIC_WRITE; @@ -2137,11 +2137,11 @@ _PR_MD_OPEN_FILE(const char *name, PRIntn osflags, PRIntn mode) lpSA = &sa; } } - file = CreateFile(name, - access, + file = CreateFile(name, + access, FILE_SHARE_READ|FILE_SHARE_WRITE, lpSA, - flags, + flags, flag6, NULL); if (lpSA != NULL) { @@ -2163,7 +2163,7 @@ _PR_MD_OPEN_FILE(const char *name, PRIntn osflags, PRIntn mode) return (PROsfd)file; } -PRInt32 +PRInt32 _PR_MD_READ(PRFileDesc *fd, void *buf, PRInt32 len) { PROsfd f = fd->secret->md.osfd; @@ -2186,10 +2186,10 @@ _PR_MD_READ(PRFileDesc *fd, void *buf, PRInt32 len) PR_ASSERT((me->md.overlapped.overlapped.Offset != 0xffffffff) || (GetLastError() == NO_ERROR)); if (fd->secret->inheritable == _PR_TRI_TRUE) { - rv = ReadFile((HANDLE)f, - (LPVOID)buf, - len, - &bytes, + rv = ReadFile((HANDLE)f, + (LPVOID)buf, + len, + &bytes, &me->md.overlapped.overlapped); if (rv != 0) { loOffset = SetFilePointer((HANDLE)f, bytes, &hiOffset, FILE_CURRENT); @@ -2235,10 +2235,10 @@ _PR_MD_READ(PRFileDesc *fd, void *buf, PRInt32 len) _PR_THREAD_UNLOCK(me); me->io_fd = f; - rv = ReadFile((HANDLE)f, - (LPVOID)buf, - len, - &bytes, + rv = ReadFile((HANDLE)f, + (LPVOID)buf, + len, + &bytes, &me->md.overlapped.overlapped); if ( (rv == 0) && ((err = GetLastError()) != ERROR_IO_PENDING) ) { _PR_THREAD_LOCK(me); @@ -2287,7 +2287,7 @@ _PR_MD_READ(PRFileDesc *fd, void *buf, PRInt32 len) } SetFilePointer((HANDLE)f, me->md.blocked_io_bytes, 0, FILE_CURRENT); - + PR_ASSERT(me->io_pending == PR_FALSE); return me->md.blocked_io_bytes; @@ -2304,7 +2304,7 @@ _PR_MD_READ(PRFileDesc *fd, void *buf, PRInt32 len) /* ERROR_HANDLE_EOF can only be returned by async io */ PR_ASSERT(err != ERROR_HANDLE_EOF); if (err == ERROR_BROKEN_PIPE) { - /* The write end of the pipe has been closed. */ + /* The write end of the pipe has been closed. */ return 0; } _PR_MD_MAP_READ_ERROR(err); @@ -2338,10 +2338,10 @@ _PR_MD_WRITE(PRFileDesc *fd, const void *buf, PRInt32 len) PR_ASSERT((me->md.overlapped.overlapped.Offset != 0xffffffff) || (GetLastError() == NO_ERROR)); if (fd->secret->inheritable == _PR_TRI_TRUE) { - rv = WriteFile((HANDLE)f, - (LPVOID)buf, - len, - &bytes, + rv = WriteFile((HANDLE)f, + (LPVOID)buf, + len, + &bytes, &me->md.overlapped.overlapped); if (rv != 0) { loOffset = SetFilePointer((HANDLE)f, bytes, &hiOffset, FILE_CURRENT); @@ -2382,10 +2382,10 @@ _PR_MD_WRITE(PRFileDesc *fd, const void *buf, PRInt32 len) _PR_THREAD_UNLOCK(me); me->io_fd = f; - rv = WriteFile((HANDLE)f, - buf, - len, - &bytes, + rv = WriteFile((HANDLE)f, + buf, + len, + &bytes, &(me->md.overlapped.overlapped)); if ( (rv == 0) && ((err = GetLastError()) != ERROR_IO_PENDING) ) { _PR_THREAD_LOCK(me); @@ -2439,7 +2439,7 @@ _PR_MD_WRITE(PRFileDesc *fd, const void *buf, PRInt32 len) offset.QuadPart += me->md.blocked_io_bytes; SetFilePointer((HANDLE)f, offset.LowPart, &offset.HighPart, FILE_BEGIN); - + PR_ASSERT(me->io_pending == PR_FALSE); return me->md.blocked_io_bytes; @@ -2608,7 +2608,7 @@ _PR_MD_CLOSE(PROsfd osfd, PRBool socket) _PR_THREAD_LOCK(me); me->state = _PR_IO_WAIT; /* The IO could have completed on another thread just after - * calling closesocket while the io_suspended flag was true. + * calling closesocket while the io_suspended flag was true. * So we now grab the lock to do a safe check on io_pending to * see if we need to wait or not. */ @@ -2655,7 +2655,7 @@ _PR_MD_SET_FD_INHERITABLE(PRFileDesc *fd, PRBool inheritable) return PR_FAILURE; } return PR_SUCCESS; -} +} void _PR_MD_INIT_FD_INHERITABLE(PRFileDesc *fd, PRBool imported) @@ -3000,7 +3000,7 @@ PRInt32 _PR_MD_GETFILEINFO64(const char *fn, PRFileInfo64 *info) { WIN32_FILE_ATTRIBUTE_DATA findFileData; - + if (NULL == fn || '\0' == *fn) { PR_SetError(PR_INVALID_ARGUMENT_ERROR, 0); return -1; @@ -3213,7 +3213,7 @@ _PR_MD_LOCKFILE(PROsfd f) me->state = _PR_IO_WAIT; _PR_THREAD_UNLOCK(me); - rv = LockFileEx((HANDLE)f, + rv = LockFileEx((HANDLE)f, LOCKFILE_EXCLUSIVE_LOCK, 0, 0x7fffffff, @@ -3249,7 +3249,7 @@ _PR_MD_LOCKFILE(PROsfd f) * * If we pretend we won't get a completion, NSPR gets confused later * when the unexpected completion arrives. If we assume we do get - * a completion, we hang on 3.51. Worse, Microsoft informs me that the + * a completion, we hang on 3.51. Worse, Microsoft informs me that the * behavior varies on 3.51 depending on if you are using a network * file system or a local disk! * @@ -3257,7 +3257,7 @@ _PR_MD_LOCKFILE(PROsfd f) * depending on whether or not this system is EITHER * - running NT 4.0 * - running NT 3.51 with a service pack greater than 5. - * + * * In the meantime, this code may not work on network file systems. * */ @@ -3279,14 +3279,14 @@ _PR_MD_LOCKFILE(PROsfd f) } #ifdef _NEED_351_FILE_LOCKING_HACK else if (rv) { - /* If this is NT 3.51 and the file is local, then we won't get a + /* If this is NT 3.51 and the file is local, then we won't get a * completion back from LockFile when it succeeded. */ if (_nt_version_gets_lockfile_completion == PR_FALSE) { if ( IsFileLocal((HANDLE)f) == _PR_LOCAL_FILE) { me->io_pending = PR_FALSE; me->state = _PR_RUNNING; - return PR_SUCCESS; + return PR_SUCCESS; } } } @@ -3332,7 +3332,7 @@ _PR_MD_TLOCKFILE(PROsfd f) me->state = _PR_IO_WAIT; _PR_THREAD_UNLOCK(me); - rv = LockFileEx((HANDLE)f, + rv = LockFileEx((HANDLE)f, LOCKFILE_FAIL_IMMEDIATELY|LOCKFILE_EXCLUSIVE_LOCK, 0, 0x7fffffff, @@ -3375,7 +3375,7 @@ _PR_MD_TLOCKFILE(PROsfd f) } #ifdef _NEED_351_FILE_LOCKING_HACK else if (rv) { - /* If this is NT 3.51 and the file is local, then we won't get a + /* If this is NT 3.51 and the file is local, then we won't get a * completion back from LockFile when it succeeded. */ if (_nt_version_gets_lockfile_completion == PR_FALSE) { @@ -3391,7 +3391,7 @@ _PR_MD_TLOCKFILE(PROsfd f) } _PR_THREAD_UNLOCK(me); - return PR_SUCCESS; + return PR_SUCCESS; } } } @@ -3465,17 +3465,17 @@ _PR_MD_MAKE_NONBLOCK(PRFileDesc *f) #ifdef _NEED_351_FILE_LOCKING_HACK /*************** -** +** ** Lockfile hacks ** ** The following code is a hack to work around a microsoft bug with lockfile. ** The problem is that on NT 3.51, if LockFileEx() succeeds, you never ** get a completion back for files that are on local disks. So, we need to -** know if a file is local or remote so we can tell if we should expect +** know if a file is local or remote so we can tell if we should expect ** a completion. ** ** The only way to check if a file is local or remote based on the handle is -** to get the serial number for the volume it is mounted on and then to +** to get the serial number for the volume it is mounted on and then to ** compare that with mounted drives. This code caches the volume numbers of ** fixed disks and does a relatively quick check. ** @@ -3550,12 +3550,12 @@ PRBool IsFileLocalInit() case DRIVE_REMOVABLE: // CDROM is a removable media - case DRIVE_CDROM: + case DRIVE_CDROM: // no idea if ramdisks can change serial numbers or not // but it doesn't hurt to treat them as removable. - - case DRIVE_RAMDISK: + + case DRIVE_RAMDISK: // Here is where we keep track of removable drives. @@ -3565,7 +3565,7 @@ PRBool IsFileLocalInit() case DRIVE_FIXED: - // cache volume serial numbers. + // cache volume serial numbers. if (GetVolumeInformation( &lpBuffer[dwIndex], NULL, 0, @@ -3577,7 +3577,7 @@ PRBool IsFileLocalInit() dwLastCachedDrive = dwDriveIndex; dwCachedVolumeSerialNumbers[dwDriveIndex] = dwVolumeSerialNumber; } - + break; } } @@ -3616,7 +3616,7 @@ PRInt32 IsFileLocal(HANDLE hFile) _MD_UNLOCK(&cachedVolumeLock); // volume serial number not found in the cache. Check removable files. - // removable drives are noted as a bitmask. If the bit associated with + // removable drives are noted as a bitmask. If the bit associated with // a specific drive is set, then we should query its volume serial number // as its possible it has changed. dwMask = dwRemoveableDrivesToCheck; @@ -3819,7 +3819,7 @@ static PRInt32 _nt_nonblock_connect(PRFileDesc *fd, struct sockaddr *addr, int a } _PR_MD_MAP_CONNECT_ERROR(err); return -1; - } + } PR_ASSERT(FD_ISSET((SOCKET)osfd, &wr)); rv = 0; } else { @@ -3946,7 +3946,7 @@ static PRInt32 _nt_nonblock_writev(PRFileDesc *fd, const PRIOVec *iov, int size, for (index=0; index<size; index++) { rv = _nt_nonblock_send(fd, iov[index].iov_base, iov[index].iov_len, timeout); - if (rv > 0) + if (rv > 0) sent += rv; if ( rv != iov[index].iov_len ) { if (rv < 0) { @@ -4110,7 +4110,7 @@ static void pt_InsertTimedInternal(pt_Continuation *op) * Subsequently earlier timeouts are computed based on the latter * knowledge by subracting the timeout deltas that are stored in * the operation list. There are operation[n]->timeout ticks - * between the expiration of operation[n-1] and operation[n].e e + * between the expiration of operation[n-1] and operation[n].e e * * Therefore, the operation[n-1] will expire operation[n]->timeout * ticks prior to operation[n]. @@ -4375,7 +4375,7 @@ static void ContinuationThread(void *arg) { if (0 == pt_tq.head->timeout) { - /* + /* * The leading element of the timed queue has timed * out. Get rid of it. In any case go around the * loop again, computing the polling list, checking diff --git a/pr/src/md/windows/ntmisc.c b/pr/src/md/windows/ntmisc.c index 12f8c1df..2413e27b 100644 --- a/pr/src/md/windows/ntmisc.c +++ b/pr/src/md/windows/ntmisc.c @@ -99,7 +99,7 @@ NowCalibrate(void) PRInt64 calibrationDelta = 0; /* * By wrapping a timeBegin/EndPeriod pair of calls around this loop, - * the loop seems to take much less time (1 ms vs 15ms) on Vista. + * the loop seems to take much less time (1 ms vs 15ms) on Vista. */ timeBeginPeriod(1); LowResTime(&ftStart); @@ -108,7 +108,7 @@ NowCalibrate(void) } while (memcmp(&ftStart,&ft, sizeof(ft)) == 0); timeEndPeriod(1); - calibration.granularity = + calibration.granularity = (FILETIME_TO_INT64(ft) - FILETIME_TO_INT64(ftStart))/10; QueryPerformanceCounter(&now); @@ -116,9 +116,9 @@ NowCalibrate(void) calibration.offset = (long double) FILETIME_TO_INT64(ft); calibration.timer_offset = (long double) now.QuadPart; /* - * The windows epoch is around 1600. The unix epoch is around 1970. + * The windows epoch is around 1600. The unix epoch is around 1970. * _pr_filetime_offset is the difference (in windows time units which - * are 10 times more highres than the JS time unit) + * are 10 times more highres than the JS time unit) */ calibration.offset -= _pr_filetime_offset; calibration.offset *= 0.1; @@ -211,7 +211,7 @@ PR_Now(void) if (calibration.offset == cachedOffset) { /* * Since calibration can take a while, make any other - * threads immediately wait + * threads immediately wait */ MUTEX_SETSPINCOUNT(&calibration.data_lock, 0); @@ -248,8 +248,8 @@ PR_Now(void) (highresTimerValue-calibration.timer_offset)/calibration.freq; cachedOffset = calibration.offset; - /* - * On some dual processor/core systems, we might get an earlier + /* + * On some dual processor/core systems, we might get an earlier * time so we cache the last time that we returned. */ calibration.last = PR_MAX(calibration.last,(PRInt64)highresTime); @@ -261,12 +261,12 @@ PR_Now(void) /* Check for clock skew */ diff = lowresTime - highresTime; - /* + /* * For some reason that I have not determined, the skew can be * up to twice a kernel tick. This does not seem to happen by * itself, but I have only seen it triggered by another program * doing some kind of file I/O. The symptoms are a negative diff - * followed by an equally large positive diff. + * followed by an equally large positive diff. */ if (fabs(diff) > 2*skewThreshold) { if (calibrated) { @@ -279,13 +279,13 @@ PR_Now(void) * resolution results for anything, so let's resort to old * behavior for this call. It's possible that in the * future, the user will want the high resolution timer, so - * we don't disable it entirely. + * we don't disable it entirely. */ returnedTime = (PRInt64)lowresTime; needsCalibration = PR_FALSE; } else { /* - * It is possible that when we recalibrate, we will return + * It is possible that when we recalibrate, we will return * a value less than what we have returned before; this is * unavoidable. We cannot tell the different between a * faulty QueryPerformanceCounter implementation and user @@ -293,7 +293,7 @@ PR_Now(void) * respect user changes to the operating system time, we * cannot maintain the invariant that Date.now() never * decreases; the old implementation has this behavior as - * well. + * well. */ needsCalibration = PR_TRUE; } @@ -323,7 +323,7 @@ PR_Now(void) GetSystemTime(&st); SystemTimeToFileTime(&st, &ft); _PR_FileTimeToPRTime(&ft, &prt); - return prt; + return prt; } #endif @@ -376,7 +376,7 @@ static int assembleCmdLine(char *const *argv, char **cmdLine) for (arg = argv; *arg; arg++) { /* Add a space to separates the arguments */ if (arg != argv) { - *p++ = ' '; + *p++ = ' '; } q = *arg; numBackslashes = 0; @@ -442,7 +442,7 @@ static int assembleCmdLine(char *const *argv, char **cmdLine) if (argNeedQuotes) { *p++ = '"'; } - } + } *p = '\0'; return 0; @@ -827,18 +827,18 @@ PRStatus _MD_WindowsGetSysInfo(PRSysInfo cmd, char *name, PRUint32 namelen) if (PR_SI_SYSNAME == cmd) (void)PR_snprintf(name, namelen, "Windows_NT"); else if (PR_SI_RELEASE == cmd) - (void)PR_snprintf(name, namelen, "%d.%d",osvi.dwMajorVersion, + (void)PR_snprintf(name, namelen, "%d.%d",osvi.dwMajorVersion, osvi.dwMinorVersion); break; case VER_PLATFORM_WIN32_WINDOWS: if (PR_SI_SYSNAME == cmd) { - if ((osvi.dwMajorVersion > 4) || + if ((osvi.dwMajorVersion > 4) || ((osvi.dwMajorVersion == 4) && (osvi.dwMinorVersion > 0))) (void)PR_snprintf(name, namelen, "Windows_98"); else (void)PR_snprintf(name, namelen, "Windows_95"); } else if (PR_SI_RELEASE == cmd) { - (void)PR_snprintf(name, namelen, "%d.%d",osvi.dwMajorVersion, + (void)PR_snprintf(name, namelen, "%d.%d",osvi.dwMajorVersion, osvi.dwMinorVersion); } break; @@ -847,7 +847,7 @@ PRStatus _MD_WindowsGetSysInfo(PRSysInfo cmd, char *name, PRUint32 namelen) if (PR_SI_SYSNAME == cmd) (void)PR_snprintf(name, namelen, "Windows_CE"); else if (PR_SI_RELEASE == cmd) - (void)PR_snprintf(name, namelen, "%d.%d",osvi.dwMajorVersion, + (void)PR_snprintf(name, namelen, "%d.%d",osvi.dwMajorVersion, osvi.dwMinorVersion); break; #endif @@ -876,7 +876,7 @@ PRStatus _MD_WindowsGetReleaseName(char *name, PRUint32 namelen) switch (osvi.dwPlatformId) { case VER_PLATFORM_WIN32_NT: case VER_PLATFORM_WIN32_WINDOWS: - (void)PR_snprintf(name, namelen, "%d.%d",osvi.dwMajorVersion, + (void)PR_snprintf(name, namelen, "%d.%d",osvi.dwMajorVersion, osvi.dwMinorVersion); break; default: @@ -960,16 +960,16 @@ void * _MD_MemMap( if ((addr = MapViewOfFile(fmap->md.hFileMap, fmap->md.dwAccess, dwHi, dwLo, len)) == NULL) { { - LPVOID lpMsgBuf; - - FormatMessage( + LPVOID lpMsgBuf; + + FormatMessage( FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM, NULL, GetLastError(), MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language (LPTSTR) &lpMsgBuf, 0, - NULL + NULL ); PR_LOG( _pr_shma_lm, PR_LOG_DEBUG, ("md_memmap(): %s", lpMsgBuf )); } @@ -1035,10 +1035,10 @@ PRStatus _MD_SyncMemMap( #pragma warning(disable: 4035) PRInt32 _PR_MD_ATOMIC_INCREMENT(PRInt32 *val) -{ +{ #if defined(__GNUC__) PRInt32 result; - asm volatile ("lock ; xadd %0, %1" + asm volatile ("lock ; xadd %0, %1" : "=r"(result), "=m"(*val) : "0"(1), "m"(*val)); return result + 1; @@ -1059,7 +1059,7 @@ PRInt32 _PR_MD_ATOMIC_DECREMENT(PRInt32 *val) { #if defined(__GNUC__) PRInt32 result; - asm volatile ("lock ; xadd %0, %1" + asm volatile ("lock ; xadd %0, %1" : "=r"(result), "=m"(*val) : "0"(-1), "m"(*val)); //asm volatile("lock ; xadd %0, %1" : "=m" (val), "=a" (result) : "-1" (1)); @@ -1082,7 +1082,7 @@ PRInt32 _PR_MD_ATOMIC_ADD(PRInt32 *intp, PRInt32 val) #if defined(__GNUC__) PRInt32 result; //asm volatile("lock ; xadd %1, %0" : "=m" (intp), "=a" (result) : "1" (val)); - asm volatile ("lock ; xadd %0, %1" + asm volatile ("lock ; xadd %0, %1" : "=r"(result), "=m"(*intp) : "0"(val), "m"(*intp)); return result + val; @@ -1102,24 +1102,24 @@ PRInt32 _PR_MD_ATOMIC_ADD(PRInt32 *intp, PRInt32 val) #ifdef _PR_HAVE_ATOMIC_CAS #pragma warning(disable: 4035) -void +void PR_StackPush(PRStack *stack, PRStackElem *stack_elem) { #if defined(__GNUC__) void **tos = (void **) stack; void *tmp; - + retry: if (*tos == (void *) -1) goto retry; - + __asm__("xchg %0,%1" : "=r" (tmp), "=m"(*tos) : "0" (-1), "m"(*tos)); - + if (tmp == (void *) -1) goto retry; - + *(void **)stack_elem = tmp; __asm__("" : : : "memory"); *tos = stack_elem; @@ -1143,24 +1143,24 @@ retry: mov eax,[ebx] #pragma warning(default: 4035) #pragma warning(disable: 4035) -PRStackElem * +PRStackElem * PR_StackPop(PRStack *stack) { #if defined(__GNUC__) void **tos = (void **) stack; void *tmp; - + retry: if (*tos == (void *) -1) goto retry; - + __asm__("xchg %0,%1" : "=r" (tmp), "=m"(*tos) : "0" (-1), "m"(*tos)); if (tmp == (void *) -1) goto retry; - + if (tmp != (void *) 0) { void *next = *(void **)tmp; @@ -1169,7 +1169,7 @@ PR_StackPop(PRStack *stack) } else *tos = tmp; - + return tmp; #else __asm @@ -1190,7 +1190,7 @@ retry: mov eax,[ebx] jmp done empty: mov [ebx],eax -done: +done: } #endif /* __GNUC__ */ } diff --git a/pr/src/md/windows/ntsem.c b/pr/src/md/windows/ntsem.c index f36a145a..716e6ef3 100644 --- a/pr/src/md/windows/ntsem.c +++ b/pr/src/md/windows/ntsem.c @@ -12,19 +12,19 @@ #include "primpl.h" -void +void _PR_MD_NEW_SEM(_MDSemaphore *md, PRUintn value) { md->sem = CreateSemaphore(NULL, value, 0x7fffffff, NULL); } -void +void _PR_MD_DESTROY_SEM(_MDSemaphore *md) { CloseHandle(md->sem); } -PRStatus +PRStatus _PR_MD_TIMED_WAIT_SEM(_MDSemaphore *md, PRIntervalTime ticks) { int rv; @@ -37,13 +37,13 @@ _PR_MD_TIMED_WAIT_SEM(_MDSemaphore *md, PRIntervalTime ticks) return PR_FAILURE; } -PRStatus +PRStatus _PR_MD_WAIT_SEM(_MDSemaphore *md) { return _PR_MD_TIMED_WAIT_SEM(md, PR_INTERVAL_NO_TIMEOUT); } -void +void _PR_MD_POST_SEM(_MDSemaphore *md) { ReleaseSemaphore(md->sem, 1, NULL); diff --git a/pr/src/md/windows/ntthread.c b/pr/src/md/windows/ntthread.c index 1fdf0e93..6dd01fb9 100644 --- a/pr/src/md/windows/ntthread.c +++ b/pr/src/md/windows/ntthread.c @@ -181,12 +181,12 @@ pr_root(void *arg) return 0; } -PRStatus -_PR_MD_CREATE_THREAD(PRThread *thread, - void (*start)(void *), - PRThreadPriority priority, - PRThreadScope scope, - PRThreadState state, +PRStatus +_PR_MD_CREATE_THREAD(PRThread *thread, + void (*start)(void *), + PRThreadPriority priority, + PRThreadScope scope, + PRThreadState state, PRUint32 stackSize) { @@ -250,14 +250,14 @@ _PR_MD_END_THREAD(void) _endthreadex(0); } -void +void _PR_MD_YIELD(void) { /* Can NT really yield at all? */ Sleep(0); } -void +void _PR_MD_SET_PRIORITY(_MDThread *thread, PRThreadPriority newPri) { int nativePri; @@ -428,7 +428,7 @@ _PR_MD_EXIT(PRIntn status) #ifdef HAVE_FIBERS void -_pr_fiber_mainline(void *unused) +_pr_fiber_mainline(void *unused) { PRThread *fiber = _PR_MD_CURRENT_THREAD(); @@ -445,7 +445,7 @@ PRThread *_PR_MD_CREATE_USER_THREAD( if ( (thread = PR_NEW(PRThread)) == NULL ) { return NULL; } - + memset(thread, 0, sizeof(PRThread)); thread->md.fiber_fn = start; thread->md.fiber_arg = arg; @@ -468,7 +468,7 @@ void _PR_MD_INIT_CONTEXT(PRThread *thread, char *top, void (*start) (void), PRBool *status) { thread->md.fiber_fn = (void (*)(void *))start; - thread->md.fiber_id = CreateFiber(thread->md.fiber_stacksize, + thread->md.fiber_id = CreateFiber(thread->md.fiber_stacksize, (LPFIBER_START_ROUTINE)_pr_fiber_mainline, NULL); if (thread->md.fiber_id != 0) *status = PR_TRUE; @@ -502,7 +502,7 @@ _PR_MD_RESTORE_CONTEXT(PRThread *thread) PR_ASSERT( !_PR_IS_NATIVE_THREAD(thread) ); /* The user-level code for yielding will happily add ourselves to the runq - * and then switch to ourselves; the NT fibers can't handle switching to + * and then switch to ourselves; the NT fibers can't handle switching to * ourselves. */ if (thread != me) { @@ -532,12 +532,12 @@ PRInt32 _PR_MD_GETTHREADAFFINITYMASK(PRThread *thread, PRUint32 *mask) PRInt32 rv, system_mask; rv = GetProcessAffinityMask(GetCurrentProcess(), mask, &system_mask); - + return rv?0:-1; } -void -_PR_MD_SUSPEND_CPU(_PRCPU *cpu) +void +_PR_MD_SUSPEND_CPU(_PRCPU *cpu) { _PR_MD_SUSPEND_THREAD(cpu->thread); } diff --git a/pr/src/md/windows/w32ipcsem.c b/pr/src/md/windows/w32ipcsem.c index 95459100..5719ce3f 100644 --- a/pr/src/md/windows/w32ipcsem.c +++ b/pr/src/md/windows/w32ipcsem.c @@ -18,13 +18,13 @@ static HANDLE OpenSemaphore(DWORD inDesiredAccess, HANDLE retval = NULL; HANDLE semaphore = NULL; PRUnichar wideName[MAX_PATH]; /* name size is limited to MAX_PATH */ - + MultiByteToWideChar(CP_ACP, 0, inName, -1, wideName, MAX_PATH); /* 0x7fffffff is the max count for our semaphore */ semaphore = CreateSemaphoreW(NULL, 0, 0x7fffffff, wideName); if (NULL != semaphore) { DWORD lastErr = GetLastError(); - + if (ERROR_ALREADY_EXISTS != lastErr) CloseHandle(semaphore); else @@ -142,7 +142,7 @@ PRSem *_PR_MD_OPEN_SEMAPHORE( #ifdef WINCE { /* The size of a sem's name is limited to MAX_PATH. */ - PRUnichar wosname[MAX_PATH]; + PRUnichar wosname[MAX_PATH]; MultiByteToWideChar(CP_ACP, 0, osname, -1, wosname, MAX_PATH); sem->sem = CreateSemaphoreW(lpSA, value, 0x7fffffff, wosname); } diff --git a/pr/src/md/windows/w32poll.c b/pr/src/md/windows/w32poll.c index daf14dfe..8a4b5157 100644 --- a/pr/src/md/windows/w32poll.c +++ b/pr/src/md/windows/w32poll.c @@ -275,14 +275,14 @@ PRInt32 _PR_MD_PR_POLL(PRPollDesc *pds, PRIntn npds, PRIntervalTime timeout) out_flags |= PR_POLL_READ; if (pd->out_flags & _PR_POLL_WRITE_SYS_READ) out_flags |= PR_POLL_WRITE; - } + } if (FD_ISSET(osfd, &wt)) { if (pd->out_flags & _PR_POLL_READ_SYS_WRITE) out_flags |= PR_POLL_READ; if (pd->out_flags & _PR_POLL_WRITE_SYS_WRITE) out_flags |= PR_POLL_WRITE; - } + } if (FD_ISSET(osfd, &ex)) out_flags |= PR_POLL_EXCEPT; } pd->out_flags = out_flags; diff --git a/pr/src/md/windows/w32shm.c b/pr/src/md/windows/w32shm.c index 8e8b1d68..748a9860 100644 --- a/pr/src/md/windows/w32shm.c +++ b/pr/src/md/windows/w32shm.c @@ -3,7 +3,7 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -#include <private/primpl.h> +#include <private/primpl.h> #include <string.h> #include <prshm.h> #include <prerr.h> @@ -23,11 +23,11 @@ extern PRLogModuleInfo *_pr_shm_lm; */ static DWORD filemapAccessTable[] = { FILE_MAP_ALL_ACCESS & ~FILE_MAP_WRITE, /* read */ - FILE_MAP_ALL_ACCESS & ~FILE_MAP_READ, /* write */ + FILE_MAP_ALL_ACCESS & ~FILE_MAP_READ, /* write */ 0 /* execute */ }; -extern PRSharedMemory * _MD_OpenSharedMemory( +extern PRSharedMemory * _MD_OpenSharedMemory( const char *name, PRSize size, PRIntn flags, @@ -48,15 +48,15 @@ extern PRSharedMemory * _MD_OpenSharedMemory( if ( PR_FAILURE == rc ) { PR_SetError(PR_UNKNOWN_ERROR, 0 ); - PR_LOG(_pr_shm_lm, PR_LOG_DEBUG, ( "PR_OpenSharedMemory: name is invalid")); + PR_LOG(_pr_shm_lm, PR_LOG_DEBUG, ( "PR_OpenSharedMemory: name is invalid")); return(NULL); } shm = PR_NEWZAP( PRSharedMemory ); - if ( NULL == shm ) + if ( NULL == shm ) { PR_SetError(PR_OUT_OF_MEMORY_ERROR, 0 ); - PR_LOG(_pr_shm_lm, PR_LOG_DEBUG, ( "PR_OpenSharedMemory: New PRSharedMemory out of memory")); + PR_LOG(_pr_shm_lm, PR_LOG_DEBUG, ( "PR_OpenSharedMemory: New PRSharedMemory out of memory")); return(NULL); } @@ -64,14 +64,14 @@ extern PRSharedMemory * _MD_OpenSharedMemory( if ( NULL == shm->ipcname ) { PR_SetError(PR_OUT_OF_MEMORY_ERROR, 0 ); - PR_LOG(_pr_shm_lm, PR_LOG_DEBUG, ( "PR_OpenSharedMemory: New shm->ipcname out of memory")); + PR_LOG(_pr_shm_lm, PR_LOG_DEBUG, ( "PR_OpenSharedMemory: New shm->ipcname out of memory")); PR_DELETE(shm); return(NULL); } /* copy args to struct */ strcpy( shm->ipcname, ipcname ); - shm->size = size; + shm->size = size; shm->mode = mode; shm->flags = flags; shm->ident = _PR_SHM_IDENT; @@ -118,25 +118,25 @@ extern PRSharedMemory * _MD_OpenSharedMemory( } if ( NULL == shm->handle ) { - PR_LOG(_pr_shm_lm, PR_LOG_DEBUG, + PR_LOG(_pr_shm_lm, PR_LOG_DEBUG, ( "PR_OpenSharedMemory: CreateFileMapping() failed: %s", - shm->ipcname )); + shm->ipcname )); _PR_MD_MAP_DEFAULT_ERROR( GetLastError()); PR_FREEIF( shm->ipcname ) PR_DELETE( shm ); return(NULL); } else { if (( flags & PR_SHM_EXCL) && ( GetLastError() == ERROR_ALREADY_EXISTS )) { - PR_LOG(_pr_shm_lm, PR_LOG_DEBUG, + PR_LOG(_pr_shm_lm, PR_LOG_DEBUG, ( "PR_OpenSharedMemory: Request exclusive & already exists", - shm->ipcname )); + shm->ipcname )); PR_SetError( PR_FILE_EXISTS_ERROR, ERROR_ALREADY_EXISTS ); CloseHandle( shm->handle ); PR_FREEIF( shm->ipcname ) PR_DELETE( shm ); return(NULL); } else { - PR_LOG(_pr_shm_lm, PR_LOG_DEBUG, + PR_LOG(_pr_shm_lm, PR_LOG_DEBUG, ( "PR_OpenSharedMemory: CreateFileMapping() success: %s, handle: %d", shm->ipcname, shm->handle )); return(shm); @@ -151,16 +151,16 @@ extern PRSharedMemory * _MD_OpenSharedMemory( #endif if ( NULL == shm->handle ) { _PR_MD_MAP_DEFAULT_ERROR( GetLastError()); - PR_LOG(_pr_shm_lm, PR_LOG_DEBUG, + PR_LOG(_pr_shm_lm, PR_LOG_DEBUG, ( "PR_OpenSharedMemory: OpenFileMapping() failed: %s, error: %d", - shm->ipcname, PR_GetOSError())); + shm->ipcname, PR_GetOSError())); PR_FREEIF( shm->ipcname ); PR_DELETE( shm ); return(NULL); } else { - PR_LOG(_pr_shm_lm, PR_LOG_DEBUG, + PR_LOG(_pr_shm_lm, PR_LOG_DEBUG, ( "PR_OpenSharedMemory: OpenFileMapping() success: %s, handle: %d", - shm->ipcname, shm->handle )); + shm->ipcname, shm->handle )); return(shm); } } @@ -184,7 +184,7 @@ extern void * _MD_AttachSharedMemory( PRSharedMemory *shm, PRIntn flags ) if ( NULL == addr ) { _PR_MD_MAP_DEFAULT_ERROR( GetLastError()); - PR_LOG( _pr_shm_lm, PR_LOG_ERROR, + PR_LOG( _pr_shm_lm, PR_LOG_ERROR, ("_MD_AttachSharedMemory: MapViewOfFile() failed. OSerror: %d", PR_GetOSError())); } @@ -200,10 +200,10 @@ extern PRStatus _MD_DetachSharedMemory( PRSharedMemory *shm, void *addr ) PR_ASSERT( shm->ident == _PR_SHM_IDENT ); wrc = UnmapViewOfFile( addr ); - if ( FALSE == wrc ) + if ( FALSE == wrc ) { _PR_MD_MAP_DEFAULT_ERROR( GetLastError()); - PR_LOG( _pr_shm_lm, PR_LOG_ERROR, + PR_LOG( _pr_shm_lm, PR_LOG_ERROR, ("_MD_DetachSharedMemory: UnmapViewOfFile() failed. OSerror: %d", PR_GetOSError())); rc = PR_FAILURE; } @@ -223,7 +223,7 @@ extern PRStatus _MD_CloseSharedMemory( PRSharedMemory *shm ) if ( FALSE == wrc ) { _PR_MD_MAP_DEFAULT_ERROR( GetLastError()); - PR_LOG( _pr_shm_lm, PR_LOG_ERROR, + PR_LOG( _pr_shm_lm, PR_LOG_ERROR, ("_MD_CloseSharedMemory: CloseHandle() failed. OSerror: %d", PR_GetOSError())); rc = PR_FAILURE; } @@ -236,7 +236,7 @@ extern PRStatus _MD_CloseSharedMemory( PRSharedMemory *shm ) extern PRStatus _MD_DeleteSharedMemory( const char *name ) { return( PR_SUCCESS ); -} +} /* @@ -244,7 +244,7 @@ extern PRStatus _MD_DeleteSharedMemory( const char *name ) */ extern PRLogModuleInfo *_pr_shma_lm; -extern PRFileMap* _md_OpenAnonFileMap( +extern PRFileMap* _md_OpenAnonFileMap( const char *dirName, PRSize size, PRFileMapProtect prot @@ -280,7 +280,7 @@ extern PRFileMap* _md_OpenAnonFileMap( CloseHandle(fm->md.hFileMap); fm->md.hFileMap = hFileMap; -Finished: +Finished: return(fm); } /* end md_OpenAnonFileMap() */ @@ -302,7 +302,7 @@ extern PRStatus _md_ExportFileMapAsString( PR_LOG( _pr_shma_lm, PR_LOG_DEBUG, ("_md_ExportFileMapAsString(): prot: %x, hFileMap: %x, dwAccess: %x", fm->prot, fm->md.hFileMap, fm->md.dwAccess )); - + return((written == -1)? PR_FAILURE : PR_SUCCESS); } /* end _md_ExportFileMapAsString() */ @@ -342,6 +342,6 @@ extern PRFileMap * _md_ImportFileMapFromString( } /* end _md_ImportFileMapFromString() */ #else -Error! Why is PR_HAVE_WIN32_NAMED_SHARED_MEMORY not defined? +Error! Why is PR_HAVE_WIN32_NAMED_SHARED_MEMORY not defined? #endif /* PR_HAVE_WIN32_NAMED_SHARED_MEMORY */ /* --- end w32shm.c --- */ diff --git a/pr/src/md/windows/w95cv.c b/pr/src/md/windows/w95cv.c index 27b34e69..42a43ae5 100644 --- a/pr/src/md/windows/w95cv.c +++ b/pr/src/md/windows/w95cv.c @@ -16,7 +16,7 @@ * until right after we unlock the lock. This way the awakened threads * have a better chance to reaquire the lock. */ - + #include "primpl.h" /* @@ -78,7 +78,7 @@ md_UnlockAndPostNotifies( lock->notified.link = NULL; #endif - /* + /* * Figure out how many threads we need to wake up. */ notified = &post; /* this is where we start */ @@ -87,7 +87,7 @@ md_UnlockAndPostNotifies( _MDCVar *cv = notified->cv[index].cv; PRThread *thred; int i; - + /* Fast special case: no waiting threads */ if (cv->waitHead == NULL) { notified->cv[index].notifyHead = NULL; @@ -207,7 +207,7 @@ static void md_PostNotifyToCvar(_MDCVar *cvar, _MDLock *lock, * 0 when it succeeds. * */ -PRInt32 +PRInt32 _PR_MD_NEW_CV(_MDCVar *cv) { cv->magic = _MD_MAGIC_CV; @@ -216,7 +216,7 @@ _PR_MD_NEW_CV(_MDCVar *cv) * when the PRCondVar structure is created. */ return 0; -} +} void _PR_MD_FREE_CV(_MDCVar *cv) { diff --git a/pr/src/md/windows/w95io.c b/pr/src/md/windows/w95io.c index 9bae6f8d..07a19458 100644 --- a/pr/src/md/windows/w95io.c +++ b/pr/src/md/windows/w95io.c @@ -86,7 +86,7 @@ _PR_MD_WAIT(PRThread *thread, PRIntervalTime ticks) PRUint32 msecs = (ticks == PR_INTERVAL_NO_TIMEOUT) ? INFINITE : PR_IntervalToMilliseconds(ticks); rv = WaitForSingleObject(thread->md.blocked_sema, msecs); - switch(rv) + switch(rv) { case WAIT_OBJECT_0: return PR_SUCCESS; @@ -116,7 +116,7 @@ _PR_MD_WAIT(PRThread *thread, PRIntervalTime ticks) PRStatus _PR_MD_WAKEUP_WAITER(PRThread *thread) { - if ( _PR_IS_NATIVE_THREAD(thread) ) + if ( _PR_IS_NATIVE_THREAD(thread) ) { if (ReleaseSemaphore(thread->md.blocked_sema, 1, NULL) == FALSE) return PR_FAILURE; @@ -135,7 +135,7 @@ _PR_MD_WAKEUP_WAITER(PRThread *thread) * The NSPR open flags (osflags) are translated into flags for Win95 * * Mode seems to be passed in as a unix style file permissions argument - * as in 0666, in the case of opening the logFile. + * as in 0666, in the case of opening the logFile. * */ PROsfd @@ -145,9 +145,9 @@ _PR_MD_OPEN(const char *name, PRIntn osflags, int mode) PRInt32 access = 0; PRInt32 flags = 0; PRInt32 flag6 = 0; - + if (osflags & PR_SYNC) flag6 = FILE_FLAG_WRITE_THROUGH; - + if (osflags & PR_RDONLY || osflags & PR_RDWR) access |= GENERIC_READ; if (osflags & PR_WRONLY || osflags & PR_RDWR) @@ -176,7 +176,7 @@ _PR_MD_OPEN(const char *name, PRIntn osflags, int mode) NULL); if (file == INVALID_HANDLE_VALUE) { _PR_MD_MAP_OPEN_ERROR(GetLastError()); - return -1; + return -1; } return (PROsfd)file; @@ -203,9 +203,9 @@ _PR_MD_OPEN_FILE(const char *name, PRIntn osflags, int mode) lpSA = &sa; } } - + if (osflags & PR_SYNC) flag6 = FILE_FLAG_WRITE_THROUGH; - + if (osflags & PR_RDONLY || osflags & PR_RDWR) access |= GENERIC_READ; if (osflags & PR_WRONLY || osflags & PR_RDWR) @@ -237,7 +237,7 @@ _PR_MD_OPEN_FILE(const char *name, PRIntn osflags, int mode) } if (file == INVALID_HANDLE_VALUE) { _PR_MD_MAP_OPEN_ERROR(GetLastError()); - return -1; + return -1; } return (PROsfd)file; @@ -254,8 +254,8 @@ _PR_MD_READ(PRFileDesc *fd, void *buf, PRInt32 len) len, &bytes, NULL); - - if (rv == 0) + + if (rv == 0) { err = GetLastError(); /* ERROR_HANDLE_EOF can only be returned by async io */ @@ -276,14 +276,14 @@ _PR_MD_WRITE(PRFileDesc *fd, const void *buf, PRInt32 len) PROsfd f = fd->secret->md.osfd; PRInt32 bytes; int rv; - + rv = WriteFile((HANDLE)f, buf, len, &bytes, NULL ); - - if (rv == 0) + + if (rv == 0) { _PR_MD_MAP_WRITE_ERROR(GetLastError()); return -1; @@ -399,7 +399,7 @@ PRInt32 _MD_CloseFile(PROsfd osfd) { PRInt32 rv; - + rv = (CloseHandle((HANDLE)osfd))?0:-1; if (rv == -1) _PR_MD_MAP_CLOSE_ERROR(GetLastError()); @@ -723,7 +723,7 @@ _PR_MD_GETFILEINFO64(const char *fn, PRFileInfo64 *info) { WIN32_FILE_ATTRIBUTE_DATA findFileData; BOOL rv; - + if (NULL == fn || '\0' == *fn) { PR_SetError(PR_INVALID_ARGUMENT_ERROR, 0); return -1; @@ -832,7 +832,7 @@ _PR_MD_SET_FD_INHERITABLE(PRFileDesc *fd, PRBool inheritable) return PR_FAILURE; } return PR_SUCCESS; -} +} void _PR_MD_INIT_FD_INHERITABLE(PRFileDesc *fd, PRBool imported) @@ -953,7 +953,7 @@ _PR_MD_LOCKFILE(PROsfd f) rv = LockFile( (HANDLE)f, 0l, 0l, - 0x0l, 0xffffffffl ); + 0x0l, 0xffffffffl ); if ( rv == 0 ) { DWORD err = GetLastError(); _PR_MD_MAP_DEFAULT_ERROR(err); @@ -977,11 +977,11 @@ PRStatus _PR_MD_UNLOCKFILE(PROsfd f) { PRInt32 rv; - + rv = UnlockFile( (HANDLE) f, 0l, 0l, - 0x0l, 0xffffffffl ); - + 0x0l, 0xffffffffl ); + if ( rv ) { return PR_SUCCESS; @@ -1059,7 +1059,7 @@ _PR_MD_OPEN_FILE_UTF16(const PRUnichar *name, PRIntn osflags, int mode) access |= GENERIC_READ; if (osflags & PR_WRONLY || osflags & PR_RDWR) access |= GENERIC_WRITE; - + if ( osflags & PR_CREATE_FILE && osflags & PR_EXCL ) flags = CREATE_NEW; else if (osflags & PR_CREATE_FILE) { @@ -1088,10 +1088,10 @@ _PR_MD_OPEN_FILE_UTF16(const PRUnichar *name, PRIntn osflags, int mode) _PR_MD_MAP_OPEN_ERROR(GetLastError()); return -1; } - + return (PROsfd)file; } - + PRStatus _PR_MD_OPEN_DIR_UTF16(_MDDirUTF16 *d, const PRUnichar *name) { @@ -1164,7 +1164,7 @@ _PR_MD_READ_DIR_UTF16(_MDDirUTF16 *d, PRIntn flags) PR_SetError(PR_INVALID_ARGUMENT_ERROR, 0); return NULL; } - + PRInt32 _PR_MD_CLOSE_DIR_UTF16(_MDDirUTF16 *d) { @@ -1312,7 +1312,7 @@ _PR_MD_GETFILEINFO64_UTF16(const PRUnichar *fn, PRFileInfo64 *info) if (NULL == wcspbrk(fn, L".\\/")) { _PR_MD_MAP_OPENDIR_ERROR(GetLastError()); return -1; - } + } len = getFullPathNameW(fn, sizeof(pathbuf)/sizeof(pathbuf[0]), pathbuf, &filePart); if (0 == len) { diff --git a/pr/src/md/windows/w95sock.c b/pr/src/md/windows/w95sock.c index c6a3ec11..10423e98 100644 --- a/pr/src/md/windows/w95sock.c +++ b/pr/src/md/windows/w95sock.c @@ -14,7 +14,7 @@ #define CONNECT_FD 3 static PRInt32 socket_io_wait( - PROsfd osfd, + PROsfd osfd, PRInt32 fd_type, PRIntervalTime timeout); @@ -51,7 +51,7 @@ _PR_MD_SOCKET(int af, int type, int flags) sock = socket(af, type, flags); - if (sock == INVALID_SOCKET ) + if (sock == INVALID_SOCKET ) { _PR_MD_MAP_SOCKET_ERROR(WSAGetLastError()); return (PROsfd)sock; @@ -120,8 +120,8 @@ _MD_SocketAvailable(PRFileDesc *fd) } PROsfd _MD_Accept( - PRFileDesc *fd, - PRNetAddr *raddr, + PRFileDesc *fd, + PRNetAddr *raddr, PRUint32 *rlen, PRIntervalTime timeout ) { @@ -129,7 +129,7 @@ PROsfd _MD_Accept( SOCKET sock; PRInt32 rv, err; - while ((sock = accept(osfd, (struct sockaddr *) raddr, rlen)) == -1) + while ((sock = accept(osfd, (struct sockaddr *) raddr, rlen)) == -1) { err = WSAGetLastError(); if ((err == WSAEWOULDBLOCK) && (!fd->secret->nonblocking)) @@ -149,14 +149,14 @@ PROsfd _MD_Accept( } /* end _MD_accept() */ PRInt32 -_PR_MD_CONNECT(PRFileDesc *fd, const PRNetAddr *addr, PRUint32 addrlen, +_PR_MD_CONNECT(PRFileDesc *fd, const PRNetAddr *addr, PRUint32 addrlen, PRIntervalTime timeout) { PROsfd osfd = fd->secret->md.osfd; PRInt32 rv; int err; - if ((rv = connect(osfd, (struct sockaddr *) addr, addrlen)) == -1) + if ((rv = connect(osfd, (struct sockaddr *) addr, addrlen)) == -1) { err = WSAGetLastError(); if ((!fd->secret->nonblocking) && (err == WSAEWOULDBLOCK)) @@ -171,7 +171,7 @@ _PR_MD_CONNECT(PRFileDesc *fd, const PRNetAddr *addr, PRUint32 addrlen, PR_ASSERT(rv > 0); /* it's connected */ return(0); - } + } } _PR_MD_MAP_CONNECT_ERROR(err); } @@ -209,7 +209,7 @@ _PR_MD_LISTEN(PRFileDesc *fd, PRIntn backlog) } PRInt32 -_PR_MD_RECV(PRFileDesc *fd, void *buf, PRInt32 amount, PRIntn flags, +_PR_MD_RECV(PRFileDesc *fd, void *buf, PRInt32 amount, PRIntn flags, PRIntervalTime timeout) { PROsfd osfd = fd->secret->md.osfd; @@ -222,18 +222,18 @@ _PR_MD_RECV(PRFileDesc *fd, void *buf, PRInt32 amount, PRIntn flags, PR_ASSERT(PR_MSG_PEEK == flags); osflags = MSG_PEEK; } - while ((rv = recv( osfd, buf, amount, osflags)) == -1) + while ((rv = recv( osfd, buf, amount, osflags)) == -1) { - if (((err = WSAGetLastError()) == WSAEWOULDBLOCK) + if (((err = WSAGetLastError()) == WSAEWOULDBLOCK) && (!fd->secret->nonblocking)) { rv = socket_io_wait(osfd, READ_FD, timeout); if ( rv < 0 ) { return -1; - } - } - else + } + } + else { _PR_MD_MAP_RECV_ERROR(err); break; @@ -250,11 +250,11 @@ _PR_MD_SEND(PRFileDesc *fd, const void *buf, PRInt32 amount, PRIntn flags, PRInt32 rv, err; PRInt32 bytesSent = 0; - while(bytesSent < amount ) + while(bytesSent < amount ) { - while ((rv = send( osfd, buf, amount, 0 )) == -1) + while ((rv = send( osfd, buf, amount, 0 )) == -1) { - if (((err = WSAGetLastError()) == WSAEWOULDBLOCK) + if (((err = WSAGetLastError()) == WSAEWOULDBLOCK) && (!fd->secret->nonblocking)) { rv = socket_io_wait(osfd, WRITE_FD, timeout); @@ -262,8 +262,8 @@ _PR_MD_SEND(PRFileDesc *fd, const void *buf, PRInt32 amount, PRIntn flags, { return -1; } - } - else + } + else { _PR_MD_MAP_SEND_ERROR(err); return -1; @@ -274,7 +274,7 @@ _PR_MD_SEND(PRFileDesc *fd, const void *buf, PRInt32 amount, PRIntn flags, { break; } - if (bytesSent < amount) + if (bytesSent < amount) { rv = socket_io_wait(osfd, WRITE_FD, timeout); if ( rv < 0 ) @@ -296,9 +296,9 @@ _PR_MD_SENDTO(PRFileDesc *fd, const void *buf, PRInt32 amount, PRIntn flags, do { while ((rv = sendto( osfd, buf, amount, 0, (struct sockaddr *) addr, - addrlen)) == -1) + addrlen)) == -1) { - if (((err = WSAGetLastError()) == WSAEWOULDBLOCK) + if (((err = WSAGetLastError()) == WSAEWOULDBLOCK) && (!fd->secret->nonblocking)) { rv = socket_io_wait(osfd, WRITE_FD, timeout); @@ -306,8 +306,8 @@ _PR_MD_SENDTO(PRFileDesc *fd, const void *buf, PRInt32 amount, PRIntn flags, { return -1; } - } - else + } + else { _PR_MD_MAP_SENDTO_ERROR(err); return -1; @@ -318,10 +318,10 @@ _PR_MD_SENDTO(PRFileDesc *fd, const void *buf, PRInt32 amount, PRIntn flags, { break; } - if (bytesSent < amount) + if (bytesSent < amount) { rv = socket_io_wait(osfd, WRITE_FD, timeout); - if (rv < 0) + if (rv < 0) { return -1; } @@ -510,18 +510,18 @@ _PR_MD_RECVFROM(PRFileDesc *fd, void *buf, PRInt32 amount, PRIntn flags, PRInt32 rv, err; while ((rv = recvfrom( osfd, buf, amount, 0, (struct sockaddr *) addr, - addrlen)) == -1) + addrlen)) == -1) { - if (((err = WSAGetLastError()) == WSAEWOULDBLOCK) + if (((err = WSAGetLastError()) == WSAEWOULDBLOCK) && (!fd->secret->nonblocking)) { rv = socket_io_wait(osfd, READ_FD, timeout); if ( rv < 0) { return -1; - } - } - else + } + } + else { _PR_MD_MAP_RECVFROM_ERROR(err); break; @@ -537,12 +537,12 @@ _PR_MD_WRITEV(PRFileDesc *fd, const PRIOVec *iov, PRInt32 iov_size, PRIntervalTi int sent = 0; int rv; - for (index=0; index < iov_size; index++) + for (index=0; index < iov_size; index++) { rv = _PR_MD_SEND(fd, iov[index].iov_base, iov[index].iov_len, 0, timeout); - if (rv > 0) + if (rv > 0) sent += rv; - if ( rv != iov[index].iov_len ) + if ( rv != iov[index].iov_len ) { if (rv < 0) { @@ -651,7 +651,7 @@ _MD_MakeNonblock(PRFileDesc *f) #define _PR_INTERRUPT_CHECK_INTERVAL_SECS 5 static PRInt32 socket_io_wait( - PROsfd osfd, + PROsfd osfd, PRInt32 fd_type, PRIntervalTime timeout) { @@ -710,7 +710,7 @@ static PRInt32 socket_io_wait( len = sizeof(err); if (getsockopt(osfd, SOL_SOCKET, SO_ERROR, (char *) &err, &len) == SOCKET_ERROR) - { + { _PR_MD_MAP_GETSOCKOPT_ERROR(WSAGetLastError()); return -1; } @@ -790,7 +790,7 @@ static PRInt32 socket_io_wait( len = sizeof(err); if (getsockopt(osfd, SOL_SOCKET, SO_ERROR, (char *) &err, &len) == SOCKET_ERROR) - { + { _PR_MD_MAP_GETSOCKOPT_ERROR(WSAGetLastError()); return -1; } @@ -822,7 +822,7 @@ static PRInt32 socket_io_wait( if (wait_for_remaining) { elapsed = remaining; } else { - elapsed = PR_SecondsToInterval(tv.tv_sec) + elapsed = PR_SecondsToInterval(tv.tv_sec) + PR_MicrosecondsToInterval(tv.tv_usec); } if (elapsed >= remaining) { diff --git a/pr/src/md/windows/w95thred.c b/pr/src/md/windows/w95thred.c index a365411f..5b5a5a89 100644 --- a/pr/src/md/windows/w95thred.c +++ b/pr/src/md/windows/w95thred.c @@ -25,7 +25,7 @@ DWORD _pr_currentThreadIndex; DWORD _pr_lastThreadIndex; DWORD _pr_currentCPUIndex; #endif -int _pr_intsOff = 0; +int _pr_intsOff = 0; _PRInterruptTable _pr_interruptTable[] = { { 0 } }; typedef HRESULT (WINAPI *SETTHREADDESCRIPTION)(HANDLE, PCWSTR); @@ -138,12 +138,12 @@ pr_root(void *arg) return 0; } -PRStatus -_PR_MD_CREATE_THREAD(PRThread *thread, - void (*start)(void *), - PRThreadPriority priority, - PRThreadScope scope, - PRThreadState state, +PRStatus +_PR_MD_CREATE_THREAD(PRThread *thread, + void (*start)(void *), + PRThreadPriority priority, + PRThreadScope scope, + PRThreadState state, PRUint32 stackSize) { @@ -175,14 +175,14 @@ _PR_MD_CREATE_THREAD(PRThread *thread, return PR_FAILURE; } -void +void _PR_MD_YIELD(void) { /* Can NT really yield at all? */ Sleep(0); } -void +void _PR_MD_SET_PRIORITY(_MDThread *thread, PRThreadPriority newPri) { int nativePri; @@ -325,8 +325,8 @@ PRInt32 _PR_MD_GETTHREADAFFINITYMASK(PRThread *thread, PRUint32 *mask) #endif } -void -_PR_MD_SUSPEND_CPU(_PRCPU *cpu) +void +_PR_MD_SUSPEND_CPU(_PRCPU *cpu) { _PR_MD_SUSPEND_THREAD(cpu->thread); } diff --git a/pr/src/md/windows/win32_errors.c b/pr/src/md/windows/win32_errors.c index 27579218..b0118146 100644 --- a/pr/src/md/windows/win32_errors.c +++ b/pr/src/md/windows/win32_errors.c @@ -13,7 +13,7 @@ * - GetLastError(): for Win32 functions * - WSAGetLastError(): for Winsock functions * - errno: for standard C library functions - * + * * GetLastError() and WSAGetLastError() return error codes in * non-overlapping ranges, so their error codes (ERROR_* and * WSAE*) can be mapped by the same function. On the other hand, @@ -61,7 +61,7 @@ void _MD_win32_map_default_error(PRInt32 err) prError = PR_NOT_IMPLEMENTED_ERROR; break; case ERROR_DISK_CORRUPT: - prError = PR_IO_ERROR; + prError = PR_IO_ERROR; break; case ERROR_DISK_FULL: prError = PR_NO_DEVICE_SPACE_ERROR; @@ -518,7 +518,7 @@ void _MD_win32_map_gethostname_error(PRInt32 err) } /* Win32 select() only works on sockets. So in this -** context, WSAENOTSOCK is equivalent to EBADF on Unix. +** context, WSAENOTSOCK is equivalent to EBADF on Unix. */ void _MD_win32_map_select_error(PRInt32 err) { |