Support encoding/decoding NSUInteger arguments in WKRemoteObjectCoder.
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 23 Apr 2014 19:38:42 +0000 (19:38 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 23 Apr 2014 19:38:42 +0000 (19:38 +0000)
https://bugs.webkit.org/show_bug.cgi?id=132040

Add support for encoding/decoding NSUInteger arguments.

Patch by Yongjun Zhang <yongjun_zhang@apple.com> on 2014-04-23
Reviewed by Sam Weinig.

* Shared/API/Cocoa/WKRemoteObjectCoder.mm:
(encodeInvocation):
(decodeInvocationArguments):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@167719 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebKit2/ChangeLog
Source/WebKit2/Shared/API/Cocoa/WKRemoteObjectCoder.mm

index 37ec7e6..f4ef1a4 100644 (file)
@@ -1,3 +1,16 @@
+2014-04-23  Yongjun Zhang  <yongjun_zhang@apple.com>
+
+        Support encoding/decoding NSUInteger arguments in WKRemoteObjectCoder.
+        https://bugs.webkit.org/show_bug.cgi?id=132040
+
+        Add support for encoding/decoding NSUInteger arguments.
+
+        Reviewed by Sam Weinig.
+
+        * Shared/API/Cocoa/WKRemoteObjectCoder.mm:
+        (encodeInvocation):
+        (decodeInvocationArguments):
+
 2014-04-22  Ryosuke Niwa  <rniwa@webkit.org>
 
         Cursor doesn't change back to pointer when leaving the Safari window
index e543bdb..1b3db6d 100644 (file)
@@ -158,7 +158,7 @@ static void encodeInvocation(WKRemoteObjectEncoder *encoder, NSInvocation *invoc
         // bool
         case 'B': {
             BOOL value;
-            [invocation getArgument:&value atIndex:i];;
+            [invocation getArgument:&value atIndex:i];
 
             encodeToObjectStream(encoder, @(value));
             break;
@@ -167,7 +167,16 @@ static void encodeInvocation(WKRemoteObjectEncoder *encoder, NSInvocation *invoc
         // NSInteger
         case 'q': {
             NSInteger value;
-            [invocation getArgument:&value atIndex:i];;
+            [invocation getArgument:&value atIndex:i];
+
+            encodeToObjectStream(encoder, @(value));
+            break;
+        }
+
+        // NSUInteger
+        case 'Q': {
+            NSUInteger value;
+            [invocation getArgument:&value atIndex:i];
 
             encodeToObjectStream(encoder, @(value));
             break;
@@ -433,6 +442,13 @@ static void decodeInvocationArguments(WKRemoteObjectDecoder *decoder, NSInvocati
             break;
         }
 
+        // NSUInteger
+        case 'Q': {
+            NSUInteger value = [decodeObjectFromObjectStream(decoder, [NSSet setWithObject:[NSNumber class]]) unsignedIntegerValue];
+            [invocation setArgument:&value atIndex:i];
+            break;
+        }
+            
         // Objective-C object
         case '@': {
             NSSet *allowedClasses = allowedArgumentClasses[i - 2].get();