Bug 44326

Summary: Make gabble cross-compile with mingw32
Product: Telepathy Reporter: Siraj Razick <siraj>
Component: gabbleAssignee: Siraj Razick <siraj>
Status: RESOLVED FIXED QA Contact: Telepathy bugs list <telepathy-bugs>
Severity: normal    
Priority: medium Keywords: patch
Version: unspecified   
Hardware: x86 (IA32)   
OS: Windows (All)   
URL: http://cgit.collabora.com/git/user/siraj/telepathy-gabble.git/log/?h=mingw32-fixes
Whiteboard:
i915 platform: i915 features:

Description Siraj Razick 2011-12-30 12:27:23 UTC
Current gabble master does not cross-compile with ming232
Comment 1 Siraj Razick 2011-12-30 12:34:15 UTC
patch attached:

1.) index is replaced with strchr since index is deprecated
 and not included in mingw32 sdk

2.) -D_WIN32_WINNT=0x0501 is defined to make  getnameinfo work 

3.) errorno is globally defined in mingw32 sdk so it was renamed to errornum

4.) platform specific format tags had to be added since they differ (so it even compiles with -Werror) 
   a.) http://msdn.microsoft.com/en-us/library/fe06s4ak(v=vs.80).aspx
   b.) http://msdn.microsoft.com/en-us/library/tcxf1dw6.aspx (ssize_t)
Comment 2 Jonny Lamb 2012-01-02 03:54:25 UTC
+#ifdef G_OS_WIN32
+       DEBUG ("fully received %Iu bytes of data", str->len);
+#else
        DEBUG ("fully received %zu bytes of data", str->len);
+#endif

+#ifdef G_OS_WIN32
+       DEBUG ("Append data to buffer of %s (%Iu bytes)", from, str->len);
+#else
        DEBUG ("Append data to buffer of %s (%zu bytes)", from, str->len);
+#endif

Can %zu not just be replaced with G_GSIZE_FORMAT?

http://developer.gnome.org/glib/2.30/glib-Miscellaneous-Macros.html#G-GSIZE-FORMAT:CAPS

+#ifndef ERROR
 #define ERROR(format, ...) \

Where is ERROR being defined already? I'm not sure we want that to be conditional.

+#ifdef G_OS_WIN32
+   strftime (date_str, sizeof (date_str), "%y-%m-%dT%H:%M:%SZ", tm);
+#else
    strftime (date_str, sizeof (date_str), "%FT%H:%M:%SZ", tm);
+#endif

Shouldn't that be %Y instead of %y?

+if WINDOWS
+ AM_CFLAGS += -D_WIN32_WINNT=0x0501
+endif

Can you just add a comment above this documenting what's going on please? It's a bit cryptic.

Then just a few English nits:

+#------------------------------------------------------------
+# Detect Operating system based on --host
+#------------------------------------------------------------

$host, not --host, surely?

+# following flags is requied to make getnameinfo work

s/flags/flag/ and s/requied/required/
Comment 3 Siraj Razick 2012-01-02 10:29:15 UTC
Thanks for the review , patch updated :)

replaced zu with G_GSIZE_FORMAT , thanks for the tip.. I didn't know about it before.
Comment 4 Jonny Lamb 2012-01-02 15:57:27 UTC
+#ifdef G_OS_WIN32
+    strftime (date_str, sizeof (date_str), "%Y-%M-%dT%H:%M:%SZ", tm);
+#else
     strftime (date_str, sizeof (date_str), "%FT%H:%M:%SZ", tm);
+#endif

I don't think this right... "%Y-%M-%dT%H:%M:%SZ"
Comment 5 Siraj Razick 2012-01-02 17:26:52 UTC
(In reply to comment #4)
> +#ifdef G_OS_WIN32
> +    strftime (date_str, sizeof (date_str), "%Y-%M-%dT%H:%M:%SZ", tm);
> +#else
>      strftime (date_str, sizeof (date_str), "%FT%H:%M:%SZ", tm);
> +#endif
> 
> I don't think this right... "%Y-%M-%dT%H:%M:%SZ"

oops yes it should be %Y-%m-%d.., now the patch is corrected
Comment 6 Jonny Lamb 2012-01-03 03:02:08 UTC
Okay then, I merged this, thanks.

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.