whitespace cleanup

This commit is contained in:
Christopher Faylor 2003-03-09 20:31:07 +00:00
parent c367dfd02c
commit a113a3c540
15 changed files with 55 additions and 56 deletions

View File

@ -628,7 +628,7 @@ fhandler_disk_file::opendir (path_conv& real_name)
dir->__d_dirent->d_version = __DIRENT_VERSION; dir->__d_dirent->d_version = __DIRENT_VERSION;
cygheap_fdnew fd; cygheap_fdnew fd;
if (fd >= 0) if (fd >= 0)
{ {
fd = this; fd = this;
fd->set_nohandle (true); fd->set_nohandle (true);
dir->__d_dirent->d_fd = fd; dir->__d_dirent->d_fd = fd;

View File

@ -834,7 +834,7 @@ fhandler_serial::tcsetattr (int action, const struct termios *t)
} }
debug_printf ("ReadTotalTimeoutConstant %d, ReadIntervalTimeout %d, ReadTotalTimeoutMultiplier %d", debug_printf ("ReadTotalTimeoutConstant %d, ReadIntervalTimeout %d, ReadTotalTimeoutMultiplier %d",
to.ReadTotalTimeoutConstant, to.ReadIntervalTimeout, to.ReadTotalTimeoutMultiplier); to.ReadTotalTimeoutConstant, to.ReadIntervalTimeout, to.ReadTotalTimeoutMultiplier);
if (!SetCommTimeouts(get_handle (), &to)) if (!SetCommTimeouts(get_handle (), &to))
{ {

View File

@ -63,24 +63,24 @@ get_inet_addr (const struct sockaddr *in, int inlen,
{ {
path_conv pc (in->sa_data, PC_SYM_FOLLOW); path_conv pc (in->sa_data, PC_SYM_FOLLOW);
if (pc.error) if (pc.error)
{ {
set_errno (pc.error); set_errno (pc.error);
return 0; return 0;
} }
if (!pc.exists ()) if (!pc.exists ())
{ {
set_errno (ENOENT); set_errno (ENOENT);
return 0; return 0;
} }
if (!pc.issocket ()) if (!pc.issocket ())
{ {
set_errno (EBADF); set_errno (EBADF);
return 0; return 0;
} }
HANDLE fh = CreateFile (pc, GENERIC_READ, wincap.shared (), &sec_none, HANDLE fh = CreateFile (pc, GENERIC_READ, wincap.shared (), &sec_none,
OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0); OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0);
if (fh == INVALID_HANDLE_VALUE) if (fh == INVALID_HANDLE_VALUE)
{ {
__seterrno (); __seterrno ();
return 0; return 0;
} }
@ -89,7 +89,7 @@ get_inet_addr (const struct sockaddr *in, int inlen,
char buf[128]; char buf[128];
memset (buf, 0, sizeof buf); memset (buf, 0, sizeof buf);
if (ReadFile (fh, buf, 128, &len, 0)) if (ReadFile (fh, buf, 128, &len, 0))
{ {
sockaddr_in sin; sockaddr_in sin;
sin.sin_family = AF_INET; sin.sin_family = AF_INET;
sscanf (buf + strlen (SOCKET_COOKIE), "%hu %08x-%08x-%08x-%08x", sscanf (buf + strlen (SOCKET_COOKIE), "%hu %08x-%08x-%08x-%08x",
@ -126,11 +126,11 @@ public:
bool load (SOCKET sock, int type_bit) bool load (SOCKET sock, int type_bit)
{ {
if ((ev[0] = WSACreateEvent ()) == WSA_INVALID_EVENT) if ((ev[0] = WSACreateEvent ()) == WSA_INVALID_EVENT)
return false; return false;
evt_sock = sock; evt_sock = sock;
evt_type_bit = type_bit; evt_type_bit = type_bit;
if (WSAEventSelect (evt_sock, ev[0], 1 << evt_type_bit)) if (WSAEventSelect (evt_sock, ev[0], 1 << evt_type_bit))
{ {
WSACloseEvent (ev[0]); WSACloseEvent (ev[0]);
ev[0] = WSA_INVALID_EVENT; ev[0] = WSA_INVALID_EVENT;
return false; return false;
@ -143,7 +143,7 @@ public:
int wait_result = WSAWaitForMultipleEvents (2, ev, FALSE, WSA_INFINITE, int wait_result = WSAWaitForMultipleEvents (2, ev, FALSE, WSA_INFINITE,
FALSE); FALSE);
if (wait_result == WSA_WAIT_EVENT_0) if (wait_result == WSA_WAIT_EVENT_0)
WSAEnumNetworkEvents (evt_sock, ev[0], &sock_event); WSAEnumNetworkEvents (evt_sock, ev[0], &sock_event);
/* Cleanup, Revert to blocking. */ /* Cleanup, Revert to blocking. */
WSAEventSelect (evt_sock, ev[0], 0); WSAEventSelect (evt_sock, ev[0], 0);
@ -152,12 +152,12 @@ public:
ioctlsocket (evt_sock, FIONBIO, &nonblocking); ioctlsocket (evt_sock, FIONBIO, &nonblocking);
switch (wait_result) switch (wait_result)
{ {
case WSA_WAIT_EVENT_0: case WSA_WAIT_EVENT_0:
if ((sock_event.lNetworkEvents & (1 << evt_type_bit)) if ((sock_event.lNetworkEvents & (1 << evt_type_bit))
&& sock_event.iErrorCode[evt_type_bit]) && sock_event.iErrorCode[evt_type_bit])
{ {
WSASetLastError (sock_event.iErrorCode[evt_type_bit]); WSASetLastError (sock_event.iErrorCode[evt_type_bit]);
set_winsock_errno (); set_winsock_errno ();
return -1; return -1;
} }
@ -401,13 +401,13 @@ fhandler_socket::fstat (struct __stat64 *buf, path_conv *pc)
if (get_addr_family () == AF_LOCAL && get_sun_path () && !get_socket_type ()) if (get_addr_family () == AF_LOCAL && get_sun_path () && !get_socket_type ())
{ {
path_conv spc (get_sun_path (), path_conv spc (get_sun_path (),
PC_SYM_NOFOLLOW | PC_NULLEMPTY | PC_FULL | PC_POSIX, PC_SYM_NOFOLLOW | PC_NULLEMPTY | PC_FULL | PC_POSIX,
NULL); NULL);
fhandler_base *fh = cygheap->fdtab.build_fhandler (-1, FH_DISK, fhandler_base *fh = cygheap->fdtab.build_fhandler (-1, FH_DISK,
get_sun_path (), get_sun_path (),
spc, 0); spc, 0);
if (fh) if (fh)
{ {
res = fh->fstat (buf, &spc); res = fh->fstat (buf, &spc);
buf->st_rdev = buf->st_size = buf->st_blocks = 0; buf->st_rdev = buf->st_size = buf->st_blocks = 0;
return res; return res;
@ -418,7 +418,7 @@ fhandler_socket::fstat (struct __stat64 *buf, path_conv *pc)
if (!res) if (!res)
{ {
if (get_socket_type ()) /* fstat */ if (get_socket_type ()) /* fstat */
{ {
buf->st_dev = 0; buf->st_dev = 0;
buf->st_ino = (ino_t) get_handle (); buf->st_ino = (ino_t) get_handle ();
buf->st_mode = S_IFSOCK | S_IRWXU | S_IRWXG | S_IRWXO; buf->st_mode = S_IFSOCK | S_IRWXU | S_IRWXG | S_IRWXO;
@ -426,7 +426,7 @@ fhandler_socket::fstat (struct __stat64 *buf, path_conv *pc)
buf->st_gid = getegid32 (); buf->st_gid = getegid32 ();
} }
else else
{ {
path_conv spc ("/dev", PC_SYM_NOFOLLOW | PC_NULLEMPTY, NULL); path_conv spc ("/dev", PC_SYM_NOFOLLOW | PC_NULLEMPTY, NULL);
buf->st_dev = spc.volser (); buf->st_dev = spc.volser ();
buf->st_ino = (ino_t) get_namehash (); buf->st_ino = (ino_t) get_namehash ();
@ -474,25 +474,25 @@ fhandler_socket::bind (const struct sockaddr *name, int namelen)
path_conv pc (un_addr->sun_path, PC_SYM_FOLLOW); path_conv pc (un_addr->sun_path, PC_SYM_FOLLOW);
if (pc.error) if (pc.error)
{ {
set_errno (pc.error); set_errno (pc.error);
goto out; goto out;
} }
if (pc.exists ()) if (pc.exists ())
{ {
set_errno (EADDRINUSE); set_errno (EADDRINUSE);
goto out; goto out;
} }
mode_t mode = (S_IRWXU | S_IRWXG | S_IRWXO) & ~cygheap->umask; mode_t mode = (S_IRWXU | S_IRWXG | S_IRWXO) & ~cygheap->umask;
DWORD attr = FILE_ATTRIBUTE_SYSTEM; DWORD attr = FILE_ATTRIBUTE_SYSTEM;
if (!(mode & (S_IWUSR | S_IWGRP | S_IWOTH))) if (!(mode & (S_IWUSR | S_IWGRP | S_IWOTH)))
attr |= FILE_ATTRIBUTE_READONLY; attr |= FILE_ATTRIBUTE_READONLY;
SECURITY_ATTRIBUTES sa = sec_none; SECURITY_ATTRIBUTES sa = sec_none;
if (allow_ntsec && pc.has_acls ()) if (allow_ntsec && pc.has_acls ())
set_security_attribute (mode, &sa, alloca (4096), 4096); set_security_attribute (mode, &sa, alloca (4096), 4096);
HANDLE fh = CreateFile (pc, GENERIC_WRITE, 0, &sa, CREATE_NEW, attr, 0); HANDLE fh = CreateFile (pc, GENERIC_WRITE, 0, &sa, CREATE_NEW, attr, 0);
if (fh == INVALID_HANDLE_VALUE) if (fh == INVALID_HANDLE_VALUE)
{ {
if (GetLastError () == ERROR_ALREADY_EXISTS) if (GetLastError () == ERROR_ALREADY_EXISTS)
set_errno (EADDRINUSE); set_errno (EADDRINUSE);
else else
@ -506,13 +506,13 @@ fhandler_socket::bind (const struct sockaddr *name, int namelen)
get_connect_secret (strchr (buf, '\0')); get_connect_secret (strchr (buf, '\0'));
DWORD blen = strlen (buf) + 1; DWORD blen = strlen (buf) + 1;
if (!WriteFile (fh, buf, blen, &blen, 0)) if (!WriteFile (fh, buf, blen, &blen, 0))
{ {
__seterrno (); __seterrno ();
CloseHandle (fh); CloseHandle (fh);
DeleteFile (pc); DeleteFile (pc);
} }
else else
{ {
CloseHandle (fh); CloseHandle (fh);
set_sun_path (un_addr->sun_path); set_sun_path (un_addr->sun_path);
res = 0; res = 0;
@ -666,12 +666,12 @@ fhandler_socket::accept (struct sockaddr *peer, int *len)
{ {
sock_event evt; sock_event evt;
if (!evt.load (get_socket (), FD_ACCEPT_BIT)) if (!evt.load (get_socket (), FD_ACCEPT_BIT))
{ {
set_winsock_errno (); set_winsock_errno ();
return -1; return -1;
} }
switch (evt.wait ()) switch (evt.wait ())
{ {
case 1: /* Signal */ case 1: /* Signal */
return -1; return -1;
case 0: case 0:
@ -725,7 +725,7 @@ fhandler_socket::accept (struct sockaddr *peer, int *len)
if (res_fd >= 0) if (res_fd >= 0)
res_fh = fdsock (res_fd, get_name (), res); res_fh = fdsock (res_fd, get_name (), res);
if (res_fh) if (res_fh)
{ {
if (get_addr_family () == AF_LOCAL) if (get_addr_family () == AF_LOCAL)
res_fh->set_sun_path (get_sun_path ()); res_fh->set_sun_path (get_sun_path ());
res_fh->set_addr_family (get_addr_family ()); res_fh->set_addr_family (get_addr_family ());
@ -734,7 +734,7 @@ fhandler_socket::accept (struct sockaddr *peer, int *len)
res = res_fd; res = res_fd;
} }
else else
{ {
closesocket (res); closesocket (res);
res = -1; res = -1;
} }
@ -840,9 +840,9 @@ fhandler_socket::recvfrom (void *ptr, size_t len, int flags,
if (res == SOCKET_ERROR) if (res == SOCKET_ERROR)
{ {
/* According to SUSv3, errno isn't set in that case and no error /* According to SUSv3, errno isn't set in that case and no error
condition is returned. */ condition is returned. */
if (WSAGetLastError () == WSAEMSGSIZE) if (WSAGetLastError () == WSAEMSGSIZE)
return len; return len;
res = -1; res = -1;
set_winsock_errno (); set_winsock_errno ();

View File

@ -75,7 +75,7 @@ fhandler_virtual::opendir (path_conv& pc)
dir->__d_dirent->d_version = __DIRENT_VERSION; dir->__d_dirent->d_version = __DIRENT_VERSION;
cygheap_fdnew fd; cygheap_fdnew fd;
if (fd >= 0) if (fd >= 0)
{ {
fd = this; fd = this;
fd->set_nohandle (true); fd->set_nohandle (true);
dir->__d_dirent->d_fd = fd; dir->__d_dirent->d_fd = fd;

View File

@ -123,7 +123,7 @@ mmap_record::alloc_map (__off64_t off, DWORD len)
off -= offset_; off -= offset_;
len = PAGE_CNT (len) * getpagesize (); len = PAGE_CNT (len) * getpagesize ();
if (off > 0 && if (off > 0 &&
!VirtualProtect (base_address_, off, PAGE_NOACCESS, &old_prot)) !VirtualProtect (base_address_, off, PAGE_NOACCESS, &old_prot))
syscall_printf ("VirtualProtect(%x,%d) failed: %E", base_address_, off); syscall_printf ("VirtualProtect(%x,%d) failed: %E", base_address_, off);
if (off + len < size_to_map_ if (off + len < size_to_map_
&& !VirtualProtect (base_address_ + off + len, && !VirtualProtect (base_address_ + off + len,
@ -771,11 +771,11 @@ fhandler_disk_file::mmap (caddr_t *addr, size_t len, DWORD access,
switch (access) switch (access)
{ {
case FILE_MAP_WRITE: case FILE_MAP_WRITE:
protect = PAGE_READWRITE; protect = PAGE_READWRITE;
break; break;
case FILE_MAP_READ: case FILE_MAP_READ:
protect = PAGE_READONLY; protect = PAGE_READONLY;
break; break;
default: default:
protect = PAGE_WRITECOPY; protect = PAGE_WRITECOPY;
break; break;
@ -989,7 +989,7 @@ fixup_mmaps_after_fork (HANDLE parent)
|| !wincap.virtual_protect_works_on_shared_pages ()) || !wincap.virtual_protect_works_on_shared_pages ())
{ {
system_printf ("ReadProcessMemory failed for " system_printf ("ReadProcessMemory failed for "
"MAP_PRIVATE address %p, %E", "MAP_PRIVATE address %p, %E",
rec->get_address ()); rec->get_address ());
return -1; return -1;
} }
@ -1013,7 +1013,7 @@ fixup_mmaps_after_fork (HANDLE parent)
address, getpagesize (), address, getpagesize (),
old_prot, &dummy_prot)) old_prot, &dummy_prot))
system_printf ("WARNING: VirtualProtectEx to " system_printf ("WARNING: VirtualProtectEx to "
"return to previous state " "return to previous state "
"in parent failed for " "in parent failed for "
"MAP_PRIVATE address %p, %E", "MAP_PRIVATE address %p, %E",
rec->get_address ()); rec->get_address ());

View File

@ -1968,7 +1968,7 @@ cygwin_rresvport (int *port)
if (res_fd >= 0) if (res_fd >= 0)
fh = fdsock (res_fd, "/dev/tcp", res); fh = fdsock (res_fd, "/dev/tcp", res);
if (fh) if (fh)
res = res_fd; res = res_fd;
else else
res = -1; res = -1;
} }
@ -2213,7 +2213,7 @@ socketpair (int family, int type, int protocol, int *sb)
if (res == -1) if (res == -1)
{ {
closesocket (insock); closesocket (insock);
closesocket (outsock); closesocket (outsock);
} }
} }

View File

@ -379,13 +379,13 @@ extern "C"
NTSTATUS NTAPI NtQueryInformationFile (HANDLE, IO_STATUS_BLOCK *, VOID *, NTSTATUS NTAPI NtQueryInformationFile (HANDLE, IO_STATUS_BLOCK *, VOID *,
DWORD, DWORD); DWORD, DWORD);
NTSTATUS NTAPI NtQueryInformationProcess (HANDLE, PROCESSINFOCLASS, NTSTATUS NTAPI NtQueryInformationProcess (HANDLE, PROCESSINFOCLASS,
PVOID, ULONG, PULONG); PVOID, ULONG, PULONG);
NTSTATUS NTAPI NtQueryObject (HANDLE, OBJECT_INFORMATION_CLASS, VOID *, NTSTATUS NTAPI NtQueryObject (HANDLE, OBJECT_INFORMATION_CLASS, VOID *,
ULONG, ULONG *); ULONG, ULONG *);
NTSTATUS NTAPI NtQuerySystemInformation (SYSTEM_INFORMATION_CLASS, NTSTATUS NTAPI NtQuerySystemInformation (SYSTEM_INFORMATION_CLASS,
PVOID, ULONG, PULONG); PVOID, ULONG, PULONG);
NTSTATUS NTAPI NtQueryVirtualMemory (HANDLE, PVOID, MEMORY_INFORMATION_CLASS, NTSTATUS NTAPI NtQueryVirtualMemory (HANDLE, PVOID, MEMORY_INFORMATION_CLASS,
PVOID, ULONG, PULONG); PVOID, ULONG, PULONG);
NTSTATUS NTAPI NtUnmapViewOfSection (HANDLE, PVOID); NTSTATUS NTAPI NtUnmapViewOfSection (HANDLE, PVOID);
VOID NTAPI RtlInitUnicodeString (PUNICODE_STRING, PCWSTR); VOID NTAPI RtlInitUnicodeString (PUNICODE_STRING, PCWSTR);
ULONG NTAPI RtlNtStatusToDosError (NTSTATUS); ULONG NTAPI RtlNtStatusToDosError (NTSTATUS);

View File

@ -1124,7 +1124,7 @@ win32_device_name (const char *src_path, char *win32_path,
strcpy (win32_path, src_path); strcpy (win32_path, src_path);
while (c = strchr (win32_path, '/')) while (c = strchr (win32_path, '/'))
*c = '\\'; *c = '\\';
break; break;
case FH_RANDOM: case FH_RANDOM:
__small_sprintf (win32_path, devfmt, unit == 8 ? "" : "u"); __small_sprintf (win32_path, devfmt, unit == 8 ? "" : "u");
break; break;

View File

@ -72,7 +72,7 @@ public:
if (!check && initialized) if (!check && initialized)
return; return;
if (pglock->acquire () == 1 && if (pglock->acquire () == 1 &&
(!initialized || (check && etc::file_changed (etc_ix)))) (!initialized || (check && etc::file_changed (etc_ix))))
(this->*read) (); (this->*read) ();
pglock->release (); pglock->release ();
} }

View File

@ -126,7 +126,7 @@ setacl (const char *file, int nentries, __aclent32_t *aclbufp)
if (aclbufp[i].a_perm & S_IROTH) if (aclbufp[i].a_perm & S_IROTH)
allow |= FILE_GENERIC_READ; allow |= FILE_GENERIC_READ;
if (aclbufp[i].a_perm & S_IWOTH) if (aclbufp[i].a_perm & S_IWOTH)
{ {
allow |= STANDARD_RIGHTS_WRITE | FILE_GENERIC_WRITE; allow |= STANDARD_RIGHTS_WRITE | FILE_GENERIC_WRITE;
/* Owner gets DELETE right, too. */ /* Owner gets DELETE right, too. */
if ((aclbufp[i].a_type & ~ACL_DEFAULT) == USER_OBJ) if ((aclbufp[i].a_type & ~ACL_DEFAULT) == USER_OBJ)

View File

@ -83,7 +83,7 @@ cygpsid::get_id (BOOL search_grp, int *type)
else if ((gr = internal_getgrsid (*this))) else if ((gr = internal_getgrsid (*this)))
id = gr->gr_gid; id = gr->gr_gid;
if (id != ILLEGAL_UID) if (id != ILLEGAL_UID)
{ {
if (type) if (type)
*type = GROUP; *type = GROUP;
return id; return id;
@ -97,7 +97,7 @@ cygpsid::get_id (BOOL search_grp, int *type)
else if ((pw = internal_getpwsid (*this))) else if ((pw = internal_getpwsid (*this)))
id = pw->pw_uid; id = pw->pw_uid;
if (id != ILLEGAL_UID && type) if (id != ILLEGAL_UID && type)
*type = USER; *type = USER;
} }
return id; return id;
} }

View File

@ -96,7 +96,7 @@ extract_nt_dom_user (const struct passwd *pw, char *domain, char *user)
else if (u - d <= INTERNET_MAX_HOST_NAME_LENGTH + 2) else if (u - d <= INTERNET_MAX_HOST_NAME_LENGTH + 2)
strlcpy (domain, d + 2, u - d - 1); strlcpy (domain, d + 2, u - d - 1);
if (c - u <= UNLEN + 1) if (c - u <= UNLEN + 1)
strlcpy (user, u + 1, c - u); strlcpy (user, u + 1, c - u);
} }
if (domain[0]) if (domain[0])
return; return;

View File

@ -115,7 +115,7 @@ public:
BOOL add (const PSID nsi) /* Only with auto for now */ BOOL add (const PSID nsi) /* Only with auto for now */
{ {
if (count >= maxcount) if (count >= maxcount)
{ {
cygsid *tmp = new cygsid [ 2 * maxcount]; cygsid *tmp = new cygsid [ 2 * maxcount];
if (!tmp) if (!tmp)
return FALSE; return FALSE;
@ -176,7 +176,7 @@ public:
void clear_supp () void clear_supp ()
{ {
if (issetgroups ()) if (issetgroups ())
{ {
sgsids.free_sids (); sgsids.free_sids ();
ischanged = TRUE; ischanged = TRUE;
} }

View File

@ -85,7 +85,7 @@ cygwin_strcasematch (const char *cs, const char *ct)
jmp 4f \n\ jmp 4f \n\
3: xor %0,%0 \n\ 3: xor %0,%0 \n\
4:" 4:"
:"=a" (__res), "=&S" (d0), "=&D" (d1) :"=a" (__res), "=&S" (d0), "=&D" (d1)
: "1" (cs), "2" (ct)); : "1" (cs), "2" (ct));
return __res; return __res;

View File

@ -159,7 +159,6 @@ unlink (const char *ourname)
} }
} }
/* Try a delete with attributes reset */ /* Try a delete with attributes reset */
if (DeleteFile (win32_name)) if (DeleteFile (win32_name))
{ {