Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
sxychenjing
engine
提交
84fc920f
E
engine
项目概览
sxychenjing
/
engine
与 Fork 源项目一致
从无法访问的项目Fork
通知
3
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
E
engine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
84fc920f
编写于
1月 09, 2018
作者:
M
Mikkel Nygaard Ravn
提交者:
GitHub
1月 09, 2018
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Deprecate support for big integers in standard message codec (#4528)
上级
5a72197b
变更
5
显示空白变更内容
内联
并排
Showing
5 changed file
with
45 addition
and
4 deletion
+45
-4
shell/platform/android/io/flutter/plugin/common/StandardMessageCodec.java
...ndroid/io/flutter/plugin/common/StandardMessageCodec.java
+13
-2
shell/platform/darwin/ios/framework/Headers/Flutter.h
shell/platform/darwin/ios/framework/Headers/Flutter.h
+8
-0
shell/platform/darwin/ios/framework/Headers/FlutterCodecs.h
shell/platform/darwin/ios/framework/Headers/FlutterCodecs.h
+14
-2
shell/platform/darwin/ios/framework/Source/FlutterStandardCodec.mm
...tform/darwin/ios/framework/Source/FlutterStandardCodec.mm
+4
-0
shell/platform/darwin/ios/framework/Source/flutter_standard_codec_unittest.mm
...n/ios/framework/Source/flutter_standard_codec_unittest.mm
+6
-0
未找到文件。
shell/platform/android/io/flutter/plugin/common/StandardMessageCodec.java
浏览文件 @
84fc920f
...
...
@@ -15,6 +15,8 @@ import java.util.List;
import
java.util.Map
;
import
java.util.Map.Entry
;
import
android.util.Log
;
/**
* MessageCodec using the Flutter standard binary encoding.
*
...
...
@@ -27,7 +29,7 @@ import java.util.Map.Entry;
* <ul>
* <li>null</li>
* <li>Booleans</li>
* <li>Bytes, Shorts, Integers, Longs
, BigIntegers
</li>
* <li>Bytes, Shorts, Integers, Longs</li>
* <li>Floats, Doubles</li>
* <li>Strings</li>
* <li>byte[], int[], long[], double[]</li>
...
...
@@ -40,7 +42,7 @@ import java.util.Map.Entry;
* <ul>
* <li>null: null</li>
* <li>Boolean: bool</li>
* <li>Byte, Short, Integer, Long
, BigInteger
: int</li>
* <li>Byte, Short, Integer, Long: int</li>
* <li>Float, Double: double</li>
* <li>String: String</li>
* <li>byte[]: Uint8List</li>
...
...
@@ -50,6 +52,12 @@ import java.util.Map.Entry;
* <li>List: List</li>
* <li>Map: Map</li>
* </ul>
*
* <p>Direct support for BigIntegers has been deprecated on 2018-01-09 to be made
* unavailable four weeks after this change is available on the Flutter alpha
* branch. BigIntegers were needed because the Dart 1.0 int type had no size
* limit. With Dart 2.0, the int type is a fixed-size, 64-bit signed integer.
* If you need to communicate larger integers, use String encoding instead.</p>
*/
public
final
class
StandardMessageCodec
implements
MessageCodec
<
Object
>
{
public
static
final
StandardMessageCodec
INSTANCE
=
new
StandardMessageCodec
();
...
...
@@ -89,6 +97,7 @@ public final class StandardMessageCodec implements MessageCodec<Object> {
private
static
final
byte
FALSE
=
2
;
private
static
final
byte
INT
=
3
;
private
static
final
byte
LONG
=
4
;
@Deprecated
private
static
final
byte
BIGINT
=
5
;
private
static
final
byte
DOUBLE
=
6
;
private
static
final
byte
STRING
=
7
;
...
...
@@ -195,6 +204,7 @@ public final class StandardMessageCodec implements MessageCodec<Object> {
writeAlignment
(
stream
,
8
);
writeDouble
(
stream
,
((
Number
)
value
).
doubleValue
());
}
else
if
(
value
instanceof
BigInteger
)
{
Log
.
w
(
"Flutter"
,
"Support for BigIntegers has been deprecated. Use String encoding instead."
);
stream
.
write
(
BIGINT
);
writeBytes
(
stream
,
((
BigInteger
)
value
).
toString
(
16
).
getBytes
(
UTF8
));
...
...
@@ -301,6 +311,7 @@ public final class StandardMessageCodec implements MessageCodec<Object> {
result
=
buffer
.
getLong
();
break
;
case
BIGINT:
{
Log
.
w
(
"Flutter"
,
"Support for BigIntegers has been deprecated. Use String encoding instead."
);
final
byte
[]
hex
=
readBytes
(
buffer
);
result
=
new
BigInteger
(
new
String
(
hex
,
UTF8
),
16
);
break
;
...
...
shell/platform/darwin/ios/framework/Headers/Flutter.h
浏览文件 @
84fc920f
...
...
@@ -8,6 +8,14 @@
/**
BREAKING CHANGES:
January 09, 2018: Deprecated FlutterStandardBigInteger and its use in
FlutterStandardMessageCodec and FlutterStandardMethodCodec. Scheduled to
be marked as unavailable once the deprecation has been available on the
flutter/flutter alpha branch for four weeks. FlutterStandardBigInteger was
needed because the Dart 1.0 int type had no size limit. With Dart 2.0, the
int type is a fixed-size, 64-bit signed integer. If you need to communicate
larger integers, use NSString encoding instead.
December 11, 2017: Deprecated "initWithFLXArchive" and
"initWithFLXArchiveWithScriptSnapshot" and scheculed the same to be marked as
unavailable on January 15, 2018. Instead, "initWithFlutterAssets" and
...
...
shell/platform/darwin/ios/framework/Headers/FlutterCodecs.h
浏览文件 @
84fc920f
...
...
@@ -91,7 +91,6 @@ FLUTTER_EXPORT
- `nil` or `NSNull`
- `NSNumber` (including their representation of Boolean values)
- `FlutterStandardBigInteger`
- `NSString`
- `FlutterStandardTypedData`
- `NSArray` of supported values
...
...
@@ -101,11 +100,17 @@ FLUTTER_EXPORT
- `nil` or `NSNull`: null
- `NSNumber`: `bool`, `int`, or `double`, depending on the contained value.
- `FlutterStandardBigInteger`: `int`
- `NSString`: `String`
- `FlutterStandardTypedData`: `Uint8List`, `Int32List`, `Int64List`, or `Float64List`
- `NSArray`: `List`
- `NSDictionary`: `Map`
Support for `FlutterStandardBigInteger` has been deprecated on 2018-01-09 to be
made unavailable four weeks after this change is available on the Flutter alpha
branch. `FlutterStandardBigInteger` were needed because the Dart 1.0 `int` type
had no size limit. With Dart 2.0, the `int` type is a fixed-size, 64-bit signed
integer. If you need to communicate larger integers, use `NSString` encoding
instead.
*/
FLUTTER_EXPORT
@interface
FlutterStandardMessageCodec
:
NSObject
<
FlutterMessageCodec
>
...
...
@@ -253,6 +258,13 @@ FLUTTER_EXPORT
and `FlutterStandardMethodCodec`.
*/
FLUTTER_EXPORT
FLUTTER_DEPRECATED
(
"Deprecated on 2018-01-09 to be made unavailable four weeks after the "
"deprecation is available on the flutter/flutter alpha branch. "
"FlutterStandardBigInteger was needed because the Dart 1.0 int type had no "
"size limit. With Dart 2.0, the int type is a fixed-size, 64-bit signed "
"integer. If you need to communicate larger integers, use NSString encoding "
"instead."
)
@interface
FlutterStandardBigInteger
:
NSObject
/**
Creates a `FlutterStandardBigInteger` from a hexadecimal representation.
...
...
shell/platform/darwin/ios/framework/Source/FlutterStandardCodec.mm
浏览文件 @
84fc920f
...
...
@@ -163,6 +163,9 @@ using namespace shell;
}
@end
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
@implementation
FlutterStandardBigInteger
+
(
instancetype
)
bigIntegerWithHex
:(
NSString
*
)
hex
{
return
[[[
FlutterStandardBigInteger
alloc
]
initWithHex
:
hex
]
autorelease
];
...
...
@@ -469,3 +472,4 @@ using namespace shell;
}
}
@end
#pragma clang diagnostic pop
shell/platform/darwin/ios/framework/Source/flutter_standard_codec_unittest.mm
浏览文件 @
84fc920f
...
...
@@ -66,6 +66,8 @@ TEST(FlutterStandardCodec, CanEncodeAndDecodeUInt32) {
checkEncodeDecode
(
@
(
value
),
[
NSData
dataWithBytes
:
bytes
length
:
9
]);
}
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
TEST
(
FlutterStandardCodec
,
CanEncodeAndDecodeUInt64AsHexString
)
{
FlutterStandardMessageCodec
*
codec
=
[
FlutterStandardMessageCodec
sharedInstance
];
UInt64
u64
=
0xfffffffffffffffa
;
...
...
@@ -73,6 +75,7 @@ TEST(FlutterStandardCodec, CanEncodeAndDecodeUInt64AsHexString) {
FlutterStandardBigInteger
*
decoded
=
[
codec
decode
:
encoded
];
ASSERT_TRUE
([
decoded
.
hex
isEqual
:
@"fffffffffffffffa"
]);
}
#pragma clang diagnostic pop
TEST
(
FlutterStandardCodec
,
CanEncodeAndDecodeSInt8
)
{
uint8_t
bytes
[
5
]
=
{
0x03
,
0xfe
,
0xff
,
0xff
,
0xff
};
...
...
@@ -96,11 +99,14 @@ TEST(FlutterStandardCodec, CanEncodeAndDecodeSInt64) {
checkEncodeDecode
(
@
(
0x1234567890abcdef
),
[
NSData
dataWithBytes
:
bytes
length
:
9
]);
}
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
TEST
(
FlutterStandardCodec
,
CanEncodeAndDecodeBigInteger
)
{
FlutterStandardBigInteger
*
value
=
[
FlutterStandardBigInteger
bigIntegerWithHex
:
@"-abcdef0123456789abcdef01234567890"
];
checkEncodeDecode
(
value
);
}
#pragma clang diagnostic pop
TEST
(
FlutterStandardCodec
,
CanEncodeAndDecodeFloat32
)
{
uint8_t
bytes
[
16
]
=
{
0x06
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录