Closed Bug 436367 Opened 16 years ago Closed 16 years ago

TT: File.fileToByteArray does not set the length of the returning ByteArray

Categories

(Tamarin Graveyard :: Tracing Virtual Machine, defect)

x86
Windows XP
defect
Not set
normal

Tracking

(Not tracked)

VERIFIED FIXED

People

(Reporter: dschaffe, Assigned: tierney)

Details

Attachments

(2 files)

File.fileToByteArray should set length to ByteArray as the number of bytes read.  Many ByteArray function fail since they check if the pointer is past the length

this simple code e.g. shows the problem:
test.txt:
12345

bug.as:
import avmplus.*
var ba:ByteArray=File.fileToByteArray("test.txt",false);
print("bytearray.length should be 5 is 0");
print("bytearray.length="+ba.length);
// workaround manually set length
//ba.length=5;
print("ba[0-5]="+ba[0]+" "+ba[1]+" "+ba[2]+" "+ba[3]+" "+ba[4]);


actual: undefined undefined undefined undefined 
expected: 49 50 51 52 53
Assignee: nobody → tierney
Attachment #323736 - Flags: review?(treilly)
Attachment #323736 - Flags: review?(treilly) → review+
Pushed in changeset http://hg.mozilla.org/tamarin-tracing/index.cgi/rev/b5a18ce0a6d3
Status: NEW → RESOLVED
Closed: 16 years ago
Resolution: --- → FIXED
Attachment #404868 - Attachment is patch: true
Attachment #404868 - Attachment mime type: application/octet-stream → text/plain
Attachment #404868 - Flags: review?(brbaker) → review+
pushed new tests in changeset 2732:0a9e319cd180, closing as verified fixed.
Status: RESOLVED → VERIFIED
Flags: in-testsuite+
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: