Skip to content

Commit 280b13b

Browse files
[cpp] fixed Lib.stringReference (closes #8457)
1 parent bef5c6c commit 280b13b

File tree

3 files changed

+14
-1
lines changed

3 files changed

+14
-1
lines changed

extra/CHANGES.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
jvm : fixed multiplication of `Null<Float>` and `Int` (#9870)
1818
flash : fixed loading swc libraries containing `Vector` without a type parameter (#9805)
1919
hl : fixed messages being send to wrong threads with `sendMessage`/`readMessage` in `sys.thread.Thread` (#9875)
20+
cpp : fixed `cpp.Lib.stringReference()` (#8457)
2021

2122
2020-07-22 4.1.3
2223

std/cpp/Lib.hx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ class Lib {
8888

8989
public static function stringReference(inBytes:haxe.io.Bytes):String {
9090
var result:String = "";
91-
untyped __global__.__hxcpp_string_of_bytes(inBytes.b, result, 0, 0, true);
91+
untyped __global__.__hxcpp_string_of_bytes(inBytes.b, result, 0, inBytes.length, true);
9292
return result;
9393
}
9494

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
package unit.issues;
2+
3+
class Issue8457 extends unit.Test {
4+
#if cpp
5+
function test() {
6+
var content = 'Hello world, testing, 1, 2, 3...';
7+
var bytes = haxe.io.Bytes.ofString(content);
8+
var s = cpp.Lib.stringReference(bytes);
9+
eq(content, s);
10+
}
11+
#end
12+
}

0 commit comments

Comments
 (0)