summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog14
-rw-r--r--girepository/girnode.c19
-rw-r--r--tests/invoke/Makefile.am4
-rw-r--r--tests/invoke/invoke.c41
-rw-r--r--tests/scanner/Makefile.am4
-rw-r--r--tools/compiler.c14
6 files changed, 67 insertions, 29 deletions
diff --git a/ChangeLog b/ChangeLog
index 8ecc097e..e40f8abe 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,19 @@
2008-08-28 Tor Lillqvist <tml@novell.com>
+ * tools/compiler.c (write_out_typelib): Use binary mode for output
+ file on Windows.
+
+ * girepository/girnode.c: Don't print NULL strings.
+
+ * tests/invoke/Makefile.am
+ * tests/scanner/Makefile.am: Use -no-undefined on Windows to
+ convince libtool to build shared libraries.
+
+ * tests/invoke/invoke.c: Don't needlessly include <dlfcn.h>. Use
+ g_assert() instead of printing out expected errors.
+
+2008-08-28 Tor Lillqvist <tml@novell.com>
+
* girepository/gtypelib.h: Change type of bitfield fields from
guint to the most suitable smaller type. This makes the struct
sizes match the ones on Linux that the sanity check expects when
diff --git a/girepository/girnode.c b/girepository/girnode.c
index ce3e9ba0..fd74dd9f 100644
--- a/girepository/girnode.c
+++ b/girepository/girnode.c
@@ -821,8 +821,11 @@ g_ir_node_get_full_size_internal (GIrNode *parent,
size = 0;
}
- g_debug ("node '%s' %p type '%s' full size %d", node->name, node,
- g_ir_node_type_to_string (node->type), size);
+ g_debug ("node %s%s%s%p type '%s' full size %d",
+ node->name ? "'" : "",
+ node->name ? node->name : "",
+ node->name ? "' " : "",
+ node, g_ir_node_type_to_string (node->type), size);
return size;
}
@@ -1170,8 +1173,9 @@ g_ir_node_build_typelib (GIrNode *node,
g_assert (node != NULL);
- g_debug ("build_typelib: %s (%s)",
- node->name,
+ g_debug ("build_typelib: %s%s(%s)",
+ node->name ? node->name : "",
+ node->name ? " " : "",
g_ir_node_type_to_string (node->type));
switch (node->type)
@@ -2122,8 +2126,11 @@ g_ir_node_build_typelib (GIrNode *node,
g_assert_not_reached ();
}
- g_debug ("node '%s' %p type '%s', offset %d -> %d, offset2 %d -> %d",
- node->name, node, g_ir_node_type_to_string (node->type),
+ g_debug ("node %s%s%s%p type '%s', offset %d -> %d, offset2 %d -> %d",
+ node->name ? "'" : "",
+ node->name ? node->name : "",
+ node->name ? "' " : "",
+ node, g_ir_node_type_to_string (node->type),
old_offset, *offset, old_offset2, *offset2);
if (*offset2 - old_offset2 + *offset - old_offset > g_ir_node_get_full_size (node))
diff --git a/tests/invoke/Makefile.am b/tests/invoke/Makefile.am
index 6e92251a..2b33d544 100644
--- a/tests/invoke/Makefile.am
+++ b/tests/invoke/Makefile.am
@@ -13,6 +13,10 @@ testfns_la_CFLAGS = $(GIREPO_CFLAGS) -I$(top_srcdir)/girepository
testfns_la_LDFLAGS = -module -avoid-version
testfns_la_LIBADD = $(GIREPO_LIBS) $(top_builddir)/girepository/libgirepository.la
+if OS_WIN32
+testfns_la_LDFLAGS += -no-undefined
+endif
+
BUILT_SOURCES = testfns-metadata.c
CLEANFILES = testfns-metadata.c
diff --git a/tests/invoke/invoke.c b/tests/invoke/invoke.c
index 7962c104..820c37a8 100644
--- a/tests/invoke/invoke.c
+++ b/tests/invoke/invoke.c
@@ -1,5 +1,4 @@
#include <stdlib.h>
-#include <dlfcn.h>
#include <string.h>
#include <glib.h>
@@ -131,7 +130,7 @@ main (int argc, char *argv[])
/* test GList*/
- g_print ("Test 6");
+ g_print ("Test 6\n");
info = g_irepository_find_by_name (rep, "test", "test6");
g_assert (g_base_info_get_type (info) == GI_INFO_TYPE_FUNCTION);
function = (GIFunctionInfo *)info;
@@ -147,7 +146,7 @@ main (int argc, char *argv[])
g_base_info_get_name (info),
error->message);
- g_print("returned %d", retval.v_int);
+ g_print("returned %d\n", retval.v_int);
g_assert (retval.v_int == 2);
g_list_free (list);
}
@@ -156,7 +155,7 @@ main (int argc, char *argv[])
g_clear_error (&error);
/* test GList more, transfer ownership*/
- g_print ("Test 7");
+ g_print ("Test 7\n");
info = g_irepository_find_by_name (rep, "test", "test7");
g_assert (g_base_info_get_type (info) == GI_INFO_TYPE_FUNCTION);
function = (GIFunctionInfo *)info;
@@ -172,7 +171,7 @@ main (int argc, char *argv[])
g_base_info_get_name (info),
error->message);
- g_print("returned %s", retval.v_pointer);
+ g_print("returned %s\n", retval.v_pointer);
g_assert (strcmp(retval.v_pointer, "Hey there...")==0);
g_list_foreach (list, (GFunc) g_free, NULL);
g_list_free (list);
@@ -208,34 +207,34 @@ main (int argc, char *argv[])
g_assert (g_base_info_get_type (info) == GI_INFO_TYPE_FUNCTION);
function = (GIFunctionInfo *)info;
- if (!g_function_info_invoke (function, NULL, 0, NULL, 0, NULL, &error))
- g_print ("Invokation of %s failed: %s\n",
- g_base_info_get_name (info),
- error->message);
+ g_assert (!g_function_info_invoke (function, NULL, 0, NULL, 0, NULL, &error) &&
+ error != NULL &&
+ error->domain == G_INVOKE_ERROR &&
+ error->code == G_INVOKE_ERROR_ARGUMENT_MISMATCH);
g_clear_error (&error);
/* too few out arguments */
- if (!g_function_info_invoke (function, in_args, 1, NULL, 0, NULL, &error))
- g_print ("Invokation of %s failed: %s\n",
- g_base_info_get_name (info),
- error->message);
+ g_assert (!g_function_info_invoke (function, in_args, 1, NULL, 0, NULL, &error) &&
+ error != NULL &&
+ error->domain == G_INVOKE_ERROR &&
+ error->code == G_INVOKE_ERROR_ARGUMENT_MISMATCH);
g_clear_error (&error);
/* too many in arguments */
- if (!g_function_info_invoke (function, in_args, 2, out_args, 1, NULL, &error))
- g_print ("Invokation of %s failed: %s\n",
- g_base_info_get_name (info),
- error->message);
+ g_assert (!g_function_info_invoke (function, in_args, 2, out_args, 1, NULL, &error) &&
+ error != NULL &&
+ error->domain == G_INVOKE_ERROR &&
+ error->code == G_INVOKE_ERROR_ARGUMENT_MISMATCH);
g_clear_error (&error);
/* too many out arguments */
- if (!g_function_info_invoke (function, in_args, 1, out_args, 2, NULL, &error))
- g_print ("Invokation of %s failed: %s\n",
- g_base_info_get_name (info),
- error->message);
+ g_assert (!g_function_info_invoke (function, in_args, 1, out_args, 2, NULL, &error) &&
+ error != NULL &&
+ error->domain == G_INVOKE_ERROR &&
+ error->code == G_INVOKE_ERROR_ARGUMENT_MISMATCH);
g_clear_error (&error);
diff --git a/tests/scanner/Makefile.am b/tests/scanner/Makefile.am
index 5383b998..dd58cf72 100644
--- a/tests/scanner/Makefile.am
+++ b/tests/scanner/Makefile.am
@@ -17,6 +17,10 @@ libdrawable_la_SOURCES = $(srcdir)/drawable.c $(srcdir)/drawable.h
libfoo_la_SOURCES = $(srcdir)/foo.c $(srcdir)/foo.h
libutility_la_SOURCES = $(srcdir)/utility.c $(srcdir)/utility.h
+if OS_WIN32
+AM_LDFLAGS += -no-undefined
+endif
+
GIRS =
SCANNER = $(top_srcdir)/tools/g-ir-scanner
SCANNER_LIBS = \
diff --git a/tools/compiler.c b/tools/compiler.c
index a3f5e723..b7112f22 100644
--- a/tools/compiler.c
+++ b/tools/compiler.c
@@ -24,6 +24,11 @@
#include <glib.h>
#include <glib/gstdio.h>
+#ifdef G_OS_WIN32
+#include <io.h>
+#include <fcntl.h>
+#endif
+
#include "girmodule.h"
#include "girnode.h"
#include "girparser.h"
@@ -96,7 +101,12 @@ write_out_typelib (gchar *prefix,
FILE *file;
if (output == NULL)
- file = stdout;
+ {
+ file = stdout;
+#ifdef G_OS_WIN32
+ setmode (fileno (file), _O_BINARY);
+#endif
+ }
else
{
gchar *filename;
@@ -105,7 +115,7 @@ write_out_typelib (gchar *prefix,
filename = g_strdup_printf ("%s-%s", prefix, output);
else
filename = g_strdup (output);
- file = g_fopen (filename, "w");
+ file = g_fopen (filename, "wb");
if (file == NULL)
{