From a113a3c540bc175afae325620f3537dbd61a8978 Mon Sep 17 00:00:00 2001 From: Christopher Faylor Date: Sun, 9 Mar 2003 20:31:07 +0000 Subject: whitespace cleanup --- winsup/cygwin/fhandler_disk_file.cc | 2 +- winsup/cygwin/fhandler_serial.cc | 2 +- winsup/cygwin/fhandler_socket.cc | 60 ++++++++++++++++++------------------- winsup/cygwin/fhandler_virtual.cc | 2 +- winsup/cygwin/mmap.cc | 16 +++++----- winsup/cygwin/net.cc | 4 +-- winsup/cygwin/ntdll.h | 6 ++-- winsup/cygwin/path.cc | 2 +- winsup/cygwin/pwdgrp.h | 2 +- winsup/cygwin/sec_acl.cc | 2 +- winsup/cygwin/sec_helper.cc | 4 +-- winsup/cygwin/security.cc | 2 +- winsup/cygwin/security.h | 4 +-- winsup/cygwin/string.h | 2 +- winsup/cygwin/syscalls.cc | 1 - 15 files changed, 55 insertions(+), 56 deletions(-) diff --git a/winsup/cygwin/fhandler_disk_file.cc b/winsup/cygwin/fhandler_disk_file.cc index 81ea8f2..96428d1 100644 --- a/winsup/cygwin/fhandler_disk_file.cc +++ b/winsup/cygwin/fhandler_disk_file.cc @@ -628,7 +628,7 @@ fhandler_disk_file::opendir (path_conv& real_name) dir->__d_dirent->d_version = __DIRENT_VERSION; cygheap_fdnew fd; if (fd >= 0) - { + { fd = this; fd->set_nohandle (true); dir->__d_dirent->d_fd = fd; diff --git a/winsup/cygwin/fhandler_serial.cc b/winsup/cygwin/fhandler_serial.cc index e110968..3c99b4a 100644 --- a/winsup/cygwin/fhandler_serial.cc +++ b/winsup/cygwin/fhandler_serial.cc @@ -834,7 +834,7 @@ fhandler_serial::tcsetattr (int action, const struct termios *t) } 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)) { diff --git a/winsup/cygwin/fhandler_socket.cc b/winsup/cygwin/fhandler_socket.cc index ad6fc20..01965bf 100644 --- a/winsup/cygwin/fhandler_socket.cc +++ b/winsup/cygwin/fhandler_socket.cc @@ -63,24 +63,24 @@ get_inet_addr (const struct sockaddr *in, int inlen, { path_conv pc (in->sa_data, PC_SYM_FOLLOW); if (pc.error) - { + { set_errno (pc.error); return 0; } if (!pc.exists ()) - { + { set_errno (ENOENT); return 0; } if (!pc.issocket ()) - { + { set_errno (EBADF); return 0; } HANDLE fh = CreateFile (pc, GENERIC_READ, wincap.shared (), &sec_none, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0); if (fh == INVALID_HANDLE_VALUE) - { + { __seterrno (); return 0; } @@ -89,7 +89,7 @@ get_inet_addr (const struct sockaddr *in, int inlen, char buf[128]; memset (buf, 0, sizeof buf); if (ReadFile (fh, buf, 128, &len, 0)) - { + { sockaddr_in sin; sin.sin_family = AF_INET; sscanf (buf + strlen (SOCKET_COOKIE), "%hu %08x-%08x-%08x-%08x", @@ -126,11 +126,11 @@ public: bool load (SOCKET sock, int type_bit) { if ((ev[0] = WSACreateEvent ()) == WSA_INVALID_EVENT) - return false; + return false; evt_sock = sock; evt_type_bit = type_bit; if (WSAEventSelect (evt_sock, ev[0], 1 << evt_type_bit)) - { + { WSACloseEvent (ev[0]); ev[0] = WSA_INVALID_EVENT; return false; @@ -143,7 +143,7 @@ public: int wait_result = WSAWaitForMultipleEvents (2, ev, FALSE, WSA_INFINITE, FALSE); 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. */ WSAEventSelect (evt_sock, ev[0], 0); @@ -152,12 +152,12 @@ public: ioctlsocket (evt_sock, FIONBIO, &nonblocking); switch (wait_result) - { + { case WSA_WAIT_EVENT_0: 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 (); 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 ()) { 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); fhandler_base *fh = cygheap->fdtab.build_fhandler (-1, FH_DISK, - get_sun_path (), + get_sun_path (), spc, 0); if (fh) - { + { res = fh->fstat (buf, &spc); buf->st_rdev = buf->st_size = buf->st_blocks = 0; return res; @@ -418,7 +418,7 @@ fhandler_socket::fstat (struct __stat64 *buf, path_conv *pc) if (!res) { if (get_socket_type ()) /* fstat */ - { + { buf->st_dev = 0; buf->st_ino = (ino_t) get_handle (); 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 (); } else - { + { path_conv spc ("/dev", PC_SYM_NOFOLLOW | PC_NULLEMPTY, NULL); buf->st_dev = spc.volser (); 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); if (pc.error) - { - set_errno (pc.error); + { + set_errno (pc.error); goto out; } if (pc.exists ()) - { + { set_errno (EADDRINUSE); goto out; } mode_t mode = (S_IRWXU | S_IRWXG | S_IRWXO) & ~cygheap->umask; DWORD attr = FILE_ATTRIBUTE_SYSTEM; if (!(mode & (S_IWUSR | S_IWGRP | S_IWOTH))) - attr |= FILE_ATTRIBUTE_READONLY; + attr |= FILE_ATTRIBUTE_READONLY; SECURITY_ATTRIBUTES sa = sec_none; 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); if (fh == INVALID_HANDLE_VALUE) - { + { if (GetLastError () == ERROR_ALREADY_EXISTS) set_errno (EADDRINUSE); else @@ -506,13 +506,13 @@ fhandler_socket::bind (const struct sockaddr *name, int namelen) get_connect_secret (strchr (buf, '\0')); DWORD blen = strlen (buf) + 1; if (!WriteFile (fh, buf, blen, &blen, 0)) - { + { __seterrno (); CloseHandle (fh); DeleteFile (pc); } else - { + { CloseHandle (fh); set_sun_path (un_addr->sun_path); res = 0; @@ -666,12 +666,12 @@ fhandler_socket::accept (struct sockaddr *peer, int *len) { sock_event evt; if (!evt.load (get_socket (), FD_ACCEPT_BIT)) - { + { set_winsock_errno (); return -1; } switch (evt.wait ()) - { + { case 1: /* Signal */ return -1; case 0: @@ -725,7 +725,7 @@ fhandler_socket::accept (struct sockaddr *peer, int *len) if (res_fd >= 0) res_fh = fdsock (res_fd, get_name (), res); if (res_fh) - { + { if (get_addr_family () == AF_LOCAL) res_fh->set_sun_path (get_sun_path ()); res_fh->set_addr_family (get_addr_family ()); @@ -734,7 +734,7 @@ fhandler_socket::accept (struct sockaddr *peer, int *len) res = res_fd; } else - { + { closesocket (res); res = -1; } @@ -840,9 +840,9 @@ fhandler_socket::recvfrom (void *ptr, size_t len, int flags, if (res == SOCKET_ERROR) { /* According to SUSv3, errno isn't set in that case and no error - condition is returned. */ + condition is returned. */ if (WSAGetLastError () == WSAEMSGSIZE) - return len; + return len; res = -1; set_winsock_errno (); diff --git a/winsup/cygwin/fhandler_virtual.cc b/winsup/cygwin/fhandler_virtual.cc index f8f3519..b0a7f07 100644 --- a/winsup/cygwin/fhandler_virtual.cc +++ b/winsup/cygwin/fhandler_virtual.cc @@ -75,7 +75,7 @@ fhandler_virtual::opendir (path_conv& pc) dir->__d_dirent->d_version = __DIRENT_VERSION; cygheap_fdnew fd; if (fd >= 0) - { + { fd = this; fd->set_nohandle (true); dir->__d_dirent->d_fd = fd; diff --git a/winsup/cygwin/mmap.cc b/winsup/cygwin/mmap.cc index 27b525a..accc739 100644 --- a/winsup/cygwin/mmap.cc +++ b/winsup/cygwin/mmap.cc @@ -123,7 +123,7 @@ mmap_record::alloc_map (__off64_t off, DWORD len) off -= offset_; len = PAGE_CNT (len) * getpagesize (); 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); if (off + len < size_to_map_ && !VirtualProtect (base_address_ + off + len, @@ -143,7 +143,7 @@ mmap_record::map_map (__off64_t off, DWORD len) { /* Used ONLY if this mapping matches into the chunk of another already performed mapping in a special case of MAP_ANON|MAP_PRIVATE. - + Otherwise it's job is now done by alloc_map(). */ DWORD prot, old_prot; switch (access_mode_) @@ -771,11 +771,11 @@ fhandler_disk_file::mmap (caddr_t *addr, size_t len, DWORD access, switch (access) { case FILE_MAP_WRITE: - protect = PAGE_READWRITE; - break; + protect = PAGE_READWRITE; + break; case FILE_MAP_READ: - protect = PAGE_READONLY; - break; + protect = PAGE_READONLY; + break; default: protect = PAGE_WRITECOPY; break; @@ -989,7 +989,7 @@ fixup_mmaps_after_fork (HANDLE parent) || !wincap.virtual_protect_works_on_shared_pages ()) { system_printf ("ReadProcessMemory failed for " - "MAP_PRIVATE address %p, %E", + "MAP_PRIVATE address %p, %E", rec->get_address ()); return -1; } @@ -1013,7 +1013,7 @@ fixup_mmaps_after_fork (HANDLE parent) address, getpagesize (), old_prot, &dummy_prot)) system_printf ("WARNING: VirtualProtectEx to " - "return to previous state " + "return to previous state " "in parent failed for " "MAP_PRIVATE address %p, %E", rec->get_address ()); diff --git a/winsup/cygwin/net.cc b/winsup/cygwin/net.cc index cfc716c..53c8eff 100644 --- a/winsup/cygwin/net.cc +++ b/winsup/cygwin/net.cc @@ -1968,7 +1968,7 @@ cygwin_rresvport (int *port) if (res_fd >= 0) fh = fdsock (res_fd, "/dev/tcp", res); if (fh) - res = res_fd; + res = res_fd; else res = -1; } @@ -2213,7 +2213,7 @@ socketpair (int family, int type, int protocol, int *sb) if (res == -1) { - closesocket (insock); + closesocket (insock); closesocket (outsock); } } diff --git a/winsup/cygwin/ntdll.h b/winsup/cygwin/ntdll.h index 768abc6..220cf3e 100644 --- a/winsup/cygwin/ntdll.h +++ b/winsup/cygwin/ntdll.h @@ -379,13 +379,13 @@ extern "C" NTSTATUS NTAPI NtQueryInformationFile (HANDLE, IO_STATUS_BLOCK *, VOID *, DWORD, DWORD); NTSTATUS NTAPI NtQueryInformationProcess (HANDLE, PROCESSINFOCLASS, - PVOID, ULONG, PULONG); + PVOID, ULONG, PULONG); NTSTATUS NTAPI NtQueryObject (HANDLE, OBJECT_INFORMATION_CLASS, VOID *, - ULONG, ULONG *); + ULONG, ULONG *); NTSTATUS NTAPI NtQuerySystemInformation (SYSTEM_INFORMATION_CLASS, PVOID, ULONG, PULONG); NTSTATUS NTAPI NtQueryVirtualMemory (HANDLE, PVOID, MEMORY_INFORMATION_CLASS, - PVOID, ULONG, PULONG); + PVOID, ULONG, PULONG); NTSTATUS NTAPI NtUnmapViewOfSection (HANDLE, PVOID); VOID NTAPI RtlInitUnicodeString (PUNICODE_STRING, PCWSTR); ULONG NTAPI RtlNtStatusToDosError (NTSTATUS); diff --git a/winsup/cygwin/path.cc b/winsup/cygwin/path.cc index 40a20fb..5b2e536 100644 --- a/winsup/cygwin/path.cc +++ b/winsup/cygwin/path.cc @@ -1124,7 +1124,7 @@ win32_device_name (const char *src_path, char *win32_path, strcpy (win32_path, src_path); while (c = strchr (win32_path, '/')) *c = '\\'; - break; + break; case FH_RANDOM: __small_sprintf (win32_path, devfmt, unit == 8 ? "" : "u"); break; diff --git a/winsup/cygwin/pwdgrp.h b/winsup/cygwin/pwdgrp.h index 40b1eeb..aea340d 100644 --- a/winsup/cygwin/pwdgrp.h +++ b/winsup/cygwin/pwdgrp.h @@ -72,7 +72,7 @@ public: if (!check && initialized) return; if (pglock->acquire () == 1 && - (!initialized || (check && etc::file_changed (etc_ix)))) + (!initialized || (check && etc::file_changed (etc_ix)))) (this->*read) (); pglock->release (); } diff --git a/winsup/cygwin/sec_acl.cc b/winsup/cygwin/sec_acl.cc index 8863da1..b929365 100644 --- a/winsup/cygwin/sec_acl.cc +++ b/winsup/cygwin/sec_acl.cc @@ -126,7 +126,7 @@ setacl (const char *file, int nentries, __aclent32_t *aclbufp) if (aclbufp[i].a_perm & S_IROTH) allow |= FILE_GENERIC_READ; if (aclbufp[i].a_perm & S_IWOTH) - { + { allow |= STANDARD_RIGHTS_WRITE | FILE_GENERIC_WRITE; /* Owner gets DELETE right, too. */ if ((aclbufp[i].a_type & ~ACL_DEFAULT) == USER_OBJ) diff --git a/winsup/cygwin/sec_helper.cc b/winsup/cygwin/sec_helper.cc index 6684083..c2e8c5e 100644 --- a/winsup/cygwin/sec_helper.cc +++ b/winsup/cygwin/sec_helper.cc @@ -83,7 +83,7 @@ cygpsid::get_id (BOOL search_grp, int *type) else if ((gr = internal_getgrsid (*this))) id = gr->gr_gid; if (id != ILLEGAL_UID) - { + { if (type) *type = GROUP; return id; @@ -97,7 +97,7 @@ cygpsid::get_id (BOOL search_grp, int *type) else if ((pw = internal_getpwsid (*this))) id = pw->pw_uid; if (id != ILLEGAL_UID && type) - *type = USER; + *type = USER; } return id; } diff --git a/winsup/cygwin/security.cc b/winsup/cygwin/security.cc index 847aa4a..ae6d5dd 100644 --- a/winsup/cygwin/security.cc +++ b/winsup/cygwin/security.cc @@ -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) strlcpy (domain, d + 2, u - d - 1); if (c - u <= UNLEN + 1) - strlcpy (user, u + 1, c - u); + strlcpy (user, u + 1, c - u); } if (domain[0]) return; diff --git a/winsup/cygwin/security.h b/winsup/cygwin/security.h index a859526..2965b1d 100644 --- a/winsup/cygwin/security.h +++ b/winsup/cygwin/security.h @@ -115,7 +115,7 @@ public: BOOL add (const PSID nsi) /* Only with auto for now */ { if (count >= maxcount) - { + { cygsid *tmp = new cygsid [ 2 * maxcount]; if (!tmp) return FALSE; @@ -176,7 +176,7 @@ public: void clear_supp () { if (issetgroups ()) - { + { sgsids.free_sids (); ischanged = TRUE; } diff --git a/winsup/cygwin/string.h b/winsup/cygwin/string.h index 0ac9745..1ad9021 100644 --- a/winsup/cygwin/string.h +++ b/winsup/cygwin/string.h @@ -85,7 +85,7 @@ cygwin_strcasematch (const char *cs, const char *ct) jmp 4f \n\ 3: xor %0,%0 \n\ 4:" - :"=a" (__res), "=&S" (d0), "=&D" (d1) + :"=a" (__res), "=&S" (d0), "=&D" (d1) : "1" (cs), "2" (ct)); return __res; diff --git a/winsup/cygwin/syscalls.cc b/winsup/cygwin/syscalls.cc index 3551723..43b17bb 100644 --- a/winsup/cygwin/syscalls.cc +++ b/winsup/cygwin/syscalls.cc @@ -159,7 +159,6 @@ unlink (const char *ourname) } } - /* Try a delete with attributes reset */ if (DeleteFile (win32_name)) { -- cgit v1.1