[prev in list] [next in list] [prev in thread] [next in thread]
List: wine-devel
Subject: Use debugstr_errno
From: Uwe Bonnes <bon () elektron ! ikp ! physik ! tu-darmstadt ! de>
Date: 2000-01-30 15:50:53
[Download RAW message or body]
Hallo,
appended patch uses the debugstr_errno function when we deal with
errno(). It removes the inclusion of sys/errno.h, cleans up the usage
of errno() after output in files/directory.c (printf sets
errno()itself)and removes some unconditional usage of strerr.
Bye
Changelog
misc/comm.c,misc/printdrv.c,misc/registry.c,
dlls/winaspi/winaspi16.c,dlls/wnaspi32/winaspi32.c,
dlls/winsock/socket.c,dlls/winsock/async.c,
dlls/winmm/wineoss/midi.c,dlls/winmm/joystick.c,
dlls/icmp/icmp_main.c,
loader/dos/module.c,loader/dos/dosvm.c,
files/directory.c,files/file.c,files/dos_fs.c,
win32/console.c,win32/file.c,
memory/virtual.c,
windows/dinput.c,
Uwe Bonnes bon@elektron.ikp.physik.tu-darmstadt.de
Free Software: If you contribute nothing, expect nothing
--
Index: wine/misc/comm.c
===================================================================
RCS file: /home/wine/wine/misc/comm.c,v
retrieving revision 1.31
diff -u -r1.31 comm.c
--- wine/misc/comm.c 2000/01/05 01:46:53 1.31
+++ wine/misc/comm.c 2000/01/30 15:42:24
@@ -186,8 +186,9 @@
static int WinError(void)
{
- TRACE("errno = %d\n", errno);
- switch (errno) {
+ int save_errno = errno;
+ TRACE("errno '%s'\n", debugstr_errno(save_errno));
+ switch (save_errno) {
default:
return CE_IOE;
}
@@ -438,7 +439,7 @@
fd = open(COM[port].devicename, O_RDWR | O_NONBLOCK);
if (fd == -1) {
- ERR("error=%d\n", errno);
+ ERR("error '%s'\n", debugstr_errno(errno));
return IE_HARDWARE;
} else {
unknown[port] = SEGPTR_ALLOC(40);
@@ -1913,11 +1914,7 @@
int save_error = errno;
commerror = WinError();
close( fd );
-#ifdef HAVE_STRERROR
- ERR("tcgetattr error '%s'\n", strerror(save_error));
-#else
- ERR("tcgetattr error %d\n", save_error);
-#endif
+ ERR("tcgetattr error '%s'\n", debugstr_errno(save_error));
return FALSE;
}
@@ -2140,11 +2137,7 @@
int save_error=errno;
commerror = WinError();
close( fd );
-#ifdef HAVE_STRERROR
- ERR("tcgetattr error '%s'\n", strerror(save_error));
-#else
- ERR("tcgetattr error %d\n", save_error);
-#endif
+ ERR("tcgetattr error '%s'\n", debugstr_errno(save_error));
return FALSE;
} else {
commerror = 0;
@@ -2171,11 +2164,7 @@
}
if (tcgetattr(fd, &port) == -1) {
int save_error=errno;
-#ifdef HAVE_STRERROR
- ERR("tcgetattr error '%s'\n", strerror(save_error));
-#else
- ERR("tcgetattr error %d\n", save_error);
-#endif
+ ERR("tcgetattr error '%s'\n", debugstr_errno(save_error));
commerror = WinError();
close( fd );
return FALSE;
Index: wine/misc/printdrv.c
===================================================================
RCS file: /home/wine/wine/misc/printdrv.c,v
retrieving revision 1.28
diff -u -r1.28 printdrv.c
--- wine/misc/printdrv.c 1999/10/31 01:49:30 1.28
+++ wine/misc/printdrv.c 2000/01/30 15:42:25
@@ -471,8 +471,8 @@
if ((fd = open(psCmdP, O_CREAT | O_TRUNC | O_WRONLY , 0600)) < 0)
{
- ERR("Failed to create spool file %s, errno = %d\n",
- psCmdP, errno);
+ ERR("Failed to create spool file %s, errno '%s'\n",
+ psCmdP, debugstr_errno(errno));
}
}
return fd;
Index: wine/misc/registry.c
===================================================================
RCS file: /home/wine/wine/misc/registry.c,v
retrieving revision 1.58
diff -u -r1.58 registry.c
--- wine/misc/registry.c 2000/01/30 03:03:24 1.58
+++ wine/misc/registry.c 2000/01/30 15:42:27
@@ -26,9 +26,6 @@
#include <unistd.h>
#include <ctype.h>
#include <errno.h>
-#ifdef HAVE_SYS_ERRNO_H
-#include <sys/errno.h>
-#endif
#include <sys/types.h>
#include <fcntl.h>
#include <sys/fcntl.h>
@@ -652,7 +649,7 @@
F = fopen(fn,"rb");
if (F==NULL) {
- WARN("Couldn't open %s for reading: %s\n",fn,strerror(errno) );
+ WARN("Couldn't open %s for reading: %s\n",fn,debugstr_errno(errno) );
return;
}
_wine_loadsubreg(F,hkey,fn);
Index: wine/dlls/wnaspi32/winaspi32.c
===================================================================
RCS file: /home/wine/wine/dlls/wnaspi32/winaspi32.c,v
retrieving revision 1.17
diff -u -r1.17 winaspi32.c
--- wine/dlls/wnaspi32/winaspi32.c 2000/01/09 21:42:42 1.17
+++ wine/dlls/wnaspi32/winaspi32.c 2000/01/30 15:42:28
@@ -107,11 +107,7 @@
fd = open(device_str, O_RDWR);
if (fd == -1) {
int save_error = errno;
-#ifdef HAVE_STRERROR
- ERR("Error opening device %s, error '%s'\n", device_str, strerror(save_error));
-#else
- ERR("Error opening device %s, error %d\n", device_str, save_error);
-#endif
+ ERR("Error opening device %s, error '%s'\n", device_str, \
debugstr_errno(save_error)); return -1;
}
@@ -297,11 +293,7 @@
if (save_error == ENOMEM) {
MESSAGE("ASPI: Linux generic scsi driver\n You probably need to re-compile \
your kernel with a larger SG_BIG_BUFF value (sg.h)\n Suggest 130560\n"); }
-#ifdef HAVE_STRERROR
- WARN("error:= '%s'\n", strerror(save_error));
-#else
- WARN("error:= %d\n", save_error);
-#endif
+ WARN("error:= '%s'\n", debugstr_errno(save_error));
}
goto error_exit;
}
Index: wine/dlls/winsock/socket.c
===================================================================
RCS file: /home/wine/wine/dlls/winsock/socket.c,v
retrieving revision 1.2
diff -u -r1.2 socket.c
--- wine/dlls/winsock/socket.c 2000/01/24 21:58:06 1.2
+++ wine/dlls/winsock/socket.c 2000/01/30 15:42:30
@@ -57,9 +57,6 @@
#include <ctype.h>
#include <fcntl.h>
#include <errno.h>
-#ifdef HAVE_SYS_ERRNO_H
-#include <sys/errno.h>
-#endif
#include <netdb.h>
#include <unistd.h>
#include <stdlib.h>
@@ -805,7 +802,7 @@
if ( bind(fd, name, namelen) < 0 )
{
int loc_errno = errno;
- WARN("\tfailure - errno = %i\n", errno);
+ WARN("\tfailure - errno '%s'\n", debugstr_errno(errno));
errno = loc_errno;
switch(errno)
{
@@ -2595,11 +2592,7 @@
UINT16 wsaErrno(void)
{
int loc_errno = errno;
-#ifdef HAVE_STRERROR
- WARN("errno %d, (%s).\n", loc_errno, strerror(loc_errno));
-#else
- WARN("errno %d\n", loc_errno);
-#endif
+ WARN("errno %d, (%s).\n", loc_errno, debugstr_errno(loc_errno));
switch(loc_errno)
{
Index: wine/dlls/winsock/async.c
===================================================================
RCS file: /home/wine/wine/dlls/winsock/async.c,v
retrieving revision 1.1
diff -u -r1.1 async.c
--- wine/dlls/winsock/async.c 2000/01/23 22:07:15 1.1
+++ wine/dlls/winsock/async.c 2000/01/30 15:42:31
@@ -63,9 +63,6 @@
#include <ctype.h>
#include <fcntl.h>
#include <errno.h>
-#ifdef HAVE_SYS_ERRNO_H
-#include <sys/errno.h>
-#endif
#include <netdb.h>
#include <unistd.h>
#include <stdlib.h>
Index: wine/dlls/winmm/wineoss/midi.c
===================================================================
RCS file: /home/wine/wine/dlls/winmm/wineoss/midi.c,v
retrieving revision 1.3
diff -u -r1.3 midi.c
--- wine/dlls/winmm/wineoss/midi.c 1999/12/05 02:19:24 1.3
+++ wine/dlls/winmm/wineoss/midi.c 2000/01/30 15:42:35
@@ -381,14 +381,14 @@
if (midiSeqFD == -1) {
/* don't bark when we're facing a config without midi driver available */
if (errno != ENODEV && errno != ENXIO) {
- ERR("can't open '%s' ! (%d)\n", MIDI_SEQ, errno);
+ ERR("can't open '%s' ! '%s'\n", MIDI_SEQ, debugstr_errno(errno));
} else {
TRACE("No midi device present\n");
}
return -1;
}
if (fcntl(midiSeqFD, F_SETFL, O_NONBLOCK) < 0) {
- WARN("can't set sequencer fd to non blocking (%d)\n", errno);
+ WARN("can't set sequencer fd to non blocking '%s'\n", debugstr_errno(errno));
close(midiSeqFD);
midiSeqFD = -1;
return -1;
@@ -424,8 +424,8 @@
{
if (_seqbufptr) {
if (write(midiSeqFD, _seqbuf, _seqbufptr) == -1) {
- WARN("Can't write data to sequencer (%d/%d)!\n",
- midiSeqFD, errno);
+ WARN("Can't write data to sequencer (%d/'%s')!\n",
+ midiSeqFD, debugstr_errno(errno));
}
/* FIXME:
* in any case buffer is lost so that if many errors occur the buffer
@@ -555,7 +555,7 @@
if (len < 0) return;
if ((len % 4) != 0) {
- WARN("bad length %d (%d)\n", len, errno);
+ WARN("bad length %d '%s'\n", len, debugstr_errno(errno));
return;
}
@@ -898,7 +898,7 @@
memcpy(sbi.operators, midiFMInstrumentPatches + i * 16, 16);
if (write(midiSeqFD, (char*)&sbi, sizeof(sbi)) == -1) {
- WARN("Couldn't write patch for instrument %d (%d)!\n", sbi.channel, errno);
+ WARN("Couldn't write patch for instrument %d '%s'!\n", sbi.channel, \
debugstr_errno(errno)); return -1;
}
}
@@ -907,7 +907,7 @@
memcpy(sbi.operators, midiFMDrumsPatches + i * 16, 16);
if (write(midiSeqFD, (char*)&sbi, sizeof(sbi)) == -1) {
- WARN("Couldn't write patch for drum %d (%d)!\n", sbi.channel, errno);
+ WARN("Couldn't write patch for drum %d '%s'!\n", sbi.channel, \
debugstr_errno(errno)); return -1;
}
}
Index: wine/dlls/winmm/joystick.c
===================================================================
RCS file: /home/wine/wine/dlls/winmm/joystick.c,v
retrieving revision 1.3
diff -u -r1.3 joystick.c
--- wine/dlls/winmm/joystick.c 1999/11/12 03:23:50 1.3
+++ wine/dlls/winmm/joystick.c 2000/01/30 15:42:35
@@ -20,9 +20,6 @@
#include <string.h>
#include <fcntl.h>
#include <sys/ioctl.h>
-#ifdef HAVE_SYS_ERRNO_H
-#include <sys/errno.h>
-#endif
#include "winuser.h"
#include "winbase.h"
#include "mmsystem.h"
Index: wine/dlls/icmp/icmp_main.c
===================================================================
RCS file: /home/wine/wine/dlls/icmp/icmp_main.c,v
retrieving revision 1.7
diff -u -r1.7 icmp_main.c
--- wine/dlls/icmp/icmp_main.c 1999/12/25 22:46:22 1.7
+++ wine/dlls/icmp/icmp_main.c 2000/01/30 15:42:35
@@ -334,7 +334,7 @@
SetLastError(IP_DEST_NET_UNREACHABLE);
break;
default:
- TRACE("unknown error: errno=%d\n",errno);
+ TRACE("unknown error: errno='%s'\n",debugstr_errno(errno));
SetLastError(ERROR_UNKNOWN);
}
}
Index: wine/loader/dos/module.c
===================================================================
RCS file: /home/wine/wine/loader/dos/module.c,v
retrieving revision 1.32
diff -u -r1.32 module.c
--- wine/loader/dos/module.c 2000/01/25 21:19:58 1.32
+++ wine/loader/dos/module.c 2000/01/30 15:42:35
@@ -206,7 +206,7 @@
lpDosTask->img=mmap(NULL,0x110000-START_OFFSET,PROT_READ|PROT_WRITE,MAP_SHARED,lpDosTask->mm_fd,0);
#endif
if (lpDosTask->img==(LPVOID)-1) {
- ERR("could not map shared memory, error=%s\n",strerror(errno));
+ ERR("could not map shared memory, error=%s\n",debugstr_errno(errno));
return FALSE;
}
TRACE("DOS VM86 image mapped at %08lx\n",(DWORD)lpDosTask->img);
@@ -446,7 +446,7 @@
/* and, just for completeness... */
execl("loader/dos/dosmod",fname,farg,NULL);
/* if failure, exit */
- ERR("Failed to spawn dosmod, error=%s\n",strerror(errno));
+ ERR("Failed to spawn dosmod, error=%s\n",debugstr_errno(errno));
exit(1);
}
return TRUE;
Index: wine/loader/dos/dosvm.c
===================================================================
RCS file: /home/wine/wine/loader/dos/dosvm.c,v
retrieving revision 1.28
diff -u -r1.28 dosvm.c
--- wine/loader/dos/dosvm.c 1999/11/13 23:54:04 1.28
+++ wine/loader/dos/dosvm.c 2000/01/30 15:42:35
@@ -426,11 +426,11 @@
errno = 0;
/* transmit VM86 structure to dosmod task */
if (write(lpDosTask->write_pipe,&stat,sizeof(stat))!=sizeof(stat)) {
- ERR_(module)("dosmod sync lost, errno=%d, fd=%d, \
pid=%d\n",errno,lpDosTask->write_pipe,getpid()); + ERR_(module)("dosmod sync lost, \
errno=%s, fd=%d, pid=%d\n",debugstr_errno(errno),lpDosTask->write_pipe,getpid()); \
return -1; }
if (write(lpDosTask->write_pipe,&VM86,sizeof(VM86))!=sizeof(VM86)) {
- ERR_(module)("dosmod sync lost, errno=%d\n",errno);
+ ERR_(module)("dosmod sync lost, errno=%s\n",debugstr_errno(errno));
return -1;
}
/* wait for response, doing other things in the meantime */
@@ -439,30 +439,30 @@
while (1) {
if ((len=read(lpDosTask->read_pipe,&stat,sizeof(stat)))==sizeof(stat)) break;
if (((errno==EINTR)||(errno==EAGAIN))&&(len<=0)) {
- WARN_(module)("rereading dosmod return code due to errno=%d, \
result=%d\n",errno,len); + WARN_(module)("rereading dosmod return code due to \
errno=%s, result=%d\n",debugstr_errno(errno),len); continue;
}
- ERR_(module)("dosmod sync lost reading return code, errno=%d, \
result=%d\n",errno,len); + ERR_(module)("dosmod sync lost reading return code, \
errno=%s, result=%d\n",debugstr_errno(errno),len); return -1;
}
TRACE_(module)("dosmod return code=%d\n",stat);
while (1) {
if ((len=read(lpDosTask->read_pipe,&VM86,sizeof(VM86)))==sizeof(VM86)) break;
if (((errno==EINTR)||(errno==EAGAIN))&&(len<=0)) {
- WARN_(module)("rereading dosmod VM86 structure due to errno=%d, \
result=%d\n",errno,len); + WARN_(module)("rereading dosmod VM86 structure due to \
errno=%s, result=%d\n",debugstr_errno(errno),len); continue;
}
- ERR_(module)("dosmod sync lost reading VM86 structure, errno=%d, \
result=%d\n",errno,len); + ERR_(module)("dosmod sync lost reading VM86 structure, \
errno=%s, result=%d\n",debugstr_errno(errno),len); return -1;
}
if ((stat&0xff)==DOSMOD_SIGNAL) {
while (1) {
if ((len=read(lpDosTask->read_pipe,&sig,sizeof(sig)))==sizeof(sig)) break;
if (((errno==EINTR)||(errno==EAGAIN))&&(len<=0)) {
- WARN_(module)("rereading dosmod signal due to errno=%d, result=%d\n",errno,len);
+ WARN_(module)("rereading dosmod signal due to errno=%s, \
result=%d\n",debugstr_errno(errno),len); continue;
}
- ERR_(module)("dosmod sync lost reading signal, errno=%d, \
result=%d\n",errno,len); + ERR_(module)("dosmod sync lost reading signal, \
errno=%s, result=%d\n",debugstr_errno(errno),len); return -1;
} while (0);
} else sig=0;
@@ -524,11 +524,11 @@
if (!tim.tv_usec) tim.tv_usec=1;
if (write(lpDosTask->write_pipe,&stat,sizeof(stat))!=sizeof(stat)) {
- ERR_(module)("dosmod sync lost, errno=%d\n",errno);
+ ERR_(module)("dosmod sync lost, errno=%s\n",debugstr_errno(errno));
return;
}
if (write(lpDosTask->write_pipe,&tim,sizeof(tim))!=sizeof(tim)) {
- ERR_(module)("dosmod sync lost, errno=%d\n",errno);
+ ERR_(module)("dosmod sync lost, errno=%s\n",debugstr_errno(errno));
return;
}
/* there's no return */
@@ -543,14 +543,14 @@
if (lpDosTask) {
if (write(lpDosTask->write_pipe,&stat,sizeof(stat))!=sizeof(stat)) {
- ERR_(module)("dosmod sync lost, errno=%d\n",errno);
+ ERR_(module)("dosmod sync lost, errno=%s\n",debugstr_errno(errno));
return 0;
}
/* read response */
while (1) {
if (read(lpDosTask->read_pipe,&tim,sizeof(tim))==sizeof(tim)) break;
if ((errno==EINTR)||(errno==EAGAIN)) continue;
- ERR_(module)("dosmod sync lost, errno=%d\n",errno);
+ ERR_(module)("dosmod sync lost, errno=%s\n",debugstr_errno(errno));
return 0;
}
return ((unsigned long long)tim.tv_usec*1193180)/1000000;
Index: wine/files/directory.c
===================================================================
RCS file: /home/wine/wine/files/directory.c,v
retrieving revision 1.19
diff -u -r1.19 directory.c
--- wine/files/directory.c 2000/01/30 03:03:24 1.19
+++ wine/files/directory.c 2000/01/30 15:42:36
@@ -13,9 +13,6 @@
#include <sys/stat.h>
#include <unistd.h>
#include <errno.h>
-#ifdef HAVE_SYS_ERRNO_H
-#include <sys/errno.h>
-#endif
#include "winbase.h"
#include "wine/winbase16.h"
@@ -104,7 +101,7 @@
}
else
MESSAGE("Warning: Access to Temporary Directory failed (%s).\n",
- strerror(errno));
+ debugstr_errno(errno));
}
if (drive == -1)
@@ -340,10 +337,11 @@
}
if (!DOSFS_GetFullName( path, FALSE, &full_name )) return 0;
if (mkdir( full_name.long_name, 0777 ) == -1) {
- WARN_(file)("Errno %i trying to create directory %s.\n", errno, \
full_name.long_name); + int save_error=errno;
+ WARN_(file)("Errno %s trying to create directory %s.\n", \
debugstr_errno(save_error), full_name.long_name); /* the FILE_SetDosError() \
generated error codes don't match the
* CreateDirectory ones for some errnos */
- switch (errno) {
+ switch (save_error) {
case EEXIST: SetLastError(ERROR_ALREADY_EXISTS); break;
case ENOSPC: SetLastError(ERROR_DISK_FULL); break;
default: FILE_SetDosError();break;
Index: wine/files/file.c
===================================================================
RCS file: /home/wine/wine/files/file.c,v
retrieving revision 1.45
diff -u -r1.45 file.c
--- wine/files/file.c 2000/01/23 02:18:27 1.45
+++ wine/files/file.c 2000/01/30 15:42:38
@@ -17,9 +17,6 @@
#include <fcntl.h>
#include <stdlib.h>
#include <string.h>
-#ifdef HAVE_SYS_ERRNO_H
-#include <sys/errno.h>
-#endif
#include <sys/types.h>
#include <sys/stat.h>
#ifdef HAVE_SYS_MMAN_H
@@ -252,7 +249,7 @@
{
int save_errno = errno; /* errno gets overwritten by printf */
- TRACE("errno = %d %s\n", errno, strerror(errno));
+ TRACE("errno = %d %s\n", errno, debugstr_errno(errno));
switch (save_errno)
{
case EAGAIN:
Index: wine/files/dos_fs.c
===================================================================
RCS file: /home/wine/wine/files/dos_fs.c,v
retrieving revision 1.35
diff -u -r1.35 dos_fs.c
--- wine/files/dos_fs.c 2000/01/09 21:34:34 1.35
+++ wine/files/dos_fs.c 2000/01/30 15:42:41
@@ -10,9 +10,6 @@
#include <ctype.h>
#include <dirent.h>
#include <errno.h>
-#ifdef HAVE_SYS_ERRNO_H
-#include <sys/errno.h>
-#endif
#include <fcntl.h>
#include <string.h>
#include <stdlib.h>
@@ -535,7 +532,7 @@
if (!(dir = DOSFS_OpenDir( path )))
{
WARN("(%s,%s): can't open dir: %s\n",
- path, name, strerror(errno) );
+ path, name, debugstr_errno(errno) );
return FALSE;
}
Index: wine/win32/console.c
===================================================================
RCS file: /home/wine/wine/win32/console.c,v
retrieving revision 1.41
diff -u -r1.41 console.c
--- wine/win32/console.c 1999/11/21 02:14:39 1.41
+++ wine/win32/console.c 2000/01/30 15:42:42
@@ -30,9 +30,6 @@
#include <sys/time.h>
#include <fcntl.h>
#include <errno.h>
-#ifdef HAVE_SYS_ERRNO_H
-#include <sys/errno.h>
-#endif
#include <signal.h>
#include <assert.h>
Index: wine/win32/file.c
===================================================================
RCS file: /home/wine/wine/win32/file.c,v
retrieving revision 1.15
diff -u -r1.15 file.c
--- wine/win32/file.c 1999/10/24 22:13:54 1.15
+++ wine/win32/file.c 2000/01/30 15:42:42
@@ -7,9 +7,6 @@
#include "config.h"
#include <errno.h>
-#ifdef HAVE_SYS_ERRNO_H
-#include <sys/errno.h>
-#endif
#include <stdlib.h>
#include <unistd.h>
#include <sys/types.h>
Index: wine/memory/virtual.c
===================================================================
RCS file: /home/wine/wine/memory/virtual.c,v
retrieving revision 1.30
diff -u -r1.30 virtual.c
--- wine/memory/virtual.c 1999/11/25 21:30:24 1.30
+++ wine/memory/virtual.c 2000/01/30 15:42:43
@@ -8,9 +8,6 @@
#include <assert.h>
#include <errno.h>
-#ifdef HAVE_SYS_ERRNO_H
-#include <sys/errno.h>
-#endif
#include <fcntl.h>
#include <unistd.h>
#include <stdlib.h>
Index: wine/windows/dinput.c
===================================================================
RCS file: /home/wine/wine/windows/dinput.c,v
retrieving revision 1.40
diff -u -r1.40 dinput.c
--- wine/windows/dinput.c 2000/01/18 05:09:51 1.40
+++ wine/windows/dinput.c 2000/01/30 15:42:45
@@ -30,9 +30,6 @@
#include <sys/fcntl.h>
#include <sys/ioctl.h>
#include <errno.h>
-#ifdef HAVE_SYS_ERRNO_H
-# include <sys/errno.h>
-#endif
#ifdef HAVE_LINUX_JOYSTICK_H
# include <linux/joystick.h>
# define JOYDEV "/dev/js0"
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic