From 2b5bf724d12f03fc7d83d45c7c9d1e0705382810 Mon Sep 17 00:00:00 2001 From: Michael Bebenita Date: Tue, 9 Dec 2014 11:48:23 -0800 Subject: [PATCH] Change some of the natives to not expect null slots. --- midp/codec.js | 2 +- midp/device_control.js | 2 +- midp/fs.js | 6 +++--- midp/media.js | 2 +- midp/midp.js | 4 ++-- native.js | 30 +++++++++++++++--------------- override.js | 2 +- string.js | 6 +++--- tests/native.js | 4 ++-- 9 files changed, 29 insertions(+), 29 deletions(-) diff --git a/midp/codec.js b/midp/codec.js index 292e56822..938a8da1a 100644 --- a/midp/codec.js +++ b/midp/codec.js @@ -140,7 +140,7 @@ Native.create("com/nokia/mid/s40/codec/DataEncoder.put.(ILjava/lang/String;Ljava this.encoder.put(tag, util.fromJavaString(name), util.fromJavaString(value)); }); -Native.create("com/nokia/mid/s40/codec/DataEncoder.put.(ILjava/lang/String;J)V", function(tag, name, value, _) { +Native.create("com/nokia/mid/s40/codec/DataEncoder.put.(ILjava/lang/String;J)V", function(tag, name, value) { this.encoder.put(tag, util.fromJavaString(name), value.toNumber()); }); diff --git a/midp/device_control.js b/midp/device_control.js index ae596a0f9..83233d160 100644 --- a/midp/device_control.js +++ b/midp/device_control.js @@ -3,7 +3,7 @@ 'use strict'; -Native.create("com/nokia/mid/ui/DeviceControl.startVibra.(IJ)V", function(freq, longDuration, _) { +Native.create("com/nokia/mid/ui/DeviceControl.startVibra.(IJ)V", function(freq, longDuration) { // If method is called during a previously called vibration that has been // activated from this method, the previous vibration is stopped and the new // one is activated using the new set of parameters. diff --git a/midp/fs.js b/midp/fs.js index 41f511fc2..30448ab38 100644 --- a/midp/fs.js +++ b/midp/fs.js @@ -425,7 +425,7 @@ Native.create("com/ibm/oti/connection/file/Connection.renameImpl.([B[B)V", funct }); }, true); -Native.create("com/ibm/oti/connection/file/Connection.truncateImpl.([BJ)V", function(path, newLength, _) { +Native.create("com/ibm/oti/connection/file/Connection.truncateImpl.([BJ)V", function(path, newLength) { return new Promise(function(resolve, reject) { fs.open(util.decodeUtf8(path), function(fd) { if (fd == -1) { @@ -450,7 +450,7 @@ Native.create("com/ibm/oti/connection/file/FCInputStream.availableImpl.(I)I", fu return fs.getsize(fd) - fs.getpos(fd); }); -Native.create("com/ibm/oti/connection/file/FCInputStream.skipImpl.(JI)J", function(count, _, fd) { +Native.create("com/ibm/oti/connection/file/FCInputStream.skipImpl.(JI)J", function(count, fd) { var curpos = fs.getpos(fd); var size = fs.getsize(fd); if (curpos + count.toNumber() > size) { @@ -522,7 +522,7 @@ Native.create("com/ibm/oti/connection/file/FCOutputStream.openImpl.([B)I", funct }); }, true); -Native.create("com/ibm/oti/connection/file/FCOutputStream.openOffsetImpl.([BJ)I", function(jPath, offset, _) { +Native.create("com/ibm/oti/connection/file/FCOutputStream.openOffsetImpl.([BJ)I", function(jPath, offset) { var path = util.decodeUtf8(jPath); return new Promise(function(resolve, reject) { diff --git a/midp/media.js b/midp/media.js index d74386d12..45f785420 100644 --- a/midp/media.js +++ b/midp/media.js @@ -937,7 +937,7 @@ Native.create("com/sun/mmedia/MediaDownload.nNeedMoreDataImmediatelly.(I)Z", fun return true; }); -Native.create("com/sun/mmedia/MediaDownload.nSetWholeContentSize.(IJ)V", function(handle, contentSize, _) { +Native.create("com/sun/mmedia/MediaDownload.nSetWholeContentSize.(IJ)V", function(handle, contentSize) { var player = Media.PlayerCache[handle]; player.wholeContentSize = contentSize.toNumber(); }); diff --git a/midp/midp.js b/midp/midp.js index 776260d3d..c0d233771 100644 --- a/midp/midp.js +++ b/midp/midp.js @@ -1163,7 +1163,7 @@ MIDP.ConnectionRegistry = { } }; -Native.create("com/sun/midp/io/j2me/push/ConnectionRegistry.poll0.(J)I", function(time, _) { +Native.create("com/sun/midp/io/j2me/push/ConnectionRegistry.poll0.(J)I", function(time) { return new Promise(function(resolve, reject) { MIDP.ConnectionRegistry.waitForRegistration(function(id) { resolve(id); @@ -1186,7 +1186,7 @@ Native.create("com/sun/midp/io/j2me/push/ConnectionRegistry.add0.(Ljava/lang/Str return 0; }); -Native.create("com/sun/midp/io/j2me/push/ConnectionRegistry.addAlarm0.([BJ)J", function(jMidlet, jTime, _) { +Native.create("com/sun/midp/io/j2me/push/ConnectionRegistry.addAlarm0.([BJ)J", function(jMidlet, jTime) { var time = jTime.toNumber(), midlet = util.decodeUtf8(jMidlet); var lastAlarm = 0; diff --git a/native.js b/native.js index d77571275..7f37cc9a4 100644 --- a/native.js +++ b/native.js @@ -241,7 +241,7 @@ Native.create("java/lang/Object.hashCode.()I", function() { return hashCode; }); -Native.create("java/lang/Object.wait.(J)V", function(timeout, _, ctx) { +Native.create("java/lang/Object.wait.(J)V", function(timeout, ctx) { ctx.wait(this, timeout.toNumber()); }); @@ -371,7 +371,7 @@ Native.create("java/lang/Float.floatToIntBits.(F)I", (function() { Native.create("java/lang/Double.doubleToLongBits.(D)J", (function() { var da = new Float64Array(1); var ia = new Int32Array(da.buffer); - return function(val, _) { + return function(val) { da[0] = val; return Long.fromBits(ia[0], ia[1]); } @@ -389,7 +389,7 @@ Native.create("java/lang/Float.intBitsToFloat.(I)F", (function() { Native.create("java/lang/Double.longBitsToDouble.(J)D", (function() { var da = new Float64Array(1); var ia = new Int32Array(da.buffer); - return function(l, _) { + return function(l) { ia[0] = l.low_; ia[1] = l.high_; return da[0]; @@ -442,47 +442,47 @@ Native.create("java/lang/Runtime.totalMemory.()J", function() { Native.create("java/lang/Runtime.gc.()V", function() { }); -Native.create("java/lang/Math.floor.(D)D", function(val, _) { +Native.create("java/lang/Math.floor.(D)D", function(val) { return Math.floor(val); }); -Native.create("java/lang/Math.asin.(D)D", function(val, _) { +Native.create("java/lang/Math.asin.(D)D", function(val) { return Math.asin(val); }); -Native.create("java/lang/Math.acos.(D)D", function(val, _) { +Native.create("java/lang/Math.acos.(D)D", function(val) { return Math.acos(val); }); -Native.create("java/lang/Math.atan.(D)D", function(val, _) { +Native.create("java/lang/Math.atan.(D)D", function(val) { return Math.atan(val); }); -Native.create("java/lang/Math.atan2.(DD)D", function(x, _1, y, _2) { +Native.create("java/lang/Math.atan2.(DD)D", function(x, y) { return Math.atan2(x, y); }); -Native.create("java/lang/Math.sin.(D)D", function(val, _) { +Native.create("java/lang/Math.sin.(D)D", function(val) { return Math.sin(val); }); -Native.create("java/lang/Math.cos.(D)D", function(val, _) { +Native.create("java/lang/Math.cos.(D)D", function(val) { return Math.cos(val); }); -Native.create("java/lang/Math.tan.(D)D", function(val, _) { +Native.create("java/lang/Math.tan.(D)D", function(val) { return Math.tan(val); }); -Native.create("java/lang/Math.sqrt.(D)D", function(val, _) { +Native.create("java/lang/Math.sqrt.(D)D", function(val) { return Math.sqrt(val); }); -Native.create("java/lang/Math.ceil.(D)D", function(val, _) { +Native.create("java/lang/Math.ceil.(D)D", function(val) { return Math.ceil(val); }); -Native.create("java/lang/Math.floor.(D)D", function(val, _) { +Native.create("java/lang/Math.floor.(D)D", function(val) { return Math.floor(val); }); @@ -547,7 +547,7 @@ Native.create("java/lang/Thread.isAlive.()Z", function() { return !!this.alive; }); -Native.create("java/lang/Thread.sleep.(J)V", function(delay, _) { +Native.create("java/lang/Thread.sleep.(J)V", function(delay) { return new Promise(function(resolve, reject) { window.setTimeout(resolve, delay.toNumber()); }) diff --git a/override.js b/override.js index 0b4987fc8..ac32c6200 100644 --- a/override.js +++ b/override.js @@ -255,7 +255,7 @@ Override.create("java/io/ByteArrayInputStream.read.([BII)I", function(b, off, le return len; }); -Override.create("java/io/ByteArrayInputStream.skip.(J)J", function(long, _) { +Override.create("java/io/ByteArrayInputStream.skip.(J)J", function(long) { var n = long.toNumber(); if (this.pos + n > this.count) { diff --git a/string.js b/string.js index 149e1cefe..6c6bc95dc 100644 --- a/string.js +++ b/string.js @@ -307,7 +307,7 @@ Override.create("java/lang/String.valueOf.(I)Ljava/lang/String;", function(n) { return n.toString(); }); -Override.create("java/lang/String.valueOf.(J)Ljava/lang/String;", function(n, _) { +Override.create("java/lang/String.valueOf.(J)Ljava/lang/String;", function(n) { // This function takes a dummy second argument, since we're taking a // Long and need to pop two items off the stack. return n.toString(); @@ -498,7 +498,7 @@ Override.create("java/lang/StringBuffer.append.(I)Ljava/lang/StringBuffer;", fun return stringBufferAppend.call(this, n + ""); }); -Override.create("java/lang/StringBuffer.append.(J)Ljava/lang/StringBuffer;", function(n, _) { +Override.create("java/lang/StringBuffer.append.(J)Ljava/lang/StringBuffer;", function(n) { return stringBufferAppend.call(this, n + ""); }); @@ -595,7 +595,7 @@ Override.create("java/lang/StringBuffer.insert.(II)Ljava/lang/StringBuffer;", fu return stringBufferInsert.call(this, offset, n + ""); }); -Override.create("java/lang/StringBuffer.insert.(IJ)Ljava/lang/StringBuffer;", function(offset, n, _) { +Override.create("java/lang/StringBuffer.insert.(IJ)Ljava/lang/StringBuffer;", function(offset, n) { return stringBufferInsert.call(this, offset, n + ""); }); diff --git a/tests/native.js b/tests/native.js index 0f5030e22..aea38cd9f 100644 --- a/tests/native.js +++ b/tests/native.js @@ -5,11 +5,11 @@ Native.create("gnu/testlet/vm/NativeTest.getInt.()I", function() { return 0xFFFFFFFF; }); -Native.create("gnu/testlet/vm/NativeTest.getLongReturnLong.(J)J", function(val, _) { +Native.create("gnu/testlet/vm/NativeTest.getLongReturnLong.(J)J", function(val) { return Long.fromNumber(40 + val.toNumber()); }); -Native.create("gnu/testlet/vm/NativeTest.getLongReturnInt.(J)I", function(val, _) { +Native.create("gnu/testlet/vm/NativeTest.getLongReturnInt.(J)I", function(val) { return 40 + val.toNumber(); });