void-packages/srcpkgs/dwb/patches/dwb-isnan.patch
2016-06-11 02:06:50 +02:00

43 lines
1.6 KiB
Diff

diff --git src/scripts.c src/scripts.c
index 16784fc..71efc50 100644
--- src/scripts.c
+++ src/scripts.c
@@ -3231,16 +3231,17 @@ sutil_checksum(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObject, s
if (original == NULL)
return NIL;
+ double dtype;
GChecksumType type = G_CHECKSUM_SHA256;
if (argc > 1)
{
- type = JSValueToNumber(ctx, argv[1], exc);
- if (isnan(type))
+ dtype = JSValueToNumber(ctx, argv[1], exc);
+ if (isnan(dtype))
{
ret = NIL;
goto error_out;
}
- type = MIN(MAX(type, G_CHECKSUM_MD5), G_CHECKSUM_SHA256);
+ type = MIN(MAX((GChecksumType)dtype, G_CHECKSUM_MD5), G_CHECKSUM_SHA256);
}
checksum = g_compute_checksum_for_data(type, original, -1);
@@ -6247,11 +6248,14 @@ gobject_unblock_signal(JSContextRef ctx, JSObjectRef function, JSObjectRef this,
static JSValueRef
gobject_disconnect(JSContextRef ctx, JSObjectRef function, JSObjectRef this, size_t argc, const JSValueRef argv[], JSValueRef* exc)
{
- int id;
- if (argc > 0 && JSValueIsNumber(ctx, argv[0]) && !isnan(id = JSValueToNumber(ctx, argv[0], exc)))
+ if (argc == 0) {
+ return JSValueMakeBoolean(ctx, false);
+ }
+ double id = JSValueToNumber(ctx, argv[0], exc);
+ if (!isnan(id))
{
GObject *o = JSObjectGetPrivate(this);
- if (o != NULL && g_signal_handler_is_connected(o, id))
+ if (o != NULL && g_signal_handler_is_connected(o, (int)id))
{
sigdata_remove(id, o);
g_signal_handler_disconnect(o, id);