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

Refactor - remove redundant function and all references

The function `assertWllFormed` was doing nothing different than `assert` which is
available in the same namespace. Removing it will lighten the filesize - albeit
very slightly - and reduce complexity.
This commit is contained in:
Joshua T Kalis 2014-04-13 10:02:56 -04:00
parent bb739c011e
commit 5828b2c687
4 changed files with 17 additions and 25 deletions

View file

@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/* globals assert, assertWellFormed, ColorSpace, DecodeStream, Dict, Encodings,
/* globals assert, ColorSpace, DecodeStream, Dict, Encodings,
error, ErrorFont, Font, FONT_IDENTITY_MATRIX, fontCharsToUnicode,
FontFlags, ImageKind, info, isArray, isCmd, isDict, isEOF, isName,
isNum, isStream, isString, JpegStream, Lexer, Metrics,
@ -564,10 +564,10 @@ var PartialEvaluator = (function PartialEvaluatorClosure() {
var xobj = xobjs.get(name);
if (xobj) {
assertWellFormed(isStream(xobj), 'XObject should be a stream');
assert(isStream(xobj), 'XObject should be a stream');
var type = xobj.dict.get('Subtype');
assertWellFormed(isName(type),
assert(isName(type),
'XObject should have a Name subtype');
if ('Form' == type.name) {
@ -942,10 +942,10 @@ var PartialEvaluator = (function PartialEvaluatorClosure() {
if (!xobj) {
break;
}
assertWellFormed(isStream(xobj), 'XObject should be a stream');
assert(isStream(xobj), 'XObject should be a stream');
var type = xobj.dict.get('Subtype');
assertWellFormed(isName(type),
assert(isName(type),
'XObject should have a Name subtype');
if ('Form' !== type.name) {
@ -1287,7 +1287,7 @@ var PartialEvaluator = (function PartialEvaluatorClosure() {
preEvaluateFont: function PartialEvaluator_preEvaluateFont(dict, xref) {
var baseDict = dict;
var type = dict.get('Subtype');
assertWellFormed(isName(type), 'invalid font Subtype');
assert(isName(type), 'invalid font Subtype');
var composite = false;
var uint8array;
@ -1303,7 +1303,7 @@ var PartialEvaluator = (function PartialEvaluatorClosure() {
dict = (isArray(df) ? xref.fetchIfRef(df[0]) : df);
type = dict.get('Subtype');
assertWellFormed(isName(type), 'invalid font Subtype');
assert(isName(type), 'invalid font Subtype');
composite = true;
}
@ -1434,7 +1434,7 @@ var PartialEvaluator = (function PartialEvaluatorClosure() {
}
fontName = (fontName || baseFont);
assertWellFormed(isName(fontName), 'invalid font name');
assert(isName(fontName), 'invalid font name');
var fontFile = descriptor.get('FontFile', 'FontFile2', 'FontFile3');
if (fontFile) {
@ -1827,7 +1827,7 @@ var EvaluatorPreprocessor = (function EvaluatorPreprocessorClosure() {
// argument
if (obj !== null && obj !== undefined) {
args.push((obj instanceof Dict ? obj.getAll() : obj));
assertWellFormed(args.length <= 33, 'Too many arguments');
assert(args.length <= 33, 'Too many arguments');
}
continue;
}