[pan: 1/16] Changes to make system build with mingw64




commit 1240878e05c5034d4fceeeda22a7d46a46f5d127
Author: Thomas Tanner <thosrtanner googlemail com>
Date:   Sun Mar 27 11:49:26 2022 +0100

    Changes to make system build with mingw64

 pan/general/file-util.cc |  3 ++-
 pan/gui/Makefile.am      |  2 +-
 pan/gui/gui.cc           |  4 ++--
 pan/tasks/nntp.cc        | 27 +++++++++++++++++++++++++++
 4 files changed, 32 insertions(+), 4 deletions(-)
---
diff --git a/pan/general/file-util.cc b/pan/general/file-util.cc
index 45c3a23..4b478c0 100644
--- a/pan/general/file-util.cc
+++ b/pan/general/file-util.cc
@@ -22,6 +22,8 @@
 #include <cerrno>
 #include <cctype>
 
+#include <glib.h>
+
 extern "C"
 {
   #include <unistd.h>
@@ -31,7 +33,6 @@ extern "C"
     #include <pwd.h>
   #endif
 }
-#include <glib.h>
 #include <glib/gi18n.h>
 
 #include "debug.h"
diff --git a/pan/gui/Makefile.am b/pan/gui/Makefile.am
index 4b34640..7d394ec 100644
--- a/pan/gui/Makefile.am
+++ b/pan/gui/Makefile.am
@@ -104,7 +104,7 @@ endif
 
 pan_SOURCES = gui.cc pan.cc $(WINRC)
 pan_LDADD = ./libpangui.a $(WINRCOBJ) ../data-impl/libpandata.a ../tasks/libtasks.a ../data/libdata.a 
../usenet-utils/libusenetutils.a ../general/libgeneralutils.a ../../uulib/libuu.a \
-               @GTKSPELL_LIBS@ @ENCHANT_LIBS@ @GTK_LIBS@ @GMIME_LIBS@ @GLIB_LIBS@ @GNUTLS_LIBS@ 
@LIBNOTIFY_LIBS@ @LIBGNOME_KEYRING_1_LIBS@ @WEBKITGTK_LIBS@ @ZLIB_LIBS@
+               @GTKSPELL_LIBS@ @ENCHANT_LIBS@ @GTK_LIBS@ @GMIME_LIBS@ @GLIB_LIBS@ @GNUTLS_LIBS@ 
@LIBNOTIFY_LIBS@ @LIBGNOME_KEYRING_1_LIBS@ @WEBKITGTK_LIBS@ @ZLIB_LIBS@ @LIBICONV@
 if HAVE_WIN32
 pan_LDFLAGS = -mwindows
 endif
diff --git a/pan/gui/gui.cc b/pan/gui/gui.cc
index f45c294..0af968b 100644
--- a/pan/gui/gui.cc
+++ b/pan/gui/gui.cc
@@ -1420,8 +1420,8 @@ void GUI :: do_cancel_article ()
   // okay then...
   GMimeMessage * cancel = g_mime_message_new (false);
   char * cancel_message = g_strdup_printf ("cancel <%s>", g_mime_message_get_message_id(message));
-  const char * s_addr = internet_address_list_to_string(g_mime_message_get_sender (message), NULL, TRUE);
-  g_mime_message_add_mailbox (cancel, GMIME_ADDRESS_TYPE_SENDER, NULL, s_addr);
+  const char * sk_addr = internet_address_list_to_string(g_mime_message_get_sender (message), NULL, TRUE);
+  g_mime_message_add_mailbox (cancel, GMIME_ADDRESS_TYPE_SENDER, NULL, sk_addr);
   g_mime_message_set_subject (cancel, "Cancel", NULL);
   g_mime_object_set_header ((GMimeObject *)cancel, "Newsgroups", g_mime_object_get_header ((GMimeObject 
*)message, "Newsgroups"), NULL);
   g_mime_object_set_header ((GMimeObject *)cancel, "Control", cancel_message, NULL);
diff --git a/pan/tasks/nntp.cc b/pan/tasks/nntp.cc
index a7bc266..597bf08 100644
--- a/pan/tasks/nntp.cc
+++ b/pan/tasks/nntp.cc
@@ -50,6 +50,33 @@ namespace
 
       return cmd;
    }
+
+#ifdef G_OS_WIN32
+   //strcasestr isn't implemented on mingw64
+   char *
+   strcasestr(const char *s, const char *find)
+   {
+         char c, sc;
+         size_t len;
+         if ((c = *find++) != 0)
+      {
+                c = (char)tolower((unsigned char)c);
+                len = strlen(find);
+                do
+         {
+                   do
+            {
+                          if ((sc = *s++) == 0)
+               {
+                             return NULL;
+               }
+                       } while ((char)tolower((unsigned char)sc) != c);
+                } while (strncasecmp(s, find, len) != 0);
+                s--;
+         }
+         return const_cast<char *>(s);
+   }
+#endif
 };
 
 void


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]