cl-olefs

OLE File System tools for Common Lisp
git clone https://logand.com/git/cl-olefs.git/
Log | Files | Refs

commit fd92ff8f27cd3adde900c36d8435b29ce07a1171
parent c042a9ec907bc600bcaa250d951d32c26e0ee8d0
Author: Tomas Hlavaty <tom@logand.com>
Date:   Wed, 12 Feb 2014 22:28:50 +0100

fix bit fiddling in unicode strings

Diffstat:
Molefs.lisp | 16++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/olefs.lisp b/olefs.lisp @@ -1503,8 +1503,8 @@ (define-structure BIFF-ShortXLUnicodeString () (cch ubyte) (%dummy ubyte :member '(0 1)) - (fHighByte t :compute (not (zerop (logand #x80 %dummy)))) - (reserved1 t :compute (assert (zerop (logand #x7f %dummy)))) + (fHighByte t :compute (not (zerop (logand 1 %dummy)))) + (reserved1 t :compute (assert (zerop (logand #xfe %dummy)))) (rgb (ubyte (if fHighByte (* 2 cch) cch))) (decoded t :compute (string-from-octets rgb fHighByte))) @@ -1586,7 +1586,7 @@ (rgcb BIFF-RgbExtra)) #+nil -(define-structure BIFF-Formula () ;; TODO +(define-structure BIFF-Formula () ;; TODO also probably wrong bit fiddling (cell BIFF-Cell) (val BIFF-FormulaValue) (%dummy ushort) @@ -1631,11 +1631,11 @@ (define-structure BIFF-XLUnicodeRichExtendedString () (cch ushort) (%dummy ubyte) - (fHighByte t :compute (not (zerop (setq *reading-unicode-string* (logand #x80 %dummy))))) - (reserved1 t :compute (assert (zerop (logand #x40 %dummy)))) - (fExtSt t :compute (not (zerop (logand #x20 %dummy)))) - (fRichSt t :compute (not (zerop (logand #x10 %dummy)))) - (reserved2 t :compute (assert (zerop (logand #xf %dummy)))) + (fHighByte t :compute (not (zerop (setq *reading-unicode-string* (logand 1 %dummy))))) + (reserved1 t :compute (assert (zerop (logand 2 %dummy)))) + (fExtSt t :compute (not (zerop (logand 4 %dummy)))) + (fRichSt t :compute (not (zerop (logand 8 %dummy)))) + (reserved2 t :compute (assert (zerop (logand #xf0 %dummy)))) (cRun ushort :when fRichSt :default 0) (cbExtRst dword :when fExtSt :default 0) (rgb (ubyte (if fHighByte (* 2 cch) cch)))