white space

This commit is contained in:
Christopher Faylor 2006-05-28 15:50:14 +00:00
parent 29d1e62ed2
commit 34f5d0879c
19 changed files with 91 additions and 91 deletions

View File

@ -70,7 +70,7 @@ public:
DWORD proc_retry (HANDLE) __attribute__ ((regparm (2)));
bool isstraced () const {return !!(flag & _CI_STRACED);}
bool iscygwin () const {return !!(flag & _CI_ISCYGWIN);}
bool saw_ctrl_c () const {return !!(flag & _CI_SAW_CTRL_C);}
bool saw_ctrl_c () const {return !!(flag & _CI_SAW_CTRL_C);}
void set_saw_ctrl_c () {flag |= _CI_SAW_CTRL_C;}
};

View File

@ -486,7 +486,7 @@ child_info_fork::alloc_stack_hard_way (volatile char *b)
api_fatal ("fork: can't reserve memory for stack %p - %p, %E",
stacktop, stackbottom);
new_stack_pointer = (void *) ((LPBYTE) stackbottom - stacksize);
new_stack_pointer = (void *) ((LPBYTE) stackbottom - stacksize);
if (!VirtualAlloc (new_stack_pointer, stacksize, MEM_COMMIT,
PAGE_EXECUTE_READWRITE))
api_fatal ("fork: can't commit memory for stack %p(%d), %E",

View File

@ -119,13 +119,13 @@ readdir_worker (DIR *dir, dirent *de)
else if (de->d_name[1] == '.' && de->d_name[2] == '\0')
is_dot_dot = true;
}
if (is_dot_dot && !(dir->__flags & dirent_isroot))
de->d_ino = readdir_get_ino (dir,
((fhandler_base *) dir->__fh)->get_name (),
true);
else
{
{
/* Compute d_ino by combining filename hash with directory hash. */
de->d_ino = ((fhandler_base *) dir->__fh)->get_namehash ();
if (!is_dot && !is_dot_dot)
@ -134,7 +134,7 @@ readdir_worker (DIR *dir, dirent *de)
DWORD devn = ((fhandler_base *) dir->__fh)->get_device ();
/* Paths below /proc don't have a Win32 pendant. */
if (devn == FH_PROC || devn == FH_PROCESS || devn == FH_REGISTRY)
de->d_ino = hash_path_name (de->d_ino, "/");
de->d_ino = hash_path_name (de->d_ino, "/");
/* A drive's root dir has a trailing backslash already. */
else if (w32name[1] != ':' || w32name[2] != '\\' || w32name[3])
de->d_ino = hash_path_name (de->d_ino, "\\");

View File

@ -219,7 +219,7 @@ my_findenv (const char *name, int *offset)
MALLOC_CHECK;
return NULL;
}
/* Primitive getenv before the environment is built. */
static char __stdcall *

View File

@ -531,7 +531,7 @@ _cygtls::handle_exceptions (EXCEPTION_RECORD *e, exception_list *frame, CONTEXT
si.si_code = BUS_OBJERR;
}
else
{
{
MEMORY_BASIC_INFORMATION m;
VirtualQuery ((PVOID) e->ExceptionInformation[1], &m, sizeof m);
si.si_signo = SIGSEGV;
@ -1052,7 +1052,7 @@ sigset (int sig, _sig_func_ptr func)
else
{
/* No error checking. The test which could return SIG_ERR has already
been made above. */
been made above. */
signal (sig, func);
sigdelset (&mask, sig);
}

View File

@ -72,7 +72,7 @@ public:
__ino64_t check_mount (const char *name, __ino64_t ino, bool eval = true)
{
if (parent_dir_len == 1) /* root dir */
{
{
if (strcasematch (name, "proc"))
{
found[__DIR_PROC] = true;
@ -97,14 +97,14 @@ public:
__ino64_t check_missing_mount (char *ret_name, bool eval = true)
{
for (int i = 0; i < count; ++i)
if (!found[i])
if (!found[i])
{
found[i] = true;
strcpy (ret_name, mounts[i]);
return eval ? eval_ino (i) : 1;
}
if (parent_dir_len == 1) /* root dir */
{
{
if (!found[__DIR_PROC])
{
found[__DIR_PROC] = true;
@ -115,7 +115,7 @@ public:
{
found[__DIR_CYGDRIVE] = true;
if (mount_table->cygdrive_len > 1)
{
{
strncpy (ret_name, mount_table->cygdrive + 1,
mount_table->cygdrive_len - 2);
ret_name[mount_table->cygdrive_len - 2] = '\0';
@ -202,7 +202,7 @@ path_conv::isgood_inode (__ino64_t ino) const
/* We can't trust remote inode numbers of only 32 bit. That means,
all remote inode numbers when running under NT4, as well as remote NT4
NTFS, as well as shares of Samba version < 3.0.
The known exception are SFU NFS shares, which return the valid 32 bit
The known exception are SFU NFS shares, which return the valid 32 bit
inode number from the remote file system unchanged. */
return hasgood_inode () && (ino > UINT32_MAX || !isremote () || fs_is_nfs ());
}
@ -222,7 +222,7 @@ fhandler_base::fstat_by_handle (struct __stat64 *buf)
const DWORD fai_size = 2 * CYG_MAX_PATH + sizeof (FILE_ALL_INFORMATION);
PFILE_FS_VOLUME_INFORMATION pfvi = (PFILE_FS_VOLUME_INFORMATION)
alloca (fvi_size);
alloca (fvi_size);
PFILE_ALL_INFORMATION pfai = (PFILE_ALL_INFORMATION) alloca (fai_size);
status = NtQueryVolumeInformationFile (get_handle (), &io, pfvi, fvi_size,
@ -849,17 +849,17 @@ fhandler_disk_file::link (const char *newpath)
newpc.check (newpath, PC_SYM_NOFOLLOW);
}
else if (transparent_exe
&& !pc.isdir ()
&& GetBinaryType (pc, &bintype)
&& (len = strlen (newpc)) > 4
&& !strcasematch ((const char *) newpc + len - 4, ".exe"))
{
/* Executable hack. */
strcpy (new_buf, newpath);
strcat (new_buf, ".exe");
newpath = new_buf;
newpc.check (newpath, PC_SYM_NOFOLLOW);
}
&& !pc.isdir ()
&& GetBinaryType (pc, &bintype)
&& (len = strlen (newpc)) > 4
&& !strcasematch ((const char *) newpc + len - 4, ".exe"))
{
/* Executable hack. */
strcpy (new_buf, newpath);
strcat (new_buf, ".exe");
newpath = new_buf;
newpc.check (newpath, PC_SYM_NOFOLLOW);
}
}
query_open (query_write_attributes);
@ -1474,7 +1474,7 @@ fhandler_disk_file::opendir ()
else if ((dir = (DIR *) malloc (sizeof (DIR))) == NULL)
set_errno (ENOMEM);
else if ((dir->__d_dirname = (char *) malloc (wincap.is_winnt ()
? sizeof (struct __DIR_cache)
? sizeof (struct __DIR_cache)
: len + 3)) == NULL)
{
set_errno (ENOMEM);
@ -1505,7 +1505,7 @@ fhandler_disk_file::opendir ()
teeny little bit faster. */
len = strlen (d_dirname (dir));
if (len && !isdirsep (d_dirname (dir)[len - 1]))
strcpy (d_dirname (dir) + len, "\\");
strcpy (d_dirname (dir) + len, "\\");
dir->__d_cookie = __DIRENT_COOKIE;
dir->__handle = INVALID_HANDLE_VALUE;
dir->__d_position = 0;
@ -1538,7 +1538,7 @@ fhandler_disk_file::opendir ()
}
/* FileIdBothDirectoryInformation is apparently unsupported on
XP when accessing directories on UDF. When trying to use it
XP when accessing directories on UDF. When trying to use it
so, NtQueryDirectoryFile returns with STATUS_ACCESS_VIOLATION.
It's not clear if the call isn't also unsupported on other
OS/FS combinations (say, Win2K/CDFS or so). Instead of
@ -1602,7 +1602,7 @@ fhandler_disk_file::readdir_helper (DIR *dir, dirent *de, DWORD w32_err,
{
bool added = false;
if ((de->d_ino = d_mounts (dir)->check_missing_mount (fname)))
added = true;
added = true;
if (!added)
return geterrno_from_win_error (w32_err);
@ -1729,7 +1729,7 @@ fhandler_disk_file::readdir (DIR *dir, dirent *de)
{
buf = (PFILE_ID_BOTH_DIR_INFORMATION) (d_cache (dir) + d_cachepos (dir));
if (buf->NextEntryOffset == 0)
d_cachepos (dir) = 0;
d_cachepos (dir) = 0;
else
d_cachepos (dir) += buf->NextEntryOffset;
if ((dir->__flags & dirent_get_d_ino))
@ -1737,9 +1737,9 @@ fhandler_disk_file::readdir (DIR *dir, dirent *de)
FileName = buf->FileName;
if ((dir->__flags & dirent_set_d_ino))
de->d_ino = buf->FileId.QuadPart;
}
}
else
FileName = ((PFILE_BOTH_DIR_INFORMATION) buf)->FileName;
FileName = ((PFILE_BOTH_DIR_INFORMATION) buf)->FileName;
sys_wcstombs (fname, CYG_MAX_PATH - 1, FileName, buf->FileNameLength / 2);
de->d_ino = d_mounts (dir)->check_mount (fname, de->d_ino);
@ -1975,7 +1975,7 @@ fhandler_cygdrive::readdir (DIR *dir, dirent *de)
while (true)
{
if (!pdrive || !*pdrive)
{
{
if (!(dir->__flags & dirent_saw_dot))
{
de->d_name[0] = '.';
@ -1983,9 +1983,9 @@ fhandler_cygdrive::readdir (DIR *dir, dirent *de)
de->d_ino = 2;
}
return ENMFILE;
}
}
if (GetFileAttributes (pdrive) != INVALID_FILE_ATTRIBUTES)
break;
break;
pdrive = strchr (pdrive, '\0') + 1;
}
*de->d_name = cyg_tolower (*pdrive);

View File

@ -87,17 +87,17 @@ fhandler_dev_floppy::get_drive_info (struct hd_geometry *geo)
if (!di)
{
/* Up to Win2K, even IOCTL_DISK_GET_DRIVE_GEOMETRY fails when trying
it on CD or DVD drives. In that case fall back to requesting
it on CD or DVD drives. In that case fall back to requesting
simple file system information. */
NTSTATUS status;
IO_STATUS_BLOCK io;
FILE_FS_SIZE_INFORMATION ffsi;
status = NtQueryVolumeInformationFile (get_handle (), &io, &ffsi,
sizeof ffsi,
FileFsSizeInformation);
if (!NT_SUCCESS (status))
{
{
__seterrno_from_nt_status (status);
return -1;
}
@ -108,9 +108,9 @@ fhandler_dev_floppy::get_drive_info (struct hd_geometry *geo)
bytes_per_sector = ffsi.BytesPerSector;
drive_size = ffsi.TotalAllocationUnits.QuadPart
* ffsi.SectorsPerAllocationUnit
* ffsi.BytesPerSector;
* ffsi.BytesPerSector;
if (geo)
{
{
geo->heads = 1;
geo->sectors = ffsi.SectorsPerAllocationUnit;
geo->cylinders = ffsi.TotalAllocationUnits.LowPart;
@ -163,7 +163,7 @@ fhandler_dev_floppy::get_drive_info (struct hd_geometry *geo)
}
}
debug_printf ("drive size: %D", drive_size);
return 0;
}

View File

@ -991,7 +991,7 @@ format_proc_partitions (char *destbuf, size_t maxsize)
|| !isdigit (devname[8]))
continue;
/* Construct path name for partition 0, which is the whole disk,
and try to open. */
and try to open. */
wcscpy (wpath, dbi->ObjectName.Buffer);
wcscpy (wpath + dbi->ObjectName.Length / 2, L"\\Partition0");
upath.Length = 22 + dbi->ObjectName.Length;

View File

@ -592,10 +592,10 @@ address_in_use (struct sockaddr_in *addr)
{
tab = (PMIB_TCPTABLE) alloca (size);
if (!GetTcpTable (tab, &size, FALSE))
{
{
for (i = tab->dwNumEntries, entry = tab->table; i > 0; --i, ++entry)
if (entry->dwLocalAddr == addr->sin_addr.s_addr
&& entry->dwLocalPort == addr->sin_port
&& entry->dwLocalPort == addr->sin_port
&& entry->dwState >= MIB_TCP_STATE_LISTEN
&& entry->dwState <= MIB_TCP_STATE_LAST_ACK)
return true;
@ -688,14 +688,14 @@ fhandler_socket::bind (const struct sockaddr *name, int namelen)
else
{
/* If the application didn't explicitely call setsockopt (SO_REUSEADDR),
enforce exclusive local address use using the SO_EXCLUSIVEADDRUSE
enforce exclusive local address use using the SO_EXCLUSIVEADDRUSE
socket option, to emulate POSIX socket behaviour more closely.
KB 870562: Note that this option is only available since NT4 SP4.
Also note that a bug in Win2K SP1-3 and XP up to SP1 only enables
this option for users in the local administrators group. */
if (wincap.has_exclusiveaddruse ())
{
{
if (!saw_reuseaddr ())
{
int on = 1;
@ -708,7 +708,7 @@ fhandler_socket::bind (const struct sockaddr *name, int namelen)
{
debug_printf ("SO_REUSEADDR set");
/* There's a bug in SO_REUSEADDR handling in WinSock.
Per standards, we must not be able to reuse a complete
Per standards, we must not be able to reuse a complete
duplicate of a local TCP address (same IP, same port),
even if SO_REUSEADDR has been set. That's unfortunately
possible in WinSock. So we're testing here if the local
@ -716,8 +716,8 @@ fhandler_socket::bind (const struct sockaddr *name, int namelen)
only works for OSes with IP Helper support. */
if (get_socket_type () == SOCK_STREAM
&& wincap.has_ip_helper_lib ()
&& address_in_use ((struct sockaddr_in *) name))
{
&& address_in_use ((struct sockaddr_in *) name))
{
debug_printf ("Local address in use, don't bind");
set_errno (EADDRINUSE);
goto out;
@ -1015,14 +1015,14 @@ sa_restart:
}
if (evts.lNetworkEvents & FD_ACCEPT)
{
if (evts.iErrorCode[FD_ACCEPT_BIT])
if (evts.iErrorCode[FD_ACCEPT_BIT])
wsa_err = evts.iErrorCode[FD_ACCEPT_BIT];
else
ret = 0;
}
if (evts.lNetworkEvents & FD_CONNECT)
{
if (evts.iErrorCode[FD_CONNECT_BIT])
if (evts.iErrorCode[FD_CONNECT_BIT])
wsa_err = evts.iErrorCode[FD_CONNECT_BIT];
else
ret = 0;

View File

@ -16,19 +16,19 @@ details. */
/* Various options should be defined here, but the framework to do this
is not laid down so far. Especially notable are the following defines,
which can be used by the application to switch on or off various
which can be used by the application to switch on or off various
datatypes and function prototypes:
_BSD_SOURCE to include pure BSD functions which are not defined
under POSIX.
under POSIX.
_POSIX_SOURCE if the application requests a POSIX compatible system.
_XOPEN_SOURCE if X/Open functions and datatypes are requested. This
option includes _POSIX_SOURCE.
option includes _POSIX_SOURCE.
_GNU_SOURCE to turn on GNU extensions which might collide with defines
used in application or library headers. This option
used in application or library headers. This option
includes _BSD_SOURCE, _XOPEN_SOURCE and _POSIX_SOURCE.
*/

View File

@ -320,8 +320,8 @@ int tcsendbreak (int, int);
int tcdrain (int);
int tcflush (int, int);
int tcflow (int, int);
int cfsetispeed (struct termios *, speed_t);
int cfsetospeed (struct termios *, speed_t);
int cfsetispeed (struct termios *, speed_t);
int cfsetospeed (struct termios *, speed_t);
#ifdef __cplusplus
}

View File

@ -217,7 +217,7 @@ int __stdcall
sys_wcstombs (char *tgt, int tlen, const WCHAR *src, int slen)
{
int ret;
ret = WideCharToMultiByte (get_cp (), 0, src, slen, tgt, tlen, NULL, NULL);
if (ret)
tgt[ret < tlen ? ret : tlen - 1] = '\0';

View File

@ -1110,7 +1110,7 @@ mmap64 (void *addr, size_t len, int prot, int flags, int fd, _off64_t off)
It neither allows to create reserved pages in the shared memory
area, nor does it allow to create page aligend mappings (in
contrast to granularity aligned mappings).
Note that this isn't done in WOW64 environments since apparently
WOW64 does not support the AT_ROUND_TO_PAGE flag which is required
to get this right. Too bad. */

View File

@ -671,7 +671,7 @@ convert_ws1_ip_optname (int optname)
IP_DONTFRAGMENT
};
return (optname < 1 || optname > _WS1_IP_DONTFRAGMENT)
? optname
? optname
: ws2_optname[optname];
}
@ -699,9 +699,9 @@ cygwin_setsockopt (int fd, int level, int optname, const void *optval,
syscall_printf ("setsockopt optval=%x", *(long *) optval);
if (res)
{
{
/* KB 248611:
Windows 2000 and above don't support setting the IP_TOS field
with setsockopt. Additionally, TOS was always (also under 9x
and NT) only implemented for UDP and ICMP, never for TCP.
@ -732,7 +732,7 @@ cygwin_setsockopt (int fd, int level, int optname, const void *optval,
set_winsock_errno ();
}
else if (level == SOL_SOCKET && optname == SO_REUSEADDR)
fh->saw_reuseaddr (*(int *) optval);
fh->saw_reuseaddr (*(int *) optval);
}
syscall_printf ("%d = setsockopt (%d, %d, %x, %p, %d)",
@ -1849,8 +1849,8 @@ cygwin_rcmd (char **ahost, unsigned short inport, char *locuser,
a problem in Winsock. The bind(2) call does not fail if a local
address is still in TIME_WAIT state, and there's no way to get this
behaviour. Unfortunately the first time when this is detected is when
the calling application tries to connect.
the calling application tries to connect.
One (also not really foolproof) way around this problem would be to use
the iphlpapi function GetTcpTable and to check if the port in question is
in TIME_WAIT state and if so, choose another port number. But this method
@ -1912,7 +1912,7 @@ cygwin_rresvport (int *port)
res = (int) INVALID_SOCKET;
}
else if (port)
*port = myport;
*port = myport;
}
if (res != (int) INVALID_SOCKET)

View File

@ -219,7 +219,7 @@ has_dot_last_component (const char *dir)
path following Win32 rules. */
const char *last_comp = strrchr (dir, '/');
return last_comp
&& last_comp[1] == '.'
&& last_comp[1] == '.'
&& (last_comp[2] == '\0'
|| (last_comp[2] == '.' && last_comp[3] == '\0'));
}
@ -977,14 +977,14 @@ out:
else if (!tail)
tail = p;
if (tail && p[1] == '\\')
{
{
if (p > tail || *tail != '.')
{
error = ENOENT;
return;
}
tail = NULL;
}
}
}
if (!tail || tail == path)
@ -1740,9 +1740,9 @@ mount_info::get_mounts_here (const char *parent_dir, int parent_dir_len,
mount_item *mi = mount + posix_sorted[i];
char *last_slash = strrchr (mi->posix_path, '/');
if (!last_slash)
continue;
continue;
if (last_slash == mi->posix_path)
{
{
if (parent_dir_len == 1 && mi->posix_pathlen > 1)
mount_points[n_mounts++] = last_slash + 1;
}
@ -2813,7 +2813,7 @@ symlink_worker (const char *oldpath, const char *newpath, bool use_winsym,
if (GetFileAttributes (reloldpath) == INVALID_FILE_ATTRIBUTES)
{
win32_oldpath.check (oldpath, PC_SYM_NOFOLLOW,
transparent_exe ? stat_suffixes : NULL);
transparent_exe ? stat_suffixes : NULL);
if (win32_oldpath.error != ENOENT)
strcpy (use_winsym ? reloldpath : w32oldpath, win32_oldpath);
}
@ -2822,7 +2822,7 @@ symlink_worker (const char *oldpath, const char *newpath, bool use_winsym,
if (use_winsym)
{
win32_oldpath.check (oldpath, PC_SYM_NOFOLLOW,
transparent_exe ? stat_suffixes : NULL);
transparent_exe ? stat_suffixes : NULL);
strcpy (w32oldpath, win32_oldpath);
}
if (cp)
@ -3787,7 +3787,7 @@ realpath (const char *path, char *resolved)
/* Check for the suffix being tacked on. */
int tack_on = 0;
if (!transparent_exe && real_path.known_suffix)
{
{
char *c = strrchr (real_path.normalized_path, '.');
if (!c || !strcasematch (c, real_path.known_suffix))
tack_on = strlen (real_path.known_suffix);

View File

@ -918,7 +918,7 @@ av::fixup (const char *prog_arg, path_conv& real_path, const char *ext)
HANDLE hm = CreateFileMapping (h, &sec_none_nih, PAGE_READONLY, 0, 0, NULL);
CloseHandle (h);
if (!hm)
{
{
/* ERROR_FILE_INVALID indicates very likely an empty file. */
if (GetLastError () == ERROR_FILE_INVALID)
{

View File

@ -143,7 +143,7 @@ unlink (const char *ourname)
DWORD devn;
path_conv win32_name (ourname, PC_SYM_NOFOLLOW,
transparent_exe ? stat_suffixes : NULL);
transparent_exe ? stat_suffixes : NULL);
if (win32_name.error)
{
@ -1232,7 +1232,7 @@ rename (const char *oldpath, const char *newpath)
&& GetBinaryType (real_old, &bintype)
&& (len = strlen (real_new)) > 4
&& !strcasematch ((const char *) real_new + len - 4, ".exe"))
{
{
/* Executable hack. */
strcpy (new_buf, newpath);
strcat (new_buf, ".exe");
@ -1373,12 +1373,12 @@ done:
}
/* Shortcut hack, No. 3, part 2 */
/* If a file with the given name exists, it must be deleted after the
symlink has been renamed. Otherwise we end up with two files of
symlink has been renamed. Otherwise we end up with two files of
the same name in the directory, one file "newpath", which already
exited before rename has been called, and one file "newpath.lnk",
which is the result of the rename operation. */
else if (no_lnk_file_exists)
{
{
lnk_suffix = strrchr (real_new.get_win32 (), '.');
*lnk_suffix = '\0';
DeleteFile (real_new);
@ -1878,9 +1878,9 @@ statvfs (const char *fname, struct statvfs *sfs)
OPEN_EXISTING,
FILE_FLAG_BACKUP_SEMANTICS, NULL);
if (hdl == INVALID_HANDLE_VALUE)
debug_printf ("CreateFile (%s) failed, %E", (char *) full_path);
debug_printf ("CreateFile (%s) failed, %E", (char *) full_path);
else
{
{
NTFS_VOLUME_DATA_BUFFER nvdb;
DWORD bytes;
if (!DeviceIoControl (hdl, FSCTL_GET_NTFS_VOLUME_DATA, NULL,

View File

@ -127,19 +127,19 @@ sysconf (int in)
case _SC_MEMLOCK_RANGE:
return _POSIX_MEMLOCK_RANGE;
case _SC_SEMAPHORES:
return _POSIX_SEMAPHORES;
return _POSIX_SEMAPHORES;
case _SC_THREADS:
return _POSIX_THREADS;
return _POSIX_THREADS;
case _SC_THREAD_ATTR_STACKSIZE:
return _POSIX_THREAD_ATTR_STACKSIZE;
return _POSIX_THREAD_ATTR_STACKSIZE;
case _SC_THREAD_PRIORITY_SCHEDULING:
return _POSIX_THREAD_PRIORITY_SCHEDULING;
return _POSIX_THREAD_PRIORITY_SCHEDULING;
case _SC_THREAD_PROCESS_SHARED:
return _POSIX_THREAD_PROCESS_SHARED;
return _POSIX_THREAD_PROCESS_SHARED;
case _SC_THREAD_SAFE_FUNCTIONS:
return _POSIX_THREAD_SAFE_FUNCTIONS;
return _POSIX_THREAD_SAFE_FUNCTIONS;
case _SC_TIMERS:
return _POSIX_TIMERS;
return _POSIX_TIMERS;
}
/* Invalid input or unimplemented sysconf name */

View File

@ -256,7 +256,7 @@ try_connect_syslogd (int priority, const char *msg, int len)
ret = writev (syslogd_sock, iv, 2);
/* If the syslog daemon has been restarted and /dev/log was
a stream socket, the connection is broken. In this case,
a stream socket, the connection is broken. In this case,
try to reopen the socket and try again. */
if (ret < 0 && syslogd_inited == inited_stream)
{