1
0
Fork 0
mirror of https://github.com/mozilla/pdf.js.git synced 2025-04-26 01:58:06 +02:00

Use stringToBytes in more places

Rather than having (basically) verbatim copies of `stringToBytes` in a few places, we can simply use the helper function directly instead.
This commit is contained in:
Jonas Jenwald 2017-10-26 11:01:13 +02:00
parent ad74f6e741
commit 5e627810e4
2 changed files with 4 additions and 12 deletions

View file

@ -14,7 +14,7 @@
*/
import {
createObjectURL, FormatError, isSpace, shadow, Util
createObjectURL, FormatError, isSpace, shadow, stringToBytes, Util
} from '../shared/util';
import { isDict } from './primitives';
import { JpegImage } from './jpg';
@ -109,11 +109,7 @@ var Stream = (function StreamClosure() {
var StringStream = (function StringStreamClosure() {
function StringStream(str) {
var length = str.length;
var bytes = new Uint8Array(length);
for (var n = 0; n < length; ++n) {
bytes[n] = str.charCodeAt(n);
}
let bytes = stringToBytes(str);
Stream.call(this, bytes);
}