Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id A98E9200B2F for ; Sun, 3 Jul 2016 10:04:58 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 9C466160A6B; Sun, 3 Jul 2016 08:04:58 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id E2273160A2C for ; Sun, 3 Jul 2016 10:04:57 +0200 (CEST) Received: (qmail 91314 invoked by uid 500); 3 Jul 2016 08:04:56 -0000 Mailing-List: contact commits-help@flex.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@flex.apache.org Delivered-To: mailing list commits@flex.apache.org Received: (qmail 91306 invoked by uid 99); 3 Jul 2016 08:04:56 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 03 Jul 2016 08:04:56 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id B8314E0278; Sun, 3 Jul 2016 08:04:56 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: harbs@apache.org To: commits@flex.apache.org Message-Id: <62615700a0fb4a7d847bef61be7d72e2@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: git commit: [flex-asjs] [refs/heads/develop] - Fixed BinaryData constructor to take strict types Date: Sun, 3 Jul 2016 08:04:56 +0000 (UTC) archived-at: Sun, 03 Jul 2016 08:04:58 -0000 Repository: flex-asjs Updated Branches: refs/heads/develop f6526b7e4 -> 44fbabe7f Fixed BinaryData constructor to take strict types Project: http://git-wip-us.apache.org/repos/asf/flex-asjs/repo Commit: http://git-wip-us.apache.org/repos/asf/flex-asjs/commit/44fbabe7 Tree: http://git-wip-us.apache.org/repos/asf/flex-asjs/tree/44fbabe7 Diff: http://git-wip-us.apache.org/repos/asf/flex-asjs/diff/44fbabe7 Branch: refs/heads/develop Commit: 44fbabe7f3238f70bb316795fc1751b2c610c7c6 Parents: f6526b7 Author: Harbs Authored: Sun Jul 3 11:04:51 2016 +0300 Committer: Harbs Committed: Sun Jul 3 11:04:51 2016 +0300 ---------------------------------------------------------------------- .../flex/org/apache/flex/utils/BinaryData.as | 40 ++++++-------------- 1 file changed, 12 insertions(+), 28 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/44fbabe7/frameworks/projects/Core/src/main/flex/org/apache/flex/utils/BinaryData.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/Core/src/main/flex/org/apache/flex/utils/BinaryData.as b/frameworks/projects/Core/src/main/flex/org/apache/flex/utils/BinaryData.as index db7f383..88a17d1 100644 --- a/frameworks/projects/Core/src/main/flex/org/apache/flex/utils/BinaryData.as +++ b/frameworks/projects/Core/src/main/flex/org/apache/flex/utils/BinaryData.as @@ -45,39 +45,23 @@ public class BinaryData * @playerversion AIR 2.6 * @productversion FlexJS 0.0 */ - public function BinaryData(bytes:Object = null) + COMPILE::SWF + public function BinaryData(bytes:ByteArray = null) { - COMPILE::SWF - { - if(bytes) - { - if(!(bytes is ByteArray)) - throw new Error("BinaryData expects an ByteArray in the constructor"); - ba = bytes as ByteArray; - } - else - ba = new ByteArray(); - } - - COMPILE::JS - { - if(bytes) - { - if(!(bytes is ArrayBuffer)) - throw new Error("BinaryData expects an ArrayBuffer in the constructor"); - ba = bytes as ArrayBuffer; - } - else - ba = new ArrayBuffer(0); - } - - } + ba = bytes ? bytes : new ByteArray(); + } + + COMPILE::JS + public function BinaryData(bytes:ArrayBuffer = null) + { + ba = bytes ? bytes : new ArrayBuffer(0); + } COMPILE::SWF - private var ba:ByteArray = new ByteArray(); + private var ba:ByteArray; COMPILE::JS - private var ba:ArrayBuffer = new ArrayBuffer(0); + private var ba:ArrayBuffer; COMPILE::JS private var _position:int = 0;