Merge pull request #4512 from fkaelberer/cleanUpStringConversion

Clean up duplicate string conversion functions
This commit is contained in:
Yury Delendik 2014-04-02 08:04:06 -05:00
commit 20f6dedea7
4 changed files with 47 additions and 68 deletions

View file

@ -14,7 +14,8 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/* globals PDFJS, shadow, isWorker, assert, warn, bytesToString, globalScope */
/* globals PDFJS, shadow, isWorker, assert, warn, bytesToString, string32,
globalScope */
'use strict';
@ -163,13 +164,6 @@ var FontLoader = {
(data.charCodeAt(offset + 3) & 0xff);
}
function string32(value) {
return String.fromCharCode((value >> 24) & 0xff) +
String.fromCharCode((value >> 16) & 0xff) +
String.fromCharCode((value >> 8) & 0xff) +
String.fromCharCode(value & 0xff);
}
function spliceString(s, offset, remove, insert) {
var chunk1 = s.substr(0, offset);
var chunk2 = s.substr(offset + remove);
@ -297,7 +291,7 @@ var FontFace = (function FontFaceClosure() {
return null;
}
var data = bytesToString(this.data);
var data = bytesToString(new Uint8Array(this.data));
var fontName = this.loadedName;
// Add the font-face rule to the document