[ros-diffs] [cwittich] 32588: fix some more warnings and errors

cwittich at svn.reactos.org cwittich at svn.reactos.org
Sun Mar 9 12:34:53 CET 2008


Author: cwittich
Date: Thu Mar  6 17:51:01 2008
New Revision: 32588

URL: http://svn.reactos.org/svn/reactos?rev=3D32588&view=3Drev
Log:
fix some more warnings and errors

Added:
    trunk/tools/RosBE/RosBE-Windows/Tools/ccache-2.4/getopt.c   (with props)
    trunk/tools/RosBE/RosBE-Windows/Tools/ccache-2.4/getopt.h   (with props)
    trunk/tools/RosBE/RosBE-Windows/Tools/ccache-2.4/win32-dirent.c   (with=
 props)
    trunk/tools/RosBE/RosBE-Windows/Tools/ccache-2.4/win32-dirent.h   (with=
 props)
Modified:
    trunk/tools/RosBE/RosBE-Windows/Tools/ccache-2.4/ccache-win32.vcproj
    trunk/tools/RosBE/RosBE-Windows/Tools/ccache-2.4/ccache.h

Modified: trunk/tools/RosBE/RosBE-Windows/Tools/ccache-2.4/ccache-win32.vcp=
roj
URL: http://svn.reactos.org/svn/reactos/trunk/tools/RosBE/RosBE-Windows/Too=
ls/ccache-2.4/ccache-win32.vcproj?rev=3D32588&r1=3D32587&r2=3D32588&view=3D=
diff
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- trunk/tools/RosBE/RosBE-Windows/Tools/ccache-2.4/ccache-win32.vcproj (o=
riginal)
+++ trunk/tools/RosBE/RosBE-Windows/Tools/ccache-2.4/ccache-win32.vcproj Th=
u Mar  6 17:51:01 2008
@@ -203,6 +203,10 @@
 				>
 			</File>
 			<File
+				RelativePath=3D".\mkstemps.c"
+				>
+			</File>
+			<File
 				RelativePath=3D".\snprintf.c"
 				>
 			</File>
@@ -216,6 +220,10 @@
 			</File>
 			<File
 				RelativePath=3D".\util.c"
+				>
+			</File>
+			<File
+				RelativePath=3D".\win32-dirent.c"
 				>
 			</File>
 		</Filter>
@@ -240,6 +248,10 @@
 				RelativePath=3D".\mdfour.h"
 				>
 			</File>
+			<File
+				RelativePath=3D".\win32-dirent.h"
+				>
+			</File>
 		</Filter>
 		<Filter
 			Name=3D"Ressourcendateien"

Modified: trunk/tools/RosBE/RosBE-Windows/Tools/ccache-2.4/ccache.h
URL: http://svn.reactos.org/svn/reactos/trunk/tools/RosBE/RosBE-Windows/Too=
ls/ccache-2.4/ccache.h?rev=3D32588&r1=3D32587&r2=3D32588&view=3Ddiff
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- trunk/tools/RosBE/RosBE-Windows/Tools/ccache-2.4/ccache.h (original)
+++ trunk/tools/RosBE/RosBE-Windows/Tools/ccache-2.4/ccache.h Thu Mar  6 17=
:51:01 2008
@@ -13,10 +13,45 @@
 #include <sys/stat.h>
 #ifdef _WIN32
  #include <windows.h>
+ #include <shlobj.h>
  #include <sys/locking.h>
+ #include <sys/utime.h>
+ #include <direct.h>
+ #include <io.h>
+ #include <process.h>
+ #include "getopt.h"
+ #include "win32-dirent.h"
  #define PATH_SEP WIN32_PATH_SEP
  #define PATH_SEP_CHAR WIN32_PATH_SEP_CHAR
  #define DEV_NULL "NUL"
+ #define read _read
+ #define open _open
+ #define close _close
+ #define access _access
+ #define unlink _unlink
+ #define umask _umask
+ #define strdup _strdup
+ #define putenv _putenv
+ #define lseek _lseek
+ #define write _write
+ #define getpid _getpid
+ #define execv _execv
+ #define dup _dup
+ #define utime _utime
+ #define unlink _unlink
+ #define mkdir(dirname, access) _mkdir(dirname)
+ #define x_realpath(a) strdup(a)
+ #define link(filename, linkname) CreateHardLinkA(linkname, filename, NULL)
+ #define PROT_READ 0x0001
+ #define MAP_PRIVATE 0x02
+ typedef int mode_t;
+ #ifndef S_ISREG
+  #define S_ISREG(m) ((m & _S_IFREG) =3D=3D _S_IFREG)
+ #endif
+ #ifndef S_ISDIR
+  #define S_ISDIR(m) (((m) & _S_IFDIR) =3D=3D _S_IFDIR)
+ #endif
+ #define lstat(x, y) stat(x, y)
 #else
  #include <unistd.h>
  #include <sys/wait.h>

Added: trunk/tools/RosBE/RosBE-Windows/Tools/ccache-2.4/getopt.c
URL: http://svn.reactos.org/svn/reactos/trunk/tools/RosBE/RosBE-Windows/Too=
ls/ccache-2.4/getopt.c?rev=3D32588&view=3Dauto
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- trunk/tools/RosBE/RosBE-Windows/Tools/ccache-2.4/getopt.c (added)
+++ trunk/tools/RosBE/RosBE-Windows/Tools/ccache-2.4/getopt.c Thu Mar  6 17=
:51:01 2008
@@ -1,0 +1,122 @@
+/*
+ * Copyright (c) 1987 Regents of the University of California.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ *    must display the following acknowledgement:
+ *	This product includes software developed by the University of
+ *	California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURP=
OSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENT=
IAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STR=
ICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY W=
AY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * Fri Jun 13 10:39:00 1997, tfelix at fred.net:
+ *     Ported to Win32, changed index/rindex to strchr/strrchr
+ */
+
+#if defined(LIBC_SCCS) && !defined(lint)
+static char sccsid[] =3D "@(#)getopt.c	4.13 (Berkeley) 2/23/91";
+#endif /* LIBC_SCCS and not lint */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "getopt.h"
+
+/*
+ * get option letter from argument vector
+ */
+int	opterr =3D 1,		/* if error message should be printed */
+	optind =3D 1,		/* index into parent argv vector */
+	optopt;			/* character checked for validity */
+const char	*optarg;		/* argument associated with option */
+
+#define	BADCH	(int)'?'
+#define	EMSG	""
+
+int
+getopt(int nargc, char * const *nargv, const char *ostr)
+{
+	static const char *place =3D EMSG;		/* option letter processing */
+	register char *oli;			/* option letter list index */
+	char *p;
+
+	if (!*place) {				/* update scanning pointer */
+		if (optind >=3D nargc || *(place =3D nargv[optind]) !=3D '-') {
+			place =3D EMSG;
+			return(EOF);
+		}
+		if (place[1] && *++place =3D=3D '-') {	/* found "--" */
+			++optind;
+			place =3D EMSG;
+			return(EOF);
+		}
+	}					/* option letter okay? */
+	if ((optopt =3D (int)*place++) =3D=3D (int)':' ||
+	    !(oli =3D strchr(ostr, optopt))) {
+		/*
+		 * if the user didn't specify '-' as an option,
+		 * assume it means EOF.
+		 */
+		if (optopt =3D=3D (int)'-')
+			return(EOF);
+		if (!*place)
+			++optind;
+		if (opterr) {
+			if (!(p =3D strrchr(*nargv, '/')))
+				p =3D *nargv;
+			else
+				++p;
+			(void)fprintf(stderr, "%s: illegal option -- %c\n",
+			    p, optopt);
+		}
+		return(BADCH);
+	}
+	if (*++oli !=3D ':') {			/* don't need argument */
+		optarg =3D NULL;
+		if (!*place)
+			++optind;
+	}
+	else {					/* need an argument */
+		if (*place)			/* no white space */
+			optarg =3D place;
+		else if (nargc <=3D ++optind) {	/* no arg */
+			place =3D EMSG;
+			if (!(p =3D strrchr(*nargv, '/')))
+				p =3D *nargv;
+			else
+				++p;
+			if (opterr)
+				(void)fprintf(stderr,
+				    "%s: option requires an argument -- %c\n",
+				    p, optopt);
+			return(BADCH);
+		}
+	 	else				/* white space */
+			optarg =3D nargv[optind];
+		place =3D EMSG;
+		++optind;
+	}
+	return(optopt);				/* dump back option letter */
+}

Propchange: trunk/tools/RosBE/RosBE-Windows/Tools/ccache-2.4/getopt.c
---------------------------------------------------------------------------=
---
    svn:eol-style =3D native

Added: trunk/tools/RosBE/RosBE-Windows/Tools/ccache-2.4/getopt.h
URL: http://svn.reactos.org/svn/reactos/trunk/tools/RosBE/RosBE-Windows/Too=
ls/ccache-2.4/getopt.h?rev=3D32588&view=3Dauto
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- trunk/tools/RosBE/RosBE-Windows/Tools/ccache-2.4/getopt.h (added)
+++ trunk/tools/RosBE/RosBE-Windows/Tools/ccache-2.4/getopt.h Thu Mar  6 17=
:51:01 2008
@@ -1,0 +1,7 @@
+/* getopt.h */
+
+extern const char *optarg;
+extern int optind;
+
+int
+getopt(int nargc, char * const *nargv, const char *ostr);

Propchange: trunk/tools/RosBE/RosBE-Windows/Tools/ccache-2.4/getopt.h
---------------------------------------------------------------------------=
---
    svn:eol-style =3D native

Added: trunk/tools/RosBE/RosBE-Windows/Tools/ccache-2.4/win32-dirent.c
URL: http://svn.reactos.org/svn/reactos/trunk/tools/RosBE/RosBE-Windows/Too=
ls/ccache-2.4/win32-dirent.c?rev=3D32588&view=3Dauto
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- trunk/tools/RosBE/RosBE-Windows/Tools/ccache-2.4/win32-dirent.c (added)
+++ trunk/tools/RosBE/RosBE-Windows/Tools/ccache-2.4/win32-dirent.c Thu Mar=
  6 17:51:01 2008
@@ -1,0 +1,126 @@
+/* Copyright (C) 2001, 2006 Free Software Foundation, Inc.
+ * =

+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-130=
1 USA
+ */
+
+#include <windows.h>
+#include <stdio.h>
+#include <string.h>
+
+#include "win32-dirent.h"
+
+DIR *
+opendir (const char * name)
+{
+  DIR *dir;
+  HANDLE hnd;
+  char *file;
+  WIN32_FIND_DATAA find;
+
+  if (!name || !*name) =

+    return NULL;
+  file =3D malloc (strlen (name) + 3);
+  strcpy (file, name);
+  if (file[strlen (name) - 1] !=3D '/' && file[strlen (name) - 1] !=3D '\\=
')
+    strcat (file, "/*");
+  else
+    strcat (file, "*");
+  =

+  if ((hnd =3D FindFirstFileA (file, &find)) =3D=3D INVALID_HANDLE_VALUE)
+    {
+      free (file);
+      return NULL;
+    }
+
+  dir =3D malloc (sizeof (DIR));
+  dir->mask =3D file;
+  dir->fd =3D (int) hnd;
+  dir->data =3D malloc (sizeof (WIN32_FIND_DATA));
+  dir->allocation =3D sizeof (WIN32_FIND_DATA);
+  dir->size =3D dir->allocation;
+  dir->filepos =3D 0;
+  memcpy (dir->data, &find, sizeof (WIN32_FIND_DATA));
+  return dir;
+}
+
+struct dirent *
+readdir (DIR * dir)
+{
+  static struct dirent entry;
+  WIN32_FIND_DATAA *find;
+
+  entry.d_ino =3D 0;
+  entry.d_type =3D 0;
+  find =3D (WIN32_FIND_DATAA *) dir->data;
+
+  if (dir->filepos)
+    {
+      if (!FindNextFileA ((HANDLE) dir->fd, find))
+	return NULL;
+    }
+
+  entry.d_off =3D dir->filepos;
+  strncpy (entry.d_name, find->cFileName, sizeof (entry.d_name));
+  entry.d_reclen =3D strlen (find->cFileName);
+  dir->filepos++;
+  return &entry;
+}
+
+int =

+closedir (DIR * dir)
+{
+  HANDLE hnd =3D (HANDLE) dir->fd;
+  free (dir->data);
+  free (dir->mask);
+  free (dir);
+  return FindClose (hnd) ? 0 : -1;
+}
+
+void =

+rewinddir (DIR * dir)
+{
+  HANDLE hnd =3D (HANDLE) dir->fd;
+  WIN32_FIND_DATAA *find =3D (WIN32_FIND_DATAA *) dir->data;
+
+  FindClose (hnd);
+  hnd =3D FindFirstFileA (dir->mask, find);
+  dir->fd =3D (int) hnd;
+  dir->filepos =3D 0;
+}
+
+void =

+seekdir (DIR * dir, off_t offset)
+{
+  off_t n;
+
+  rewinddir (dir);
+  for (n =3D 0; n < offset; n++)
+    {
+      if (FindNextFileA ((HANDLE) dir->fd, (WIN32_FIND_DATAA *) dir->data))
+	dir->filepos++;
+    }
+}
+
+off_t =

+telldir (DIR * dir)
+{
+  return dir->filepos;
+}
+
+int =

+dirfd (DIR * dir)
+{
+  return dir->fd;
+}

Propchange: trunk/tools/RosBE/RosBE-Windows/Tools/ccache-2.4/win32-dirent.c
---------------------------------------------------------------------------=
---
    svn:eol-style =3D native

Added: trunk/tools/RosBE/RosBE-Windows/Tools/ccache-2.4/win32-dirent.h
URL: http://svn.reactos.org/svn/reactos/trunk/tools/RosBE/RosBE-Windows/Too=
ls/ccache-2.4/win32-dirent.h?rev=3D32588&view=3Dauto
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- trunk/tools/RosBE/RosBE-Windows/Tools/ccache-2.4/win32-dirent.h (added)
+++ trunk/tools/RosBE/RosBE-Windows/Tools/ccache-2.4/win32-dirent.h Thu Mar=
  6 17:51:01 2008
@@ -1,0 +1,64 @@
+/* classes: h_files */
+
+#ifndef SCM_WIN32_DIRENT_H
+#define SCM_WIN32_DIRENT_H
+
+/* Copyright (C) 2001, 2006 Free Software Foundation, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-130=
1 USA
+ */
+
+/* Directory stream type.
+   The miscellaneous Unix `readdir' implementations read directory data
+   into a buffer and return `struct dirent *' pointers into it.  */
+
+#include <sys/types.h>
+
+struct dirstream
+{
+  int fd;		/* File descriptor.  */
+  char *data;		/* Directory block.  */
+  size_t allocation;	/* Space allocated for the block.  */
+  size_t size;		/* Total valid data in the block.  */
+  size_t offset;	/* Current offset into the block.  */
+  off_t filepos;	/* Position of next entry to read.  */
+  char *mask;           /* Initial file mask. */
+};
+
+struct dirent
+{
+  long d_ino;
+  off_t d_off;
+  unsigned short int d_reclen;
+  unsigned char d_type;
+  char d_name[256];
+};
+
+#define d_fileno d_ino /* Backwards compatibility. */
+
+/* This is the data type of directory stream objects.
+   The actual structure is opaque to users.  */
+
+typedef struct dirstream DIR;
+
+DIR * opendir (const char * name);
+struct dirent * readdir (DIR * dir);
+int closedir (DIR * dir);
+void rewinddir (DIR * dir);
+void seekdir (DIR * dir, off_t offset);
+off_t telldir (DIR * dir);
+int dirfd (DIR * dir);
+
+#endif /* SCM_WIN32_DIRENT_H */

Propchange: trunk/tools/RosBE/RosBE-Windows/Tools/ccache-2.4/win32-dirent.h
---------------------------------------------------------------------------=
---
    svn:eol-style =3D native




More information about the Ros-diffs mailing list