8000 Fix build errors from utf8 enforcement changes · tronweb3/protobuf-javascript@16cb293 · GitHub
[go: up one dir, main page]

Skip to content
This repository was archived by the owner on Mar 17, 2025. It is now read-only.

Commit 16cb293

Browse files
committed
Fix build errors from utf8 enforcement changes
This change fixes some minor build issues from not using fully specified function names. There was also a missing parameter issue for BinaryDecoder.readStringWithLength's invocation of readString, but the former appears to be dead code so just removed it.
1 parent 27d4277 commit 16cb293

File tree

2 files changed

+3
-17
lines changed

2 files changed

+3
-17
lines changed

binary/decoder.js

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -405,7 +405,7 @@ jspb.BinaryDecoder.prototype.readSplitFixed64 = function(convert) {
405405
*/
406406
jspb.BinaryDecoder.prototype.checkCursor = function () {
407407
if (this.cursor_ > this.end_) {
408-
asserts.fail('Read past the end ' + this.cursor_ + ' > ' + this.end_);
408+
jspb.asserts.fail('Read past the end ' + this.cursor_ + ' > ' + this.end_);
409409
}
410410
}
411411

@@ -902,23 +902,10 @@ jspb.BinaryDecoder.prototype.readString = function (length, requireUtf8) {
902902
this.cursor_ += length;
903903
this.checkCursor();
904904
const result =
905-
jspb.binary.utf8.decodeUtf8(jspb.asserts.assert(this.bytes_), cursor, length, requireUtf8);
905+
jspb.binary.utf8.decodeUtf8(jspb.asserts.assert(this.bytes_), cursor, length, requireUtf8);
906906
return result;
907907
};
908908

909-
910-
/**
911-
* Reads and parses a UTF-8 encoded unicode string (with length prefix) from
912-
* the stream.
913-
* @return {string} The decoded string.
914-
* @export
915-
*/
916-
jspb.BinaryDecoder.prototype.readStringWithLength = function() {
917-
var length = this.readUnsignedVarint32();
918-
return this.readString(length);
919-
};
920-
921-
922909
/**
923910
* Reads a block of raw bytes from the binary stream.
924911
*

binary/utf8.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -326,7 +326,7 @@ let textEncoderInstance;
326326
jspb.binary.utf8.textEncoderEncode = function (
327327
/** string */ s, /** boolean */ rejectUnpairedSurrogates) {
328328
if (rejectUnpairedSurrogates) {
329-
checkWellFormed(s);
329+
jspb.binary.utf8.checkWellFormed(s);
330330
}
331331

332332
if (!textEncoderInstance) {
@@ -423,4 +423,3 @@ jspb.binary.utf8.encodeUtf8 = function (
423423
jspb.binary.utf8.textEncoderEncode(string, rejectUnpairedSurrogates) :
424424
jspb.binary.utf8.polyfillEncode(string, rejectUnpairedSurrogates);
425425
}
426-

0 commit comments

Comments
 (0)
0