Hello community,
here is the log from the commit of package gjs for openSUSE:Factory
checked in at Mon Jan 17 18:54:03 CET 2011.
--------
--- GNOME/gjs/gjs.changes 2011-01-06 02:19:55.000000000 +0100
+++ gjs/gjs.changes 2011-01-17 10:24:24.000000000 +0100
@@ -1,0 +2,9 @@
+Mon Jan 17 10:00:23 CET 2011 - vuntz@opensuse.org
+
+- Update to version 0.7.9:
+ + Adapt to JS_GetStringChars removal in xulrunner 2.
+ + Handle wide ranging enum values better.
+ + Some tests fixes.
+- Add Url tag.
+
+-------------------------------------------------------------------
calling whatdependson for head-i586
Old:
----
gjs-0.7.8.tar.bz2
New:
----
gjs-0.7.9.tar.bz2
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ gjs.spec ++++++
--- /var/tmp/diff_new_pack.f96ksf/_old 2011-01-17 18:50:06.000000000 +0100
+++ /var/tmp/diff_new_pack.f96ksf/_new 2011-01-17 18:50:06.000000000 +0100
@@ -1,5 +1,5 @@
#
-# spec file for package gjs (Version 0.7.8)
+# spec file for package gjs
#
# Copyright (c) 2011 SUSE LINUX Products GmbH, Nuernberg, Germany.
#
@@ -27,12 +27,13 @@
%endif
Name: gjs
-Version: 0.7.8
+Version: 0.7.9
Release: 1
# FIXME: find out if tapsets should really be in devel package or in main package
License: MIT License (or similar)
Summary: JavaScript bindings based on gobject-introspection and Mozilla
Group: Development/Libraries/GNOME
+Url: http://live.gnome.org/Gjs
Source: %{name}-%{version}.tar.bz2
BuildRequires: gcc-c++
BuildRequires: mozilla-xulrunner%{xulrunner_ver}-devel
++++++ gjs-0.7.8.tar.bz2 -> gjs-0.7.9.tar.bz2 ++++++
++++ 11800 lines of diff (skipped)
++++ retrying with extended exclude list
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/gjs-0.7.8/config.h.in new/gjs-0.7.9/config.h.in
--- old/gjs-0.7.8/config.h.in 2010-12-22 19:40:33.000000000 +0100
+++ new/gjs-0.7.9/config.h.in 2011-01-12 21:36:15.000000000 +0100
@@ -31,6 +31,9 @@
/* Define if we still have JS_GetStringBytes */
#undef HAVE_JS_GETSTRINGBYTES
+/* Define if we still have JS_GetStringChars */
+#undef HAVE_JS_GETSTRINGCHARS
+
/* Define if we have JS_IsScriptFrame */
#undef HAVE_JS_ISSCRIPTFRAME
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/gjs-0.7.8/configure.ac new/gjs-0.7.9/configure.ac
--- old/gjs-0.7.8/configure.ac 2010-12-17 20:55:09.000000000 +0100
+++ new/gjs-0.7.9/configure.ac 2011-01-12 21:35:03.000000000 +0100
@@ -2,7 +2,7 @@
# Process this file with autoconf to produce a configure script.
AC_PREREQ(2.61)
-AC_INIT([gjs], [0.7.8],[http://bugzilla.gnome.org/enter_bug.cgi?product=gjs])
+AC_INIT([gjs], [0.7.9],[http://bugzilla.gnome.org/enter_bug.cgi?product=gjs])
AM_INIT_AUTOMAKE([dist-bzip2 no-dist-gzip])
AC_CONFIG_SRCDIR([gjs/console.c])
AC_CONFIG_HEADER([config.h])
@@ -148,6 +148,7 @@
AC_CHECK_LIB([mozjs], [JS_GetStringBytes], AC_DEFINE([HAVE_JS_GETSTRINGBYTES], [1], [Define if we still have JS_GetStringBytes]),, [$JS_LIBS])
AC_CHECK_LIB([mozjs], [JS_GetFunctionName], AC_DEFINE([HAVE_JS_GETFUNCTIONNAME], [1], [Define if we still have JS_GetFunctionName]),, [$JS_LIBS])
+AC_CHECK_LIB([mozjs], [JS_GetStringChars], AC_DEFINE([HAVE_JS_GETSTRINGCHARS], [1], [Define if we still have JS_GetStringChars]),, [$JS_LIBS])
AC_MSG_CHECKING([for mozilla-js >= 2 ])
if `$PKG_CONFIG --exists $JS_PACKAGE '>=' 2`; then
@@ -195,7 +196,7 @@
common_packages="gobject-2.0 >= gobject_required_version $JS_PACKAGE"
gjs_packages="gmodule-2.0 gthread-2.0 $common_packages"
-gjs_gi_packages="gobject-introspection-1.0 >= 0.9.5 $common_packages"
+gjs_gi_packages="gobject-introspection-1.0 >= 0.10.1 $common_packages"
gjs_cairo_gobject_packages="cairo-gobject $common_packages"
gjs_cairo_packages="cairo $common_packages"
gjs_dbus_packages="dbus-glib-1 $common_packages"
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/gjs-0.7.8/gi/arg.c new/gjs-0.7.9/gi/arg.c
--- old/gjs-0.7.8/gi/arg.c 2010-12-10 17:34:57.000000000 +0100
+++ new/gjs-0.7.9/gi/arg.c 2011-01-14 21:34:45.000000000 +0100
@@ -38,7 +38,7 @@
JSBool
_gjs_flags_value_is_valid(JSContext *context,
GType gtype,
- guint value)
+ gint64 value)
{
GFlagsValue *v;
guint32 tmpval;
@@ -51,13 +51,20 @@
klass = g_type_class_ref(gtype);
/* check all bits are defined for flags.. not necessarily desired */
- tmpval = value;
+ tmpval = (guint32)value;
+ if (tmpval != value) { /* Not a guint32 */
+ gjs_throw(context,
+ "0x%" G_GINT64_MODIFIER "x is not a valid value for flags %s",
+ value, g_type_name(G_TYPE_FROM_CLASS(klass)));
+ return JS_FALSE;
+ }
+
while (tmpval) {
v = g_flags_get_first_value(klass, tmpval);
if (!v) {
gjs_throw(context,
"0x%x is not a valid value for flags %s",
- value, g_type_name(G_TYPE_FROM_CLASS(klass)));
+ (guint32)value, g_type_name(G_TYPE_FROM_CLASS(klass)));
return JS_FALSE;
}
@@ -71,7 +78,7 @@
static JSBool
_gjs_enum_value_is_valid(JSContext *context,
GIEnumInfo *enum_info,
- int value)
+ gint64 value)
{
JSBool found;
int n_values;
@@ -82,7 +89,7 @@
for (i = 0; i < n_values; ++i) {
GIValueInfo *value_info;
- long enum_value;
+ gint64 enum_value;
value_info = g_enum_info_get_value(enum_info, i);
enum_value = g_value_info_get_value(value_info);
@@ -96,13 +103,52 @@
if (!found) {
gjs_throw(context,
- "%d is not a valid value for enumeration %s",
+ "%" G_GINT64_MODIFIER "d is not a valid value for enumeration %s",
value, g_base_info_get_name((GIBaseInfo *)enum_info));
}
return found;
}
+static gboolean
+_gjs_enum_uses_signed_type (GIEnumInfo *enum_info)
+{
+ switch (g_enum_info_get_storage_type (enum_info)) {
+ case GI_TYPE_TAG_INT8:
+ case GI_TYPE_TAG_INT16:
+ case GI_TYPE_TAG_INT32:
+ case GI_TYPE_TAG_INT64:
+ return TRUE;
+ default:
+ return FALSE;
+ }
+}
+
+/* This is hacky - g_function_info_invoke() and g_field_info_get/set_field() expect
+ * arg->v_int to have the enum value in arg->v_int and depend on all flags and
+ * enumerations being passed on the stack in a 32-bit field. See FIXME comment in
+ * g_field_info_get_field. The same assumption of enums cast to 32-bit signed integers
+ * is found in g_value_set_enum/g_value_set_flags().
+ */
+
+gint64
+_gjs_enum_from_int (GIEnumInfo *enum_info,
+ int int_value)
+{
+ if (_gjs_enum_uses_signed_type (enum_info))
+ return (gint64)int_value;
+ else
+ return (gint64)(guint32)int_value;
+}
+
+/* Here for symmetry, but result is the same for the two cases */
+static int
+_gjs_enum_to_int (GIEnumInfo *enum_info,
+ gint64 value)
+{
+ return (int)value;
+}
+
/* The typelib used to have machine-independent types like
* GI_TYPE_TAG_LONG that had to be converted; now we only
* handle GType specially here.
@@ -982,17 +1028,25 @@
nullable_type = FALSE;
if (interface_type == GI_INFO_TYPE_ENUM) {
- if (!JS_ValueToInt32(context, value, &arg->v_int)) {
+ gint64 value_int64;
+
+ if (!gjs_value_to_int64 (context, value, &value_int64))
wrong = TRUE;
- } else if (!_gjs_enum_value_is_valid(context, (GIEnumInfo *)interface_info, arg->v_int)) {
+ else if (!_gjs_enum_value_is_valid(context, (GIEnumInfo *)interface_info, value_int64))
wrong = TRUE;
- }
+ else
+ arg->v_int = _gjs_enum_to_int ((GIEnumInfo *)interface_info, value_int64);
+
} else if (interface_type == GI_INFO_TYPE_FLAGS) {
- if (!JS_ValueToInt32(context, value, &arg->v_int)) {
+ gint64 value_int64;
+
+ if (!gjs_value_to_int64 (context, value, &value_int64))
wrong = TRUE;
- } else if (!_gjs_flags_value_is_valid(context, gtype, arg->v_int)) {
+ else if (!_gjs_flags_value_is_valid(context, gtype, value_int64))
wrong = TRUE;
- }
+ else
+ arg->v_int = _gjs_enum_to_int ((GIEnumInfo *)interface_info, value_int64);
+
} else if (gtype == G_TYPE_NONE) {
gjs_throw(context, "Unexpected unregistered type unpacking GArgument from Number");
wrong = TRUE;
@@ -1720,14 +1774,24 @@
/* Enum/Flags are aren't pointer types, unlike the other interface subtypes */
if (interface_type == GI_INFO_TYPE_ENUM) {
- if (_gjs_enum_value_is_valid(context, (GIEnumInfo *)interface_info, arg->v_int))
- value = INT_TO_JSVAL(arg->v_int);
+ gint64 value_int64 = _gjs_enum_from_int ((GIEnumInfo *)interface_info, arg->v_int);
+
+ if (_gjs_enum_value_is_valid(context, (GIEnumInfo *)interface_info, value_int64)) {
+ jsval tmp;
+ if (JS_NewNumberValue(context, value_int64, &tmp))
+ value = tmp;
+ }
goto out;
} else if (interface_type == GI_INFO_TYPE_FLAGS) {
+ gint64 value_int64 = _gjs_enum_from_int ((GIEnumInfo *)interface_info, arg->v_int);
+
gtype = g_registered_type_info_get_g_type((GIRegisteredTypeInfo*)interface_info);
- if (_gjs_flags_value_is_valid(context, gtype, arg->v_int))
- value = INT_TO_JSVAL(arg->v_int);
+ if (_gjs_flags_value_is_valid(context, gtype, value_int64)) {
+ jsval tmp;
+ if (JS_NewNumberValue(context, value_int64, &tmp))
+ value = tmp;
+ }
goto out;
} else if (interface_type == GI_INFO_TYPE_STRUCT &&
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/gjs-0.7.8/gi/arg.h new/gjs-0.7.9/gi/arg.h
--- old/gjs-0.7.8/gi/arg.h 2010-12-10 17:34:57.000000000 +0100
+++ new/gjs-0.7.9/gi/arg.h 2011-01-14 21:34:45.000000000 +0100
@@ -74,7 +74,10 @@
JSBool _gjs_flags_value_is_valid (JSContext *context,
GType gtype,
- guint value);
+ gint64 value);
+
+gint64 _gjs_enum_from_int (GIEnumInfo *enum_info,
+ int int_value);
JSBool gjs_array_from_strv (JSContext *context,
jsval *value_p,
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/gjs-0.7.8/gi/enumeration.c new/gjs-0.7.9/gi/enumeration.c
--- old/gjs-0.7.8/gi/enumeration.c 2010-12-10 17:34:57.000000000 +0100
+++ new/gjs-0.7.9/gi/enumeration.c 2011-01-14 21:34:45.000000000 +0100
@@ -64,10 +64,11 @@
const char *value_name;
char *fixed_name;
gsize i;
- int value_val;
+ gint64 value_val;
+ jsval value_js;
value_name = g_base_info_get_name( (GIBaseInfo*) info);
- value_val = (int) g_value_info_get_value(info);
+ value_val = g_value_info_get_value(info);
/* g-i converts enum members such as GDK_GRAVITY_SOUTH_WEST to
* Gdk.GravityType.south-west (where 'south-west' is value_name)
@@ -82,11 +83,12 @@
}
gjs_debug(GJS_DEBUG_GENUM,
- "Defining enum value %s (fixed from %s) %d",
+ "Defining enum value %s (fixed from %s) %" G_GINT64_MODIFIER "d",
fixed_name, value_name, value_val);
- if (!JS_DefineProperty(context, in_object,
- fixed_name, INT_TO_JSVAL(value_val),
+ if (!JS_NewNumberValue(context, value_val, &value_js) ||
+ !JS_DefineProperty(context, in_object,
+ fixed_name, value_js,
NULL, NULL,
GJS_MODULE_PROP_FLAGS)) {
gjs_throw(context, "Unable to define enumeration value %s %d (no memory most likely)",
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/gjs-0.7.8/gi/value.c new/gjs-0.7.9/gi/value.c
--- old/gjs-0.7.8/gi/value.c 2010-12-10 17:34:57.000000000 +0100
+++ new/gjs-0.7.9/gi/value.c 2011-01-14 21:34:45.000000000 +0100
@@ -404,11 +404,14 @@
else
g_value_set_boxed(gvalue, gboxed);
} else if (g_type_is_a(gtype, G_TYPE_ENUM)) {
- if (JSVAL_IS_INT(value)) {
+ gint64 value_int64;
+
+ if (gjs_value_to_int64 (context, value, &value_int64)) {
GEnumValue *v;
+ /* See arg.c:_gjs_enum_to_int() */
v = g_enum_get_value(G_ENUM_CLASS(g_type_class_peek(gtype)),
- JSVAL_TO_INT(value));
+ (int)value_int64);
if (v == NULL) {
gjs_throw(context,
"%d is not a valid value for enumeration %s",
@@ -425,11 +428,14 @@
return JS_FALSE;
}
} else if (g_type_is_a(gtype, G_TYPE_FLAGS)) {
- if (JSVAL_IS_INT(value)) {
- if (!_gjs_flags_value_is_valid(context, gtype, JSVAL_TO_INT(value)))
+ gint64 value_int64;
+
+ if (gjs_value_to_int64 (context, value, &value_int64)) {
+ if (!_gjs_flags_value_is_valid(context, gtype, value_int64))
return JS_FALSE;
- g_value_set_flags(gvalue, value);
+ /* See arg.c:_gjs_enum_to_int() */
+ g_value_set_flags(gvalue, (int)value_int64);
} else {
gjs_throw(context,
"Wrong type %s; flags %s expected",
@@ -515,6 +521,36 @@
}
static JSBool
+convert_int_to_enum (JSContext *context,
+ jsval *value_p,
+ GType gtype,
+ int v)
+{
+ double v_double;
+
+ if (v > 0 && v < G_MAXINT) {
+ /* Optimize the unambiguous case */
+ v_double = v;
+ } else {
+ GIBaseInfo *info;
+
+ /* Need to distinguish between negative integers and unsigned integers */
+
+ info = g_irepository_find_by_gtype(g_irepository_get_default(),
+ gtype);
+
+ if (info == NULL) /* hope for the best */
+ v_double = v;
+ else
+ v_double = _gjs_enum_from_int ((GIEnumInfo *)info, v);
+
+ g_base_info_unref(info);
+ }
+
+ return JS_NewNumberValue(context, v_double, value_p);
+}
+
+static JSBool
gjs_value_from_g_value_internal(JSContext *context,
jsval *value_p,
const GValue *gvalue,
@@ -630,9 +666,7 @@
}
*value_p = OBJECT_TO_JSVAL(obj);
} else if (g_type_is_a(gtype, G_TYPE_ENUM)) {
- int v;
- v = g_value_get_enum(gvalue);
- *value_p = INT_TO_JSVAL(v);
+ return convert_int_to_enum(context, value_p, gtype, g_value_get_enum(gvalue));
} else if (g_type_is_a(gtype, G_TYPE_PARAM)) {
GParamSpec *gparam;
JSObject *obj;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/gjs-0.7.8/gjs/byteArray.c new/gjs-0.7.9/gjs/byteArray.c
--- old/gjs-0.7.8/gjs/byteArray.c 2010-12-03 00:47:25.000000000 +0100
+++ new/gjs-0.7.9/gjs/byteArray.c 2011-01-10 19:38:42.000000000 +0100
@@ -675,11 +675,17 @@
char *encoded;
gsize bytes_written;
GError *error;
- jschar *u16_chars;
+ const jschar *u16_chars;
gsize u16_len;
+#ifdef HAVE_JS_GETSTRINGCHARS
u16_chars = JS_GetStringChars(JSVAL_TO_STRING(argv[0]));
u16_len = JS_GetStringLength(JSVAL_TO_STRING(argv[0]));
+#else
+ u16_chars = JS_GetStringCharsAndLength(context, JSVAL_TO_STRING(argv[0]), &u16_len);
+ if (u16_chars == NULL)
+ goto out;
+#endif
error = NULL;
encoded = g_convert((char*) u16_chars,
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/gjs-0.7.8/gjs/jsapi-util-string.c new/gjs-0.7.9/gjs/jsapi-util-string.c
--- old/gjs-0.7.8/gjs/jsapi-util-string.c 2010-12-03 00:47:25.000000000 +0100
+++ new/gjs-0.7.9/gjs/jsapi-util-string.c 2011-01-10 19:38:42.000000000 +0100
@@ -34,7 +34,7 @@
char **utf8_string_p,
GError **error)
{
- jschar *s;
+ const jschar *s;
size_t s_length;
char *utf8_string;
long read_items;
@@ -50,8 +50,16 @@
return FALSE;
}
+#ifdef HAVE_JS_GETSTRINGCHARS
s = JS_GetStringChars(JSVAL_TO_STRING(string_val));
s_length = JS_GetStringLength(JSVAL_TO_STRING(string_val));
+#else
+ s = JS_GetStringCharsAndLength(context, JSVAL_TO_STRING(string_val), &s_length);
+ if (s == NULL) {
+ JS_EndRequest(context);
+ return FALSE;
+ }
+#endif
utf8_string = g_utf16_to_utf8(s,
(glong)s_length,
@@ -410,23 +418,31 @@
guint16 **data_p,
gsize *len_p)
{
- jschar *js_data;
+ const jschar *js_data;
+ JSBool retval = JS_FALSE;
JS_BeginRequest(context);
if (!JSVAL_IS_STRING(value)) {
gjs_throw(context,
"Value is not a string, can't return binary data from it");
- JS_EndRequest(context);
- return JS_FALSE;
+ goto out;
}
+#ifdef HAVE_JS_GETSTRINGCHARS
js_data = JS_GetStringChars(JSVAL_TO_STRING(value));
*len_p = JS_GetStringLength(JSVAL_TO_STRING(value));
+#else
+ js_data = JS_GetStringCharsAndLength(context, JSVAL_TO_STRING(value), len_p);
+ if (js_data == NULL)
+ goto out;
+#endif
*data_p = g_memdup(js_data, sizeof(*js_data)*(*len_p));
+ retval = JS_TRUE;
+out:
JS_EndRequest(context);
- return JS_TRUE;
+ return retval;
}
/**
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/gjs-0.7.8/gjs/jsapi-util.c new/gjs-0.7.9/gjs/jsapi-util.c
--- old/gjs-0.7.8/gjs/jsapi-util.c 2010-12-10 17:34:57.000000000 +0100
+++ new/gjs-0.7.9/gjs/jsapi-util.c 2011-01-14 21:34:45.000000000 +0100
@@ -1270,6 +1270,52 @@
}
/**
+ * gjs_value_to_int64:
+ * @context: the Javascript context object
+ * @val: Javascript value to convert
+ * @gint64: location to store the return value
+ *
+ * Converts a Javascript value into the nearest 64 bit signed value.
+ *
+ * This function behaves indentically for rounding to JSValToInt32(), which
+ * means that it rounds (0.5 toward positive infinity) rather than doing
+ * a C-style truncation to 0. If we change to using JSValToEcmaInt32() then
+ * this should be changed to match.
+ *
+ * Return value: If the javascript value converted to a number (see
+ * JS_ValueToNumber()) is NaN, or outside the range of 64-bit signed
+ * numbers, fails and sets an exception. Otherwise returns the value
+ * rounded to the nearest 64-bit integer. Like JS_ValueToInt32(),
+ * undefined throws, but null => 0, false => 0, true => 1.
+ */
+JSBool
+gjs_value_to_int64 (JSContext *context,
+ const jsval val,
+ gint64 *result)
+{
+ if (JSVAL_IS_INT (val)) {
+ *result = JSVAL_TO_INT (val);
+ return JS_TRUE;
+ } else {
+ double value_double;
+ if (!JS_ValueToNumber(context, val, &value_double))
+ return JS_FALSE;
+
+ if (isnan(value_double) ||
+ value_double < G_MININT64 ||
+ value_double > G_MAXINT64) {
+
+ gjs_throw(context,
+ "Value is not a valid 64-bit integer");
+ return JS_FALSE;
+ }
+
+ *result = (gint64)(value_double + 0.5);
+ return JS_TRUE;
+ }
+}
+
+/**
* gjs_parse_args:
* @context:
* @function_name: The name of the function being called
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/gjs-0.7.8/gjs/jsapi-util.h new/gjs-0.7.9/gjs/jsapi-util.h
--- old/gjs-0.7.8/gjs/jsapi-util.h 2010-12-10 17:34:57.000000000 +0100
+++ new/gjs-0.7.9/gjs/jsapi-util.h 2011-01-14 21:34:45.000000000 +0100
@@ -336,6 +336,10 @@
const char* gjs_get_type_name (jsval value);
+JSBool gjs_value_to_int64 (JSContext *context,
+ const jsval val,
+ gint64 *result);
+
jsval gjs_date_from_time_t (JSContext *context, time_t time);
JSBool gjs_parse_args (JSContext *context,
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/gjs-0.7.8/test/gjs-unit.c new/gjs-0.7.9/test/gjs-unit.c
--- old/gjs-0.7.8/test/gjs-unit.c 2010-12-13 15:53:01.000000000 +0100
+++ new/gjs-0.7.9/test/gjs-unit.c 2011-01-10 19:38:42.000000000 +0100
@@ -118,10 +118,57 @@
return result;
}
+/* Always return an absolute filename and treat all absolute path elements as
+ * absolute, not just the first one, e.g.
+ * ("/foo", "/bar", NULL) returns "/bar"
+ * (g_build_filename would return "/foo/bar")
+ * Returned path may still include '..' path elements.
+ */
+static char *
+build_absolute_filename(const char *first_element,
+ ...)
+{
+ const char *element;
+ va_list ap;
+ char *cwd;
+ char *path;
+ GPtrArray *array;
+
+ cwd = g_get_current_dir();
+
+ array = g_ptr_array_new();
+
+ g_ptr_array_add(array, cwd);
+
+ va_start(ap, first_element);
+
+ element = first_element;
+ while (element != NULL) {
+ if (g_path_is_absolute(element))
+ g_ptr_array_set_size(array, 0);
+
+ g_ptr_array_add(array, (char*)element);
+
+ element = va_arg(ap, const char *);
+ }
+ va_end(ap);
+
+ g_ptr_array_add(array, NULL);
+
+ path = g_build_filenamev((char **)array->pdata);
+
+ g_ptr_array_free(array, TRUE);
+
+ g_free(cwd);
+
+ return path;
+}
+
int
main(int argc, char **argv)
{
- /* These are relative to top_builddir */
+ /* These may be absolute or relative to top_builddir, depending whether
+ * GJS_TOP_SRCDIR is absolute or not */
const char * const path_directories[] = {
GJS_TOP_SRCDIR"/modules",
GJS_TOP_SRCDIR"/test/js/modules",
@@ -141,15 +188,12 @@
working_dir = g_get_current_dir();
- if(g_path_is_absolute(argv[0]))
- gjs_unit_path = g_strdup(argv[0]);
- else
- gjs_unit_path = g_build_filename(working_dir, argv[0], NULL);
+ gjs_unit_path = build_absolute_filename(argv[0], NULL);
gjs_unit_dir = g_path_get_dirname(gjs_unit_path);
/* the gjs-unit executable will be in