[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r27533 - in Extractor/src: include main
From: |
gnunet |
Subject: |
[GNUnet-SVN] r27533 - in Extractor/src: include main |
Date: |
Fri, 21 Jun 2013 20:31:17 +0200 |
Author: LRN
Date: 2013-06-21 20:31:16 +0200 (Fri, 21 Jun 2013)
New Revision: 27533
Modified:
Extractor/src/include/plibc.h
Extractor/src/main/extract.c
Extractor/src/main/extractor_datasource.c
Log:
Mingw-w64 compatibility, plibcification
Modified: Extractor/src/include/plibc.h
===================================================================
--- Extractor/src/include/plibc.h 2013-06-21 18:31:12 UTC (rev 27532)
+++ Extractor/src/include/plibc.h 2013-06-21 18:31:16 UTC (rev 27533)
@@ -668,15 +668,19 @@
#if !HAVE_STRNLEN && (!defined(__MINGW64_VERSION_MAJOR) ||
!defined(_INC_STRING))
size_t strnlen (const char *str, size_t maxlen);
#endif
-#if !HAVE_STRTOK_R
+#if !HAVE_STRTOK_R && !defined(WIN_PTHREADS_H) /* winpthreads defines
strtok_r() */
char *strtok_r (char *ptr, const char *sep, char **end);
#endif
char *stpcpy(char *dest, const char *src);
char *strcasestr(const char *haystack_start, const char *needle_start);
#ifndef __MINGW64_VERSION_MAJOR
#define strcasecmp(a, b) stricmp(a, b)
+#define strncasecmp(a, b, c) strnicmp(a, b, c)
+#endif
+#ifndef wcscasecmp
#define wcscasecmp(a, b) wcsicmp(a, b)
-#define strncasecmp(a, b, c) strnicmp(a, b, c)
+#endif
+#ifndef wcsncasecmp
#define wcsncasecmp(a, b, c) wcsnicmp(a, b, c)
#endif
#endif /* WINDOWS */
Modified: Extractor/src/main/extract.c
===================================================================
--- Extractor/src/main/extract.c 2013-06-21 18:31:12 UTC (rev 27532)
+++ Extractor/src/main/extract.c 2013-06-21 18:31:16 UTC (rev 27533)
@@ -592,7 +592,7 @@
"\t%s = {%s},\n",
btm[i].bibTexName,
btm[i].value);
- FPRINTF (stdout, "}\n\n");
+ FPRINTF (stdout, "%s", "}\n\n");
}
@@ -632,7 +632,7 @@
* Makes a copy of argv that consists of a single memory chunk that can be
* freed with a single call to free ();
*/
-static char *const *
+static char **
_make_continuous_arg_copy (int argc, char *const *argv)
{
size_t argvsize = 0;
@@ -650,7 +650,7 @@
p += strlen (argv[i]) + 1;
}
new_argv[argc] = NULL;
- return (char *const *) new_argv;
+ return (char **) new_argv;
}
/**
@@ -666,7 +666,7 @@
* @return 0 on success, -1 on failure
*/
int
-_get_utf8_args (int argc, char *const *argv, int *u8argc, char *const **u8argv)
+_get_utf8_args (int argc, char *const *argv, int *u8argc, char ***u8argv)
{
#ifdef WINDOWS
wchar_t *wcmd;
@@ -686,7 +686,7 @@
for (i = 0; i < wargc; i++)
{
- if (_wchar_to_str (wargv[i], &split_u8argv[i], CP_UTF8, err) != 0)
+ if (_wchar_to_str (wargv[i], &split_u8argv[i], CP_UTF8) != 0)
{
int j;
int e = errno;
@@ -793,6 +793,7 @@
if (NULL != processor)
{
FPRINTF (stderr,
+ "%s",
_("Illegal combination of options, cannot combine
multiple styles of printing.\n"));
free (utf8_argv);
return 0;
@@ -804,6 +805,7 @@
if (NULL != processor)
{
FPRINTF (stderr,
+ "%s",
_("Illegal combination of options, cannot combine
multiple styles of printing.\n"));
free (utf8_argv);
return 0;
@@ -905,6 +907,7 @@
break;
default:
FPRINTF (stderr,
+ "%s",
_("Use --help to get a list of options.\n"));
free (utf8_argv);
return -1;
@@ -913,7 +916,7 @@
if (optind < 0)
{
FPRINTF (stderr,
- "Unknown error parsing options\n");
+ "%s", "Unknown error parsing options\n");
free (print);
free (utf8_argv);
return -1;
@@ -921,7 +924,7 @@
if (utf8_argc - optind < 1)
{
FPRINTF (stderr,
- "Invoke with list of filenames to extract keywords form!\n");
+ "%s", "Invoke with list of filenames to extract keywords
form!\n");
free (print);
free (utf8_argv);
return -1;
@@ -946,7 +949,7 @@
/* extract keywords */
if (YES == bibtex)
FPRINTF(stdout,
- _("%% BiBTeX file\n"));
+ "%s", _("% BiBTeX file\n"));
for (i = optind; i < utf8_argc; i++)
{
errno = 0;
@@ -966,7 +969,11 @@
NULL);
else
{
+#if WINDOWS
+ struct _stat sb;
+#else
struct stat sb;
+#endif
unsigned char *data = NULL;
int f = OPEN (utf8_argv[i], O_RDONLY
#if WINDOWS
@@ -998,15 +1005,15 @@
(void) CLOSE (f);
}
if (YES == grepfriendly)
- FPRINTF (stdout, "\n");
+ FPRINTF (stdout, "%s", "\n");
continue;
}
if (YES == grepfriendly)
- FPRINTF (stdout, "\n");
+ FPRINTF (stdout, "%s", "\n");
if (bibtex)
finish_bibtex (utf8_argv[i]);
if (verbose > 0)
- printf ("\n");
+ FPRINTF (stdout, "%s", "\n");
free (print);
free (utf8_argv);
EXTRACTOR_plugin_remove_all (plugins);
Modified: Extractor/src/main/extractor_datasource.c
===================================================================
--- Extractor/src/main/extractor_datasource.c 2013-06-21 18:31:12 UTC (rev
27532)
+++ Extractor/src/main/extractor_datasource.c 2013-06-21 18:31:16 UTC (rev
27533)
@@ -1190,7 +1190,11 @@
struct EXTRACTOR_Datasource *ds;
enum ExtractorCompressionType ct;
int fd;
+#if WINDOWS
+ struct _stat sb;
+#else
struct stat sb;
+#endif
int64_t fsize;
int winmode = 0;
#if WINDOWS
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r27533 - in Extractor/src: include main,
gnunet <=