mirror of
https://github.com/zen-browser/pdf.js.git
synced 2025-07-10 02:05:37 +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:
parent
ad74f6e741
commit
5e627810e4
2 changed files with 4 additions and 12 deletions
|
@ -13,7 +13,7 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { assert, createPromiseCapability } from '../shared/util';
|
||||
import { assert, createPromiseCapability, stringToBytes } from '../shared/util';
|
||||
import {
|
||||
createResponseStatusError, validateRangeRequestCapabilities
|
||||
} from './network_utils';
|
||||
|
@ -48,11 +48,7 @@ function getArrayBuffer(xhr) {
|
|||
if (typeof data !== 'string') {
|
||||
return data;
|
||||
}
|
||||
var length = data.length;
|
||||
var array = new Uint8Array(length);
|
||||
for (var i = 0; i < length; i++) {
|
||||
array[i] = data.charCodeAt(i) & 0xFF;
|
||||
}
|
||||
let array = stringToBytes(data);
|
||||
return array.buffer;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue