Hi,
the first attached patch removes preprocessor checks for _LIBC, because
libdvdread is not GNU Libc and does never #define _LIBC.
The compiled objects stay the same (checked with md5sum (without
debugging info: ./configure2 --disable-debug)).
I have tested this patch (that is, the md5.[ch] changes) with MPlayer
from svn as well, works the same as before.
I did not re-indent the nested #if construct in the 2nd and 3rd hunks of
the src/md5.h changes to ease review. This should be done after applying
this patch. You can use the second attached patch to do this (use patch
-p1).
Applying this patch results in cleaner code, which should help in
maintaining it. Additionally, a -Wundef warning in MPlayer (from svn)
compilation is fixed.
This is a more comprehensive than my first proposed patch (see
http://lists.mplayerhq.hu/pipermail/dvdnav-discuss/2013-January/001862.html)
and replaces it.
Thanks,
Erik
Index: msvc/contrib/getopt.c
===================================================================
--- msvc/contrib/getopt.c (revision 1251)
+++ msvc/contrib/getopt.c (working copy)
@@ -53,7 +53,7 @@
it is simpler to just do this in the source for each such file. */
#define GETOPT_INTERFACE_VERSION 2
-#if !defined (_LIBC) && defined (__GLIBC__) && __GLIBC__ >= 2
+#if defined (__GLIBC__) && __GLIBC__ >= 2
#include <gnu-versions.h>
#if _GNU_GETOPT_INTERFACE_VERSION == GETOPT_INTERFACE_VERSION
#define ELIDE_CODE
@@ -253,31 +253,6 @@
static int first_nonopt;
static int last_nonopt;
-#ifdef _LIBC
-/* Bash 2.0 gives us an environment variable containing flags
- indicating ARGV elements that should not be considered arguments. */
-
-static const char *nonoption_flags;
-static int nonoption_flags_len;
-
-static int original_argc;
-static char *const *original_argv;
-
-/* Make sure the environment variable bash 2.0 puts in the environment
- is valid for the getopt call we must make sure that the ARGV passed
- to getopt is that one passed to the process. */
-static void store_args(int argc, char *const *argv) __attribute__((unused));
- static void
- store_args(int argc, char *const *argv)
-{
- /* XXX This is no good solution. We should rather copy the args so
- that we can compare them later. But we must not use malloc(3). */
- original_argc = argc;
- original_argv = argv;
-}
-text_set_element(__libc_subinit, store_args);
-#endif
-
/* Exchange two adjacent subsequences of ARGV.
One subsequence is elements [first_nonopt,last_nonopt)
which contains all the non-options that have been skipped so far.
@@ -387,27 +362,6 @@
else
ordering = PERMUTE;
-#ifdef _LIBC
- if (posixly_correct == NULL
- && argc == original_argc && argv == original_argv)
- {
- /* Bash 2.0 puts a special variable in the environment for each
- command it runs, specifying which ARGV elements are the results of
- file name wildcard expansion and therefore should not be
- considered as options. */
- char var[100];
-
- sprintf(var, "_%d_GNU_nonoption_argv_flags_", getpid());
- nonoption_flags = getenv(var);
- if (nonoption_flags == NULL)
- nonoption_flags_len = 0;
- else
- nonoption_flags_len = strlen(nonoption_flags);
- }
- else
- nonoption_flags_len = 0;
-#endif
-
return optstring;
}
@@ -489,13 +443,7 @@
Either it does not have option syntax, or there is an environment flag
from the shell indicating it is not an option. The later information
is only used when the used in the GNU libc. */
-#ifdef _LIBC
-#define NONOPTION_P (argv[optind][0] != '-' || argv[optind][1] == '\0' \
- || (optind < nonoption_flags_len \
- && nonoption_flags[optind] == '1'))
-#else
#define NONOPTION_P (argv[optind][0] != '-' || argv[optind][1] == '\0')
-#endif
if (nextchar == NULL || *nextchar == '\0')
{
Index: src/md5.c
===================================================================
--- src/md5.c (revision 1251)
+++ src/md5.c (working copy)
@@ -28,13 +28,6 @@
#include "md5.h"
/* #include "unlocked-io.h" */
-#ifdef _LIBC
-# include <endian.h>
-# if __BYTE_ORDER == __BIG_ENDIAN
-# define WORDS_BIGENDIAN 1
-# endif
-#endif
-
#ifdef WORDS_BIGENDIAN
# define SWAP(n) \
(((n) << 24) | (((n) & 0xff00) << 8) | (((n) >> 8) & 0xff00) | ((n) >> 24))
Index: src/md5.h
===================================================================
--- src/md5.h (revision 1251)
+++ src/md5.h (working copy)
@@ -23,7 +23,7 @@
#include <stdio.h>
-#if defined HAVE_LIMITS_H || _LIBC
+#if defined HAVE_LIMITS_H
# include <limits.h>
#endif
@@ -34,10 +34,6 @@
the resulting executable. Locally running cross-compiled executables
is usually not possible. */
-#ifdef _LIBC
-# include <sys/types.h>
-typedef u_int32_t md5_uint32;
-#else
# if defined __STDC__ && __STDC__
# define UINT_MAX_32_BITS 4294967295U
# else
@@ -68,7 +64,6 @@
# endif
# endif
# endif
-#endif
#undef __P
#if defined (__STDC__) && __STDC__
diff -Naur libdvdread/src/md5.h libdvdread.indented/src/md5.h
--- libdvdread/src/md5.h 2013-02-09 22:08:51.000000000 +0100
+++ libdvdread.indented/src/md5.h 2013-02-09 22:09:53.000000000 +0100
@@ -34,36 +34,36 @@
the resulting executable. Locally running cross-compiled executables
is usually not possible. */
-# if defined __STDC__ && __STDC__
-# define UINT_MAX_32_BITS 4294967295U
-# else
-# define UINT_MAX_32_BITS 0xFFFFFFFF
-# endif
+#if defined __STDC__ && __STDC__
+# define UINT_MAX_32_BITS 4294967295U
+#else
+# define UINT_MAX_32_BITS 0xFFFFFFFF
+#endif
/* If UINT_MAX isn't defined, assume it's a 32-bit type.
This should be valid for all systems GNU cares about because
that doesn't include 16-bit systems, and only modern systems
(that certainly have <limits.h>) have 64+-bit integral types. */
-# ifndef UINT_MAX
-# define UINT_MAX UINT_MAX_32_BITS
-# endif
+#ifndef UINT_MAX
+# define UINT_MAX UINT_MAX_32_BITS
+#endif
-# if UINT_MAX == UINT_MAX_32_BITS
+#if UINT_MAX == UINT_MAX_32_BITS
typedef unsigned int md5_uint32;
-# else
-# if USHRT_MAX == UINT_MAX_32_BITS
+#else
+# if USHRT_MAX == UINT_MAX_32_BITS
typedef unsigned short md5_uint32;
-# else
-# if ULONG_MAX == UINT_MAX_32_BITS
+# else
+# if ULONG_MAX == UINT_MAX_32_BITS
typedef unsigned long md5_uint32;
-# else
+# else
/* The following line is intended to evoke an error.
Using #error is not portable enough. */
"Cannot determine unsigned 32-bit data type."
-# endif
# endif
# endif
+#endif
#undef __P
#if defined (__STDC__) && __STDC__
_______________________________________________
DVDnav-discuss mailing list
[email protected]
https://lists.mplayerhq.hu/mailman/listinfo/dvdnav-discuss