From: Michal H. <ms...@gm...> - 2008-07-09 17:57:56
|
* encrypted -> useEncrypt because this field is set when we want to decrypt. It is set in setEncryption method so original isEncrypted could be false also for encrypted documents which just simply haven't set credentials. fetch method use this to check whether to provide fileKey to the Parser. * new encrypted field has clear meaning. It is set to true iff document is encrypted. Index: src/xpdf/xpdf/XRef.cc =================================================================== --- src/xpdf/xpdf/XRef.cc.orig 2008-07-04 17:38:34.000000000 -0600 +++ src/xpdf/xpdf/XRef.cc 2008-07-04 17:38:50.000000000 -0600 @@ -236,7 +236,7 @@ void XRef::initInternals(Guint pos) objStr = NULL; maxObj = 0; - encrypted = gFalse; + useEncrypt = gFalse; permFlags = defPermFlags; ownerPasswordOk = gFalse; @@ -845,7 +845,7 @@ void XRef::setEncryption(int permFlagsA, CryptAlgorithm encAlgorithmA) { int i; - encrypted = gTrue; + useEncrypt = gTrue; permFlags = permFlagsA; ownerPasswordOk = ownerPasswordOkA; if (keyLengthA <= 16) { @@ -919,7 +919,7 @@ Object *XRef::fetch(int num, int gen, Ob delete parser; goto err_damaged; } - if (!parser->getObj(obj, encrypted ? fileKey : (Guchar *)NULL, + if (!parser->getObj(obj, useEncrypt ? fileKey : (Guchar *)NULL, encAlgorithm, keyLength, num, gen)) failed = gTrue; Index: src/xpdf/xpdf/XRef.h =================================================================== --- src/xpdf/xpdf/XRef.h.orig 2008-07-04 17:38:34.000000000 -0600 +++ src/xpdf/xpdf/XRef.h 2008-07-04 17:38:50.000000000 -0600 @@ -193,7 +193,9 @@ protected: // damaged files int streamEndsLen; // number of valid entries in streamEnds ObjectStream *objStr; // cached object stream - GBool encrypted; // true if file is encrypted + GBool useEncrypt; // true if we want to decrypt content + // TODO where is this field initialized ??? + GBool encrypted; // Flag whether document is encrypted. int permFlags; // permission bits GBool ownerPasswordOk; // true if owner password is correct Guchar fileKey[16]; // file decryption key -- Michal Hocko |