[Filesystem] Speed up conversion to octet in writeBytes 86/167586/1
authorJakub Skowron <j.skowron@samsung.com>
Wed, 17 Jan 2018 14:43:31 +0000 (15:43 +0100)
committerPiotr Kosko <p.kosko@samsung.com>
Thu, 18 Jan 2018 07:30:45 +0000 (08:30 +0100)
Do not use validateArgs to validate each value in array

Change-Id: I9ac59f59187c7f57a0213778d0f2552cb9de4538
Signed-off-by: Jakub Skowron <j.skowron@samsung.com>
src/filesystem/js/file_stream.js

index 954ef4957f42e8bbb6908a71c1ce10ba60b3a48a..07e7fca16ad2daf5a6aec6dcae3fd4a87dcd2feb 100644 (file)
@@ -124,7 +124,7 @@ function binary_to_string( data ) {
   var zero = String.fromCharCode(0x100);
   var b;
   for( var i = 0; i < len; i++ ) {
-    b = data[i];
+    b = data[i] & 0xFF;  // conversion to octet
     output += b == 0 ? zero : String.fromCharCode(b);
   }
   return output;
@@ -281,7 +281,7 @@ function writeBytes() {
     {
       name: 'byteData',
       type: types_.ARRAY,
-      values: types_.OCTET
+      values: undefined /* was types_.OCTET, but checking moved to binary_to_string for performance */
     }
   ]);