Removed tab characters

git-svn-id: svn://pulkomandy.tk/GrafX2/trunk@789 416bcca6-2ee7-4201-b75f-2eb2f807beb1
This commit is contained in:
Yves Rizoud 2009-05-07 23:43:00 +00:00
parent 5d61f3aed5
commit 27506d0649
5 changed files with 294 additions and 294 deletions

View File

@ -5125,7 +5125,7 @@ void Button_Text()
{ {
free(new_brush); free(new_brush);
} }
Window_rectangle(8, 106, 273, 50,Back_color); Window_rectangle(8, 106, 273, 50,Back_color);
new_brush = Render_text(preview_string, cursor_position+list_start, font_size, antialias, is_bold, is_italic, &new_width, &new_height); new_brush = Render_text(preview_string, cursor_position+list_start, font_size, antialias, is_bold, is_italic, &new_width, &new_height);
if (new_brush) if (new_brush)
{ {

View File

@ -21,7 +21,7 @@
#if(!defined(__WIN32__))&&(!defined(__amigaos4__))&&(!defined(__AROS__))&&(!defined(__MORPHOS__))&&(!defined(__amigaos__)) #if(!defined(__WIN32__))&&(!defined(__amigaos4__))&&(!defined(__AROS__))&&(!defined(__MORPHOS__))&&(!defined(__amigaos__))
// We don't use autoconf and all that in grafx2, so let's do the config here ... // We don't use autoconf and all that in grafx2, so let's do the config here ...
#if defined(__macosx__) || defined(__FreeBSD__) // MacOS X is POSIX compliant #if defined(__macosx__) || defined(__FreeBSD__) // MacOS X is POSIX compliant
#define MOUNTED_GETMNTINFO #define MOUNTED_GETMNTINFO
#elif defined(__BEOS__) || defined(__HAIKU__) #elif defined(__BEOS__) || defined(__HAIKU__)
#define MOUNTED_FS_STAT_DEV #define MOUNTED_FS_STAT_DEV
@ -49,10 +49,10 @@
# include <sys/param.h> # include <sys/param.h>
#endif #endif
#if defined MOUNTED_GETFSSTAT /* OSF_1 and Darwin1.3.x */ #if defined MOUNTED_GETFSSTAT /* OSF_1 and Darwin1.3.x */
# if HAVE_SYS_UCRED_H # if HAVE_SYS_UCRED_H
# include <grp.h> /* needed on OSF V4.0 for definition of NGROUPS, # include <grp.h> /* needed on OSF V4.0 for definition of NGROUPS,
NGROUPS is used as an array dimension in ucred.h */ NGROUPS is used as an array dimension in ucred.h */
# include <sys/ucred.h> /* needed by powerpc-apple-darwin1.3.7 */ # include <sys/ucred.h> /* needed by powerpc-apple-darwin1.3.7 */
# endif # endif
# if HAVE_SYS_MOUNT_H # if HAVE_SYS_MOUNT_H
@ -68,44 +68,44 @@
# endif # endif
#endif /* MOUNTED_GETFSSTAT */ #endif /* MOUNTED_GETFSSTAT */
#ifdef MOUNTED_GETMNTENT1 /* 4.3BSD, SunOS, HP-UX, Dynix, Irix. */ #ifdef MOUNTED_GETMNTENT1 /* 4.3BSD, SunOS, HP-UX, Dynix, Irix. */
# include <mntent.h> # include <mntent.h>
# if !defined MOUNTED # if !defined MOUNTED
# if defined _PATH_MOUNTED /* GNU libc */ # if defined _PATH_MOUNTED /* GNU libc */
# define MOUNTED _PATH_MOUNTED # define MOUNTED _PATH_MOUNTED
# endif # endif
# if defined MNT_MNTTAB /* HP-UX. */ # if defined MNT_MNTTAB /* HP-UX. */
# define MOUNTED MNT_MNTTAB # define MOUNTED MNT_MNTTAB
# endif # endif
# if defined MNTTABNAME /* Dynix. */ # if defined MNTTABNAME /* Dynix. */
# define MOUNTED MNTTABNAME # define MOUNTED MNTTABNAME
# endif # endif
# endif # endif
#endif #endif
#ifdef MOUNTED_GETMNTINFO /* 4.4BSD. */ #ifdef MOUNTED_GETMNTINFO /* 4.4BSD. */
# include <sys/mount.h> # include <sys/mount.h>
#endif #endif
#ifdef MOUNTED_GETMNTINFO2 /* NetBSD 3.0. */ #ifdef MOUNTED_GETMNTINFO2 /* NetBSD 3.0. */
# include <sys/statvfs.h> # include <sys/statvfs.h>
#endif #endif
#ifdef MOUNTED_GETMNT /* Ultrix. */ #ifdef MOUNTED_GETMNT /* Ultrix. */
# include <sys/mount.h> # include <sys/mount.h>
# include <sys/fs_types.h> # include <sys/fs_types.h>
#endif #endif
#ifdef MOUNTED_FS_STAT_DEV /* BeOS. */ #ifdef MOUNTED_FS_STAT_DEV /* BeOS. */
# include <fs_info.h> # include <fs_info.h>
# include <dirent.h> # include <dirent.h>
#endif #endif
#ifdef MOUNTED_FREAD /* SVR2. */ #ifdef MOUNTED_FREAD /* SVR2. */
# include <mnttab.h> # include <mnttab.h>
#endif #endif
#ifdef MOUNTED_FREAD_FSTYP /* SVR3. */ #ifdef MOUNTED_FREAD_FSTYP /* SVR3. */
# include <mnttab.h> # include <mnttab.h>
# include <sys/fstyp.h> # include <sys/fstyp.h>
# include <sys/statfs.h> # include <sys/statfs.h>
@ -115,11 +115,11 @@
# include <mntent.h> # include <mntent.h>
#endif #endif
#ifdef MOUNTED_GETMNTENT2 /* SVR4. */ #ifdef MOUNTED_GETMNTENT2 /* SVR4. */
# include <sys/mnttab.h> # include <sys/mnttab.h>
#endif #endif
#ifdef MOUNTED_VMOUNT /* AIX. */ #ifdef MOUNTED_VMOUNT /* AIX. */
# include <fshelp.h> # include <fshelp.h>
# include <sys/vfs.h> # include <sys/vfs.h>
#endif #endif
@ -164,7 +164,7 @@
// As they are not used there anyways, we remove them and everyone is happy. // As they are not used there anyways, we remove them and everyone is happy.
#if !defined(__HAIKU__) && !defined(__BEOS__) #if !defined(__HAIKU__) && !defined(__BEOS__)
#ifndef ME_DUMMY #ifndef ME_DUMMY
# define ME_DUMMY(Fs_name, Fs_type) \ # define ME_DUMMY(Fs_name, Fs_type) \
(strcmp (Fs_type, "autofs") == 0 \ (strcmp (Fs_type, "autofs") == 0 \
|| strcmp (Fs_type, "none") == 0 \ || strcmp (Fs_type, "none") == 0 \
|| strcmp (Fs_type, "proc") == 0 \ || strcmp (Fs_type, "proc") == 0 \
@ -187,12 +187,12 @@
#ifndef ME_REMOTE #ifndef ME_REMOTE
/* A file system is `remote' if its Fs_name contains a `:' /* A file system is `remote' if its Fs_name contains a `:'
or if (it is of type (smbfs or cifs) and its Fs_name starts with `//'). */ or if (it is of type (smbfs or cifs) and its Fs_name starts with `//'). */
# define ME_REMOTE(Fs_name, Fs_type) \ # define ME_REMOTE(Fs_name, Fs_type) \
(strchr (Fs_name, ':') != NULL \ (strchr (Fs_name, ':') != NULL \
|| ((Fs_name)[0] == '/' \ || ((Fs_name)[0] == '/' \
&& (Fs_name)[1] == '/' \ && (Fs_name)[1] == '/' \
&& (strcmp (Fs_type, "smbfs") == 0 \ && (strcmp (Fs_type, "smbfs") == 0 \
|| strcmp (Fs_type, "cifs") == 0))) || strcmp (Fs_type, "cifs") == 0)))
#endif #endif
#endif // HAIKU / BEOS #endif // HAIKU / BEOS
@ -306,7 +306,7 @@ fsp_to_string (const struct statfs *fsp)
#endif /* MOUNTED_GETMNTINFO */ #endif /* MOUNTED_GETMNTINFO */
#ifdef MOUNTED_VMOUNT /* AIX. */ #ifdef MOUNTED_VMOUNT /* AIX. */
static char * static char *
fstype_to_string (int t) fstype_to_string (int t)
{ {
@ -345,10 +345,10 @@ dev_from_mount_options (char const *mount_options)
errno = 0; errno = 0;
dev = strtoul (optval, &optvalend, 16); dev = strtoul (optval, &optvalend, 16);
if (optval != optvalend if (optval != optvalend
&& (*optvalend == '\0' || *optvalend == ',') && (*optvalend == '\0' || *optvalend == ',')
&& ! (dev == ULONG_MAX && errno == ERANGE) && ! (dev == ULONG_MAX && errno == ERANGE)
&& dev == (dev_t) dev) && dev == (dev_t) dev)
return dev; return dev;
} }
# endif # endif
@ -412,18 +412,18 @@ read_file_system_list (bool need_fs_type)
while ((mnt = getmntent (fp))) while ((mnt = getmntent (fp)))
{ {
me = malloc (sizeof *me); me = malloc (sizeof *me);
me->me_devname = strdup (mnt->mnt_fsname); me->me_devname = strdup (mnt->mnt_fsname);
me->me_mountdir = strdup (mnt->mnt_dir); me->me_mountdir = strdup (mnt->mnt_dir);
me->me_type = strdup (mnt->mnt_type); me->me_type = strdup (mnt->mnt_type);
me->me_type_malloced = 1; me->me_type_malloced = 1;
me->me_dummy = ME_DUMMY (me->me_devname, me->me_type); me->me_dummy = ME_DUMMY (me->me_devname, me->me_type);
me->me_remote = ME_REMOTE (me->me_devname, me->me_type); me->me_remote = ME_REMOTE (me->me_devname, me->me_type);
me->me_dev = dev_from_mount_options (mnt->mnt_opts); me->me_dev = dev_from_mount_options (mnt->mnt_opts);
/* Add to the linked list. */ /* Add to the linked list. */
*mtail = me; *mtail = me;
mtail = &me->me_next; mtail = &me->me_next;
} }
if (endmntent (fp) == 0) if (endmntent (fp) == 0)
@ -431,7 +431,7 @@ read_file_system_list (bool need_fs_type)
} }
#endif /* MOUNTED_GETMNTENT1. */ #endif /* MOUNTED_GETMNTENT1. */
#ifdef MOUNTED_GETMNTINFO /* 4.4BSD. */ #ifdef MOUNTED_GETMNTINFO /* 4.4BSD. */
{ {
struct statfs *fsp; struct statfs *fsp;
int entries; int entries;
@ -441,27 +441,27 @@ read_file_system_list (bool need_fs_type)
return NULL; return NULL;
for (; entries-- > 0; fsp++) for (; entries-- > 0; fsp++)
{ {
me = malloc (sizeof *me); me = malloc (sizeof *me);
me->me_devname = strdup (fsp->f_mntfromname); me->me_devname = strdup (fsp->f_mntfromname);
me->me_mountdir = strdup (fsp->f_mntonname); me->me_mountdir = strdup (fsp->f_mntonname);
#if defined(__macosx__) #if defined(__macosx__)
me->me_type = fsp->f_fstypename; me->me_type = fsp->f_fstypename;
#else #else
me->me_type = fsp->fs_typename; me->me_type = fsp->fs_typename;
#endif #endif
me->me_type_malloced = 0; me->me_type_malloced = 0;
me->me_dummy = ME_DUMMY (me->me_devname, me->me_type); me->me_dummy = ME_DUMMY (me->me_devname, me->me_type);
me->me_remote = ME_REMOTE (me->me_devname, me->me_type); me->me_remote = ME_REMOTE (me->me_devname, me->me_type);
me->me_dev = (dev_t) -1; /* Magic; means not known yet. */ me->me_dev = (dev_t) -1; /* Magic; means not known yet. */
/* Add to the linked list. */ /* Add to the linked list. */
*mtail = me; *mtail = me;
mtail = &me->me_next; mtail = &me->me_next;
} }
} }
#endif /* MOUNTED_GETMNTINFO */ #endif /* MOUNTED_GETMNTINFO */
#ifdef MOUNTED_GETMNTINFO2 /* NetBSD 3.0. */ #ifdef MOUNTED_GETMNTINFO2 /* NetBSD 3.0. */
{ {
struct statvfs *fsp; struct statvfs *fsp;
int entries; int entries;
@ -471,44 +471,44 @@ read_file_system_list (bool need_fs_type)
return NULL; return NULL;
for (; entries-- > 0; fsp++) for (; entries-- > 0; fsp++)
{ {
me = xmalloc (sizeof *me); me = xmalloc (sizeof *me);
me->me_devname = xstrdup (fsp->f_mntfromname); me->me_devname = xstrdup (fsp->f_mntfromname);
me->me_mountdir = xstrdup (fsp->f_mntonname); me->me_mountdir = xstrdup (fsp->f_mntonname);
me->me_type = xstrdup (fsp->f_fstypename); me->me_type = xstrdup (fsp->f_fstypename);
me->me_type_malloced = 1; me->me_type_malloced = 1;
me->me_dummy = ME_DUMMY (me->me_devname, me->me_type); me->me_dummy = ME_DUMMY (me->me_devname, me->me_type);
me->me_remote = ME_REMOTE (me->me_devname, me->me_type); me->me_remote = ME_REMOTE (me->me_devname, me->me_type);
me->me_dev = (dev_t) -1; /* Magic; means not known yet. */ me->me_dev = (dev_t) -1; /* Magic; means not known yet. */
/* Add to the linked list. */ /* Add to the linked list. */
*mtail = me; *mtail = me;
mtail = &me->me_next; mtail = &me->me_next;
} }
} }
#endif /* MOUNTED_GETMNTINFO2 */ #endif /* MOUNTED_GETMNTINFO2 */
#ifdef MOUNTED_GETMNT /* Ultrix. */ #ifdef MOUNTED_GETMNT /* Ultrix. */
{ {
int offset = 0; int offset = 0;
int val; int val;
struct fs_data fsd; struct fs_data fsd;
while (errno = 0, while (errno = 0,
0 < (val = getmnt (&offset, &fsd, sizeof (fsd), NOSTAT_MANY, 0 < (val = getmnt (&offset, &fsd, sizeof (fsd), NOSTAT_MANY,
(char *) 0))) (char *) 0)))
{ {
me = xmalloc (sizeof *me); me = xmalloc (sizeof *me);
me->me_devname = xstrdup (fsd.fd_req.devname); me->me_devname = xstrdup (fsd.fd_req.devname);
me->me_mountdir = xstrdup (fsd.fd_req.path); me->me_mountdir = xstrdup (fsd.fd_req.path);
me->me_type = gt_names[fsd.fd_req.fstype]; me->me_type = gt_names[fsd.fd_req.fstype];
me->me_type_malloced = 0; me->me_type_malloced = 0;
me->me_dummy = ME_DUMMY (me->me_devname, me->me_type); me->me_dummy = ME_DUMMY (me->me_devname, me->me_type);
me->me_remote = ME_REMOTE (me->me_devname, me->me_type); me->me_remote = ME_REMOTE (me->me_devname, me->me_type);
me->me_dev = fsd.fd_req.dev; me->me_dev = fsd.fd_req.dev;
/* Add to the linked list. */ /* Add to the linked list. */
*mtail = me; *mtail = me;
mtail = &me->me_next; mtail = &me->me_next;
} }
if (val < 0) if (val < 0)
goto free_then_fail; goto free_then_fail;
@ -568,7 +568,7 @@ read_file_system_list (bool need_fs_type)
if (lstat (name, &statbuf) >= 0 && S_ISDIR (statbuf.st_mode)) if (lstat (name, &statbuf) >= 0 && S_ISDIR (statbuf.st_mode))
{ {
struct rootdir_entry *re = malloc (sizeof *re); struct rootdir_entry *re = malloc (sizeof *re);
re->name = name; re->name = name;
re->dev = statbuf.st_dev; re->dev = statbuf.st_dev;
re->ino = statbuf.st_ino; re->ino = statbuf.st_ino;
@ -594,11 +594,11 @@ read_file_system_list (bool need_fs_type)
if (re->dev == fi.dev && re->ino == fi.root) if (re->dev == fi.dev && re->ino == fi.root)
break; break;
me = malloc (sizeof *me); me = malloc (sizeof *me);
me->me_devname = strdup (fi.device_name[0] != '\0' ? fi.device_name : fi.fsh_name); me->me_devname = strdup (fi.device_name[0] != '\0' ? fi.device_name : fi.fsh_name);
me->me_mountdir = strdup (re != NULL ? re->name : fi.fsh_name); me->me_mountdir = strdup (re != NULL ? re->name : fi.fsh_name);
me->me_type = strdup (fi.fsh_name); me->me_type = strdup (fi.fsh_name);
me->me_type_malloced = 1; me->me_type_malloced = 1;
me->me_dev = fi.dev; me->me_dev = fi.dev;
me->me_dummy = 0; me->me_dummy = 0;
me->me_remote = (fi.flags & B_FS_IS_SHARED) != 0; me->me_remote = (fi.flags & B_FS_IS_SHARED) != 0;
@ -619,7 +619,7 @@ read_file_system_list (bool need_fs_type)
} }
#endif /* MOUNTED_FS_STAT_DEV */ #endif /* MOUNTED_FS_STAT_DEV */
#if defined MOUNTED_GETFSSTAT /* __alpha running OSF_1 */ #if defined MOUNTED_GETFSSTAT /* __alpha running OSF_1 */
{ {
int numsys, counter; int numsys, counter;
size_t bufsize; size_t bufsize;
@ -637,24 +637,24 @@ read_file_system_list (bool need_fs_type)
if (numsys < 0) if (numsys < 0)
{ {
free (stats); free (stats);
return (NULL); return (NULL);
} }
for (counter = 0; counter < numsys; counter++) for (counter = 0; counter < numsys; counter++)
{ {
me = xmalloc (sizeof *me); me = xmalloc (sizeof *me);
me->me_devname = xstrdup (stats[counter].f_mntfromname); me->me_devname = xstrdup (stats[counter].f_mntfromname);
me->me_mountdir = xstrdup (stats[counter].f_mntonname); me->me_mountdir = xstrdup (stats[counter].f_mntonname);
me->me_type = xstrdup (FS_TYPE (stats[counter])); me->me_type = xstrdup (FS_TYPE (stats[counter]));
me->me_type_malloced = 1; me->me_type_malloced = 1;
me->me_dummy = ME_DUMMY (me->me_devname, me->me_type); me->me_dummy = ME_DUMMY (me->me_devname, me->me_type);
me->me_remote = ME_REMOTE (me->me_devname, me->me_type); me->me_remote = ME_REMOTE (me->me_devname, me->me_type);
me->me_dev = (dev_t) -1; /* Magic; means not known yet. */ me->me_dev = (dev_t) -1; /* Magic; means not known yet. */
/* Add to the linked list. */ /* Add to the linked list. */
*mtail = me; *mtail = me;
mtail = &me->me_next; mtail = &me->me_next;
} }
free (stats); free (stats);
@ -673,47 +673,47 @@ read_file_system_list (bool need_fs_type)
while (fread (&mnt, sizeof mnt, 1, fp) > 0) while (fread (&mnt, sizeof mnt, 1, fp) > 0)
{ {
me = xmalloc (sizeof *me); me = xmalloc (sizeof *me);
# ifdef GETFSTYP /* SVR3. */ # ifdef GETFSTYP /* SVR3. */
me->me_devname = xstrdup (mnt.mt_dev); me->me_devname = xstrdup (mnt.mt_dev);
# else # else
me->me_devname = xmalloc (strlen (mnt.mt_dev) + 6); me->me_devname = xmalloc (strlen (mnt.mt_dev) + 6);
strcpy (me->me_devname, "/dev/"); strcpy (me->me_devname, "/dev/");
strcpy (me->me_devname + 5, mnt.mt_dev); strcpy (me->me_devname + 5, mnt.mt_dev);
# endif # endif
me->me_mountdir = xstrdup (mnt.mt_filsys); me->me_mountdir = xstrdup (mnt.mt_filsys);
me->me_dev = (dev_t) -1; /* Magic; means not known yet. */ me->me_dev = (dev_t) -1; /* Magic; means not known yet. */
me->me_type = ""; me->me_type = "";
me->me_type_malloced = 0; me->me_type_malloced = 0;
# ifdef GETFSTYP /* SVR3. */ # ifdef GETFSTYP /* SVR3. */
if (need_fs_type) if (need_fs_type)
{ {
struct statfs fsd; struct statfs fsd;
char typebuf[FSTYPSZ]; char typebuf[FSTYPSZ];
if (statfs (me->me_mountdir, &fsd, sizeof fsd, 0) != -1 if (statfs (me->me_mountdir, &fsd, sizeof fsd, 0) != -1
&& sysfs (GETFSTYP, fsd.f_fstyp, typebuf) != -1) && sysfs (GETFSTYP, fsd.f_fstyp, typebuf) != -1)
{ {
me->me_type = xstrdup (typebuf); me->me_type = xstrdup (typebuf);
me->me_type_malloced = 1; me->me_type_malloced = 1;
} }
} }
# endif # endif
me->me_dummy = ME_DUMMY (me->me_devname, me->me_type); me->me_dummy = ME_DUMMY (me->me_devname, me->me_type);
me->me_remote = ME_REMOTE (me->me_devname, me->me_type); me->me_remote = ME_REMOTE (me->me_devname, me->me_type);
/* Add to the linked list. */ /* Add to the linked list. */
*mtail = me; *mtail = me;
mtail = &me->me_next; mtail = &me->me_next;
} }
if (ferror (fp)) if (ferror (fp))
{ {
/* The last fread() call must have failed. */ /* The last fread() call must have failed. */
int saved_errno = errno; int saved_errno = errno;
fclose (fp); fclose (fp);
errno = saved_errno; errno = saved_errno;
goto free_then_fail; goto free_then_fail;
} }
if (fclose (fp) == EOF) if (fclose (fp) == EOF)
@ -721,29 +721,29 @@ read_file_system_list (bool need_fs_type)
} }
#endif /* MOUNTED_FREAD || MOUNTED_FREAD_FSTYP. */ #endif /* MOUNTED_FREAD || MOUNTED_FREAD_FSTYP. */
#ifdef MOUNTED_GETMNTTBL /* DolphinOS goes its own way. */ #ifdef MOUNTED_GETMNTTBL /* DolphinOS goes its own way. */
{ {
struct mntent **mnttbl = getmnttbl (), **ent; struct mntent **mnttbl = getmnttbl (), **ent;
for (ent=mnttbl;*ent;ent++) for (ent=mnttbl;*ent;ent++)
{ {
me = xmalloc (sizeof *me); me = xmalloc (sizeof *me);
me->me_devname = xstrdup ( (*ent)->mt_resource); me->me_devname = xstrdup ( (*ent)->mt_resource);
me->me_mountdir = xstrdup ( (*ent)->mt_directory); me->me_mountdir = xstrdup ( (*ent)->mt_directory);
me->me_type = xstrdup ((*ent)->mt_fstype); me->me_type = xstrdup ((*ent)->mt_fstype);
me->me_type_malloced = 1; me->me_type_malloced = 1;
me->me_dummy = ME_DUMMY (me->me_devname, me->me_type); me->me_dummy = ME_DUMMY (me->me_devname, me->me_type);
me->me_remote = ME_REMOTE (me->me_devname, me->me_type); me->me_remote = ME_REMOTE (me->me_devname, me->me_type);
me->me_dev = (dev_t) -1; /* Magic; means not known yet. */ me->me_dev = (dev_t) -1; /* Magic; means not known yet. */
/* Add to the linked list. */ /* Add to the linked list. */
*mtail = me; *mtail = me;
mtail = &me->me_next; mtail = &me->me_next;
} }
endmnttbl (); endmnttbl ();
} }
#endif #endif
#ifdef MOUNTED_GETMNTENT2 /* SVR4. */ #ifdef MOUNTED_GETMNTENT2 /* SVR4. */
{ {
struct mnttab mnt; struct mnttab mnt;
char *table = MNTTAB; char *table = MNTTAB;
@ -762,19 +762,19 @@ read_file_system_list (bool need_fs_type)
lockfd = open (MNTTAB_LOCK, O_RDONLY); lockfd = open (MNTTAB_LOCK, O_RDONLY);
if (0 <= lockfd) if (0 <= lockfd)
{ {
struct flock flock; struct flock flock;
flock.l_type = F_RDLCK; flock.l_type = F_RDLCK;
flock.l_whence = SEEK_SET; flock.l_whence = SEEK_SET;
flock.l_start = 0; flock.l_start = 0;
flock.l_len = 0; flock.l_len = 0;
while (fcntl (lockfd, F_SETLKW, &flock) == -1) while (fcntl (lockfd, F_SETLKW, &flock) == -1)
if (errno != EINTR) if (errno != EINTR)
{ {
int saved_errno = errno; int saved_errno = errno;
close (lockfd); close (lockfd);
errno = saved_errno; errno = saved_errno;
return NULL; return NULL;
} }
} }
else if (errno != ENOENT) else if (errno != ENOENT)
return NULL; return NULL;
@ -786,23 +786,23 @@ read_file_system_list (bool need_fs_type)
ret = errno; ret = errno;
else else
{ {
while ((ret = getmntent (fp, &mnt)) == 0) while ((ret = getmntent (fp, &mnt)) == 0)
{ {
me = xmalloc (sizeof *me); me = xmalloc (sizeof *me);
me->me_devname = xstrdup (mnt.mnt_special); me->me_devname = xstrdup (mnt.mnt_special);
me->me_mountdir = xstrdup (mnt.mnt_mountp); me->me_mountdir = xstrdup (mnt.mnt_mountp);
me->me_type = xstrdup (mnt.mnt_fstype); me->me_type = xstrdup (mnt.mnt_fstype);
me->me_type_malloced = 1; me->me_type_malloced = 1;
me->me_dummy = MNT_IGNORE (&mnt) != 0; me->me_dummy = MNT_IGNORE (&mnt) != 0;
me->me_remote = ME_REMOTE (me->me_devname, me->me_type); me->me_remote = ME_REMOTE (me->me_devname, me->me_type);
me->me_dev = dev_from_mount_options (mnt.mnt_mntopts); me->me_dev = dev_from_mount_options (mnt.mnt_mntopts);
/* Add to the linked list. */ /* Add to the linked list. */
*mtail = me; *mtail = me;
mtail = &me->me_next; mtail = &me->me_next;
} }
ret = fclose (fp) == EOF ? errno : 0 < ret ? 0 : -1; ret = fclose (fp) == EOF ? errno : 0 < ret ? 0 : -1;
} }
if (0 <= lockfd && close (lockfd) != 0) if (0 <= lockfd && close (lockfd) != 0)
@ -810,13 +810,13 @@ read_file_system_list (bool need_fs_type)
if (0 <= ret) if (0 <= ret)
{ {
errno = ret; errno = ret;
goto free_then_fail; goto free_then_fail;
} }
} }
#endif /* MOUNTED_GETMNTENT2. */ #endif /* MOUNTED_GETMNTENT2. */
#ifdef MOUNTED_VMOUNT /* AIX. */ #ifdef MOUNTED_VMOUNT /* AIX. */
{ {
int bufsize; int bufsize;
char *entries, *thisent; char *entries, *thisent;
@ -833,53 +833,53 @@ read_file_system_list (bool need_fs_type)
n_entries = mntctl (MCTL_QUERY, bufsize, (struct vmount *) entries); n_entries = mntctl (MCTL_QUERY, bufsize, (struct vmount *) entries);
if (n_entries < 0) if (n_entries < 0)
{ {
int saved_errno = errno; int saved_errno = errno;
free (entries); free (entries);
errno = saved_errno; errno = saved_errno;
return NULL; return NULL;
} }
for (i = 0, thisent = entries; for (i = 0, thisent = entries;
i < n_entries; i < n_entries;
i++, thisent += vmp->vmt_length) i++, thisent += vmp->vmt_length)
{ {
char *options, *ignore; char *options, *ignore;
vmp = (struct vmount *) thisent; vmp = (struct vmount *) thisent;
me = xmalloc (sizeof *me); me = xmalloc (sizeof *me);
if (vmp->vmt_flags & MNT_REMOTE) if (vmp->vmt_flags & MNT_REMOTE)
{ {
char *host, *dir; char *host, *dir;
me->me_remote = 1; me->me_remote = 1;
/* Prepend the remote dirname. */ /* Prepend the remote dirname. */
host = thisent + vmp->vmt_data[VMT_HOSTNAME].vmt_off; host = thisent + vmp->vmt_data[VMT_HOSTNAME].vmt_off;
dir = thisent + vmp->vmt_data[VMT_OBJECT].vmt_off; dir = thisent + vmp->vmt_data[VMT_OBJECT].vmt_off;
me->me_devname = xmalloc (strlen (host) + strlen (dir) + 2); me->me_devname = xmalloc (strlen (host) + strlen (dir) + 2);
strcpy (me->me_devname, host); strcpy (me->me_devname, host);
strcat (me->me_devname, ":"); strcat (me->me_devname, ":");
strcat (me->me_devname, dir); strcat (me->me_devname, dir);
} }
else else
{ {
me->me_remote = 0; me->me_remote = 0;
me->me_devname = xstrdup (thisent + me->me_devname = xstrdup (thisent +
vmp->vmt_data[VMT_OBJECT].vmt_off); vmp->vmt_data[VMT_OBJECT].vmt_off);
} }
me->me_mountdir = xstrdup (thisent + vmp->vmt_data[VMT_STUB].vmt_off); me->me_mountdir = xstrdup (thisent + vmp->vmt_data[VMT_STUB].vmt_off);
me->me_type = xstrdup (fstype_to_string (vmp->vmt_gfstype)); me->me_type = xstrdup (fstype_to_string (vmp->vmt_gfstype));
me->me_type_malloced = 1; me->me_type_malloced = 1;
options = thisent + vmp->vmt_data[VMT_ARGS].vmt_off; options = thisent + vmp->vmt_data[VMT_ARGS].vmt_off;
ignore = strstr (options, "ignore"); ignore = strstr (options, "ignore");
me->me_dummy = (ignore me->me_dummy = (ignore
&& (ignore == options || ignore[-1] == ',') && (ignore == options || ignore[-1] == ',')
&& (ignore[sizeof "ignore" - 1] == ',' && (ignore[sizeof "ignore" - 1] == ','
|| ignore[sizeof "ignore" - 1] == '\0')); || ignore[sizeof "ignore" - 1] == '\0'));
me->me_dev = (dev_t) -1; /* vmt_fsid might be the info we want. */ me->me_dev = (dev_t) -1; /* vmt_fsid might be the info we want. */
/* Add to the linked list. */ /* Add to the linked list. */
*mtail = me; *mtail = me;
mtail = &me->me_next; mtail = &me->me_next;
} }
free (entries); free (entries);
} }
@ -896,13 +896,13 @@ read_file_system_list (bool need_fs_type)
while (mount_list) while (mount_list)
{ {
me = mount_list->me_next; me = mount_list->me_next;
free (mount_list->me_devname); free (mount_list->me_devname);
free (mount_list->me_mountdir); free (mount_list->me_mountdir);
if (mount_list->me_type_malloced) if (mount_list->me_type_malloced)
free (mount_list->me_type); free (mount_list->me_type);
free (mount_list); free (mount_list);
mount_list = me; mount_list = me;
} }
errno = saved_errno; errno = saved_errno;

View File

@ -1825,9 +1825,9 @@ void Button_Palette(void)
Print_in_window(238,71,"L",MC_Dark,MC_Light); Print_in_window(238,71,"L",MC_Dark,MC_Light);
Componant_unit(256); Componant_unit(256);
// Display the + and - button as disabled // Display the + and - button as disabled
Window_draw_normal_bouton(266, 74,12,11,"+",0,0); Window_draw_normal_bouton(266, 74,12,11,"+",0,0);
Window_draw_normal_bouton(266,165,12,11,"-",0,0); Window_draw_normal_bouton(266,165,12,11,"-",0,0);
} }
else else
{ {
@ -1837,12 +1837,12 @@ void Button_Palette(void)
Print_in_window(238,71,"B",MC_Dark,MC_Light); Print_in_window(238,71,"B",MC_Dark,MC_Light);
Componant_unit(RGB_scale); Componant_unit(RGB_scale);
// Display the + and - button as enabled // Display the + and - button as enabled
Window_draw_normal_bouton(266, 74,12,11,"+",0,1); Window_draw_normal_bouton(266, 74,12,11,"+",0,1);
Window_draw_normal_bouton(266,165,12,11,"-",0,1); Window_draw_normal_bouton(266,165,12,11,"-",0,1);
} }
Display_sliders(red_slider,green_slider,blue_slider,(block_start!=block_end),working_palette); Display_sliders(red_slider,green_slider,blue_slider,(block_start!=block_end),working_palette);
Update_window_area(265,73,14,103); Update_window_area(265,73,14,103);
break; break;
case 25 : // Sort palette case 25 : // Sort palette
@ -1852,18 +1852,18 @@ void Button_Palette(void)
int swap=1; int swap=1;
byte remap_table[256]; byte remap_table[256];
byte inverted_table[256]; byte inverted_table[256];
byte begin, end; byte begin, end;
if(block_start==block_end) if(block_start==block_end)
{ {
begin = 0; begin = 0;
end = 255; end = 255;
} }
else else
{ {
begin = block_start; begin = block_start;
end = block_end; end = block_end;
} }
// Init remap table // Init remap table
for (i=0;i<256;i++) for (i=0;i<256;i++)
@ -1875,7 +1875,7 @@ void Button_Palette(void)
image_is_backed_up=1; image_is_backed_up=1;
} }
if(Mouse_K==LEFT_SIDE) if(Mouse_K==LEFT_SIDE)
while(swap==1) while(swap==1)
{ {
swap=0; swap=0;
@ -1889,9 +1889,9 @@ void Button_Palette(void)
working_palette[temp_color].B,&h,&s,&l); working_palette[temp_color].B,&h,&s,&l);
if( if(
((s==0) && (os>0)) // Un gris passe devant une couleur saturée ((s==0) && (os>0)) // Un gris passe devant une couleur saturée
|| ((s>0 && os > 0) && (h<oh || (h==oh && l>ol))) // 2 couleurs saturées : on trie par H, si les H sont égaux on trie par L || ((s>0 && os > 0) && (h<oh || (h==oh && l>ol))) // 2 couleurs saturées : on trie par H, si les H sont égaux on trie par L
|| ((os==0 && s==0) && l>ol)) // Deux gris : on trie par L uniquement || ((os==0 && s==0) && l>ol)) // Deux gris : on trie par L uniquement
{ {
// On échange la couleur avec la précédente // On échange la couleur avec la précédente
byte swap_color; byte swap_color;
@ -1906,9 +1906,9 @@ void Button_Palette(void)
} }
} }
else // Right click > Sort only on L else // Right click > Sort only on L
while(swap==1) while(swap==1)
{ {
swap=0; swap=0;
l=255; l=255;
for(temp_color=begin;temp_color<=end;temp_color++) for(temp_color=begin;temp_color<=end;temp_color++)
@ -1932,7 +1932,7 @@ void Button_Palette(void)
swap=1; swap=1;
} }
} }
} }
for (i=0;i<256;i++) for (i=0;i<256;i++)
inverted_table[remap_table[i]]=i; inverted_table[remap_table[i]]=i;
@ -2210,44 +2210,44 @@ void Button_Secondary_palette(void)
switch(clicked_button) switch(clicked_button)
{ {
case 5: case 5:
// Column slider // Column slider
Num2str(256-Window_attribute2,str,3); Num2str(256-Window_attribute2,str,3);
Print_in_window(38,89,str,MC_Black,MC_Light); Print_in_window(38,89,str,MC_Black,MC_Light);
break; break;
case 6: case 6:
// Line slider // Line slider
Num2str(16-Window_attribute2,str,3); Num2str(16-Window_attribute2,str,3);
Print_in_window(94,89,str,MC_Black,MC_Light); Print_in_window(94,89,str,MC_Black,MC_Light);
break; break;
case 7: case 7:
// RGB scale slider // RGB scale slider
Num2str(256-Window_attribute2,str,3); Num2str(256-Window_attribute2,str,3);
Hide_cursor(); Hide_cursor();
Print_in_window(157,78,str,MC_Black,MC_Light); Print_in_window(157,78,str,MC_Black,MC_Light);
Display_cursor(); Display_cursor();
break; break;
case 8: case 8:
// Vertical switch // Vertical switch
palette_vertical = !palette_vertical; palette_vertical = !palette_vertical;
Hide_cursor(); Hide_cursor();
Print_in_window(38,108,(palette_vertical)?"X":" ",MC_Black,MC_Light); Print_in_window(38,108,(palette_vertical)?"X":" ",MC_Black,MC_Light);
Display_cursor(); Display_cursor();
break; break;
case 9: case 9:
// x2 RGB scale // x2 RGB scale
rgb_scale_slider->Position = rgb_scale_slider->Position>128?rgb_scale_slider->Position*2-256:0; rgb_scale_slider->Position = rgb_scale_slider->Position>128?rgb_scale_slider->Position*2-256:0;
Num2str(256-rgb_scale_slider->Position,str,3); Num2str(256-rgb_scale_slider->Position,str,3);
Print_in_window(157,78,str,MC_Black,MC_Light); Print_in_window(157,78,str,MC_Black,MC_Light);
Window_draw_slider(rgb_scale_slider); Window_draw_slider(rgb_scale_slider);
break; break;
case 10: case 10:
// /2 RGB scale // /2 RGB scale
rgb_scale_slider->Position = rgb_scale_slider->Position>253?254:(rgb_scale_slider->Position)/2+128; rgb_scale_slider->Position = rgb_scale_slider->Position>253?254:(rgb_scale_slider->Position)/2+128;
Num2str(256-rgb_scale_slider->Position,str,3); Num2str(256-rgb_scale_slider->Position,str,3);
Print_in_window(157,78,str,MC_Black,MC_Light); Print_in_window(157,78,str,MC_Black,MC_Light);
Window_draw_slider(rgb_scale_slider); Window_draw_slider(rgb_scale_slider);
} }
} }
while (clicked_button!=1 && clicked_button!=3 && clicked_button!=4); while (clicked_button!=1 && clicked_button!=3 && clicked_button!=4);

8
text.c
View File

@ -459,13 +459,13 @@ byte *Render_text_SFont(const char *str, int font_number, int *width, int *heigh
Surface_fonte=IMG_Load(Font_name(font_number)); Surface_fonte=IMG_Load(Font_name(font_number));
if (!Surface_fonte) if (!Surface_fonte)
{ {
DEBUG("Font loading failed",0); DEBUG("Font loading failed",0);
return NULL; return NULL;
} }
font=SFont_InitFont(Surface_fonte); font=SFont_InitFont(Surface_fonte);
if (!font) if (!font)
{ {
DEBUG("Font init failed",1); DEBUG("Font init failed",1);
return NULL; return NULL;
} }
@ -478,7 +478,7 @@ byte *Render_text_SFont(const char *str, int font_number, int *width, int *heigh
SFont_Write(TexteColore, font, 0, 0, str); SFont_Write(TexteColore, font, 0, 0, str);
if (!TexteColore) if (!TexteColore)
{ {
DEBUG("Rendering failed",2); DEBUG("Rendering failed",2);
SFont_FreeFont(font); SFont_FreeFont(font);
return NULL; return NULL;
} }
@ -489,7 +489,7 @@ byte *Render_text_SFont(const char *str, int font_number, int *width, int *heigh
new_brush=Surface_to_bytefield(Texte8Bit, NULL); new_brush=Surface_to_bytefield(Texte8Bit, NULL);
if (!new_brush) if (!new_brush)
{ {
DEBUG("Converting failed",3); DEBUG("Converting failed",3);
SDL_FreeSurface(TexteColore); SDL_FreeSurface(TexteColore);
SDL_FreeSurface(Texte8Bit); SDL_FreeSurface(Texte8Bit);
SFont_FreeFont(font); SFont_FreeFont(font);

View File

@ -1633,28 +1633,28 @@ void Display_cursor(void)
} }
else else
{ {
DEBUG("B",0); DEBUG("B",0);
temp=(Config.Cursor)?CURSOR_SHAPE_THIN_COLORPICKER:CURSOR_SHAPE_COLORPICKER; temp=(Config.Cursor)?CURSOR_SHAPE_THIN_COLORPICKER:CURSOR_SHAPE_COLORPICKER;
start_x=Mouse_X-Cursor_offset_X[temp]; start_x=Mouse_X-Cursor_offset_X[temp];
start_y=Mouse_Y-Cursor_offset_Y[temp]; start_y=Mouse_Y-Cursor_offset_Y[temp];
for (x_pos=start_x,counter_x=0;counter_x<15;x_pos++,counter_x++) for (x_pos=start_x,counter_x=0;counter_x<15;x_pos++,counter_x++)
{ {
if(x_pos<0) continue; if(x_pos<0) continue;
if(x_pos>=Screen_width) break; if(x_pos>=Screen_width) break;
for (y_pos=start_y,counter_y=0;counter_y<15;y_pos++,counter_y++) for (y_pos=start_y,counter_y=0;counter_y<15;y_pos++,counter_y++)
{ {
if(y_pos<0) continue; if(y_pos<0) continue;
if(y_pos>=Screen_height) break; if(y_pos>=Screen_height) break;
color=GFX_cursor_sprite[temp][counter_y][counter_x]; color=GFX_cursor_sprite[temp][counter_y][counter_x];
// On sauvegarde dans CURSOR_BACKGROUND pour restaurer plus tard // On sauvegarde dans CURSOR_BACKGROUND pour restaurer plus tard
CURSOR_BACKGROUND[counter_y][counter_x]=Read_pixel(x_pos,y_pos); CURSOR_BACKGROUND[counter_y][counter_x]=Read_pixel(x_pos,y_pos);
if (color!=MC_Trans) if (color!=MC_Trans)
Pixel(x_pos,y_pos,color); Pixel(x_pos,y_pos,color);
} }
} }
Update_rect(Max(start_x,0),Max(start_y,0),counter_x,counter_y); Update_rect(Max(start_x,0),Max(start_y,0),counter_x,counter_y);
} }
} }
break; break;
@ -1943,18 +1943,18 @@ void Hide_cursor(void)
start_x=Mouse_X-Cursor_offset_X[temp]; start_x=Mouse_X-Cursor_offset_X[temp];
start_y=Mouse_Y-Cursor_offset_Y[temp]; start_y=Mouse_Y-Cursor_offset_Y[temp];
for (x_pos=start_x,counter_x=0;counter_x<15;x_pos++,counter_x++) for (x_pos=start_x,counter_x=0;counter_x<15;x_pos++,counter_x++)
{ {
if(x_pos<0) continue; if(x_pos<0) continue;
if(x_pos>=Screen_width) break; if(x_pos>=Screen_width) break;
for (y_pos=start_y,counter_y=0;counter_y<15;y_pos++,counter_y++) for (y_pos=start_y,counter_y=0;counter_y<15;y_pos++,counter_y++)
{ {
if(y_pos<0) continue; if(y_pos<0) continue;
if(y_pos>=Screen_height) break; if(y_pos>=Screen_height) break;
Pixel(x_pos,y_pos,CURSOR_BACKGROUND[counter_y][counter_x]); Pixel(x_pos,y_pos,CURSOR_BACKGROUND[counter_y][counter_x]);
} }
} }
Update_rect(Max(start_x,0),Max(start_y,0),counter_x,counter_y); Update_rect(Max(start_x,0),Max(start_y,0),counter_x,counter_y);
} }
} }
if (!Paintbrush_hidden) if (!Paintbrush_hidden)
@ -2219,9 +2219,9 @@ byte Best_color(byte r,byte g,byte b)
delta_g=(int)Main_palette[col].G-g; delta_g=(int)Main_palette[col].G-g;
delta_b=(int)Main_palette[col].B-b; delta_b=(int)Main_palette[col].B-b;
rmean = ( Main_palette[col].R + r ) / 2; rmean = ( Main_palette[col].R + r ) / 2;
if (!(dist= ( ( (512+rmean) *delta_r*delta_r) >>8) + 4*delta_g*delta_g + (((767-rmean)*delta_b*delta_b)>>8))) if (!(dist= ( ( (512+rmean) *delta_r*delta_r) >>8) + 4*delta_g*delta_g + (((767-rmean)*delta_b*delta_b)>>8)))
//if (!(dist=(delta_r*delta_r*30)+(delta_g*delta_g*59)+(delta_b*delta_b*11))) //if (!(dist=(delta_r*delta_r*30)+(delta_g*delta_g*59)+(delta_b*delta_b*11)))
return col; return col;
@ -2250,9 +2250,9 @@ byte Best_color_nonexcluded(byte red,byte green,byte blue)
delta_r=(int)Main_palette[col].R-red; delta_r=(int)Main_palette[col].R-red;
delta_g=(int)Main_palette[col].G-green; delta_g=(int)Main_palette[col].G-green;
delta_b=(int)Main_palette[col].B-blue; delta_b=(int)Main_palette[col].B-blue;
rmean = ( Main_palette[col].R + red ) / 2; rmean = ( Main_palette[col].R + red ) / 2;
if (!(dist= ( ( (512+rmean) *delta_r*delta_r) >>8) + 4*delta_g*delta_g + (((767-rmean)*delta_b*delta_b)>>8))) if (!(dist= ( ( (512+rmean) *delta_r*delta_r) >>8) + 4*delta_g*delta_g + (((767-rmean)*delta_b*delta_b)>>8)))
//if (!(dist=(delta_r*delta_r*30)+(delta_g*delta_g*59)+(delta_b*delta_b*11))) //if (!(dist=(delta_r*delta_r*30)+(delta_g*delta_g*59)+(delta_b*delta_b*11)))
return col; return col;