void wvPutFFN6 (FFN * item, wvStream * fd) { int len, i; U8 temp8 = 0; write_8ubit (fd, (U8) item->cbFfnM1); temp8 |= item->prq; temp8 |= item->fTrueType << 2; temp8 |= item->reserved1 << 3; temp8 |= item->ff << 4; temp8 |= item->reserved2 << 7; write_8ubit (fd, temp8); write_16ubit (fd, (U16) item->wWeight); write_8ubit (fd, item->chs); write_8ubit (fd, item->ixchSzAlt); len = item->cbFfnM1 - 5; if (len > 65) len = 65; for (i = 0; i < len; i++) write_8ubit (fd, (U8) item->xszFfn[i]); }
void wvPutLFO (LFO * item, wvStream * fd) { int i; write_32ubit (fd, item->lsid); write_32ubit (fd, item->reserved1); write_32ubit (fd, item->reserved2); write_8ubit (fd, item->clfolvl); for (i = 0; i < 3; i++) write_8ubit (fd, item->reserved3[i]); }
void wvPutPANOSE (PANOSE * item, wvStream * fd) { write_8ubit (fd, item->bFamilyType); write_8ubit (fd, item->bSerifStyle); write_8ubit (fd, item->bWeight); write_8ubit (fd, item->bProportion); write_8ubit (fd, item->bContrast); write_8ubit (fd, item->bStrokeVariation); write_8ubit (fd, item->bArmStyle); write_8ubit (fd, item->bLetterform); write_8ubit (fd, item->bMidline); write_8ubit (fd, item->bXHeight); }
void wvPutSTSHI (STSHI * item, U16 cbSTSHI, wvStream * fd) { U16 temp16 = 0, count = 0; int i; write_16ubit (fd, item->cstd); write_16ubit (fd, item->cbSTDBaseInFile); temp16 |= item->fStdStylenamesWritten; temp16 |= item->reserved << 1; write_16ubit (fd, temp16); write_16ubit (fd, (U16) item->stiMaxWhenSaved); write_16ubit (fd, item->istdMaxFixedWhenSaved); write_16ubit (fd, item->nVerBuiltInNamesWhenSaved); count = 12; /* add */ for (i = 0; i < 3; i++) { write_16ubit (fd, item->rgftcStandardChpStsh[i]); count += 2; if (count >= cbSTSHI) break; } while (count < cbSTSHI) { count++; write_8ubit (fd, 0); /* write garbage */ } }
void wvPutChar (wvStream * fd, U8 chartype, U16 ch) { if (chartype == 1) write_8ubit (fd, (U8) ch); else write_16ubit (fd, ch); }
void wvPutBRC (BRC * item, wvStream * fd) { U8 temp8 = 0; /* word 8 support */ write_8ubit (fd, (U8) item->dptLineWidth); write_8ubit (fd, (U8) item->brcType); write_8ubit (fd, (U8) item->ico); temp8 |= item->dptSpace; temp8 |= item->fShadow << 5; temp8 |= item->fFrame << 6; temp8 |= item->reserved << 7; write_8ubit (fd, temp8); }
void wvPutTBD (TBD * item, wvStream * fd) { U8 temp8 = 0; temp8 |= item->jc; temp8 |= item->tlc << 3; temp8 |= item->reserved << 6; write_8ubit (fd, temp8); }
void wvPutFLD (FLD * item, wvStream * fd) { U8 temp8 = (U8) 0; U8 ch = (U8) 0; /* FLD is a union of var1 && var2 * but they have a common 'ch' first member * I pray to god that this works XP & X-compilers */ ch = item->var1.ch; if (ch == 19) { temp8 |= ch; temp8 |= item->var1.reserved << 5; write_8ubit (fd, temp8); write_8ubit (fd, (U8) item->var1.flt); } else { temp8 |= ch; temp8 |= item->var2.reserved << 5; write_8ubit (fd, temp8); temp8 |= item->var2.fDiffer; temp8 |= item->var2.fZombieEmbed << 1; temp8 |= item->var2.fResultDirty << 2; temp8 |= item->var2.fResultEdited << 3; temp8 |= item->var2.fLocked << 4; temp8 |= item->var2.fPrivateResult << 5; temp8 |= item->var2.fNested << 6; temp8 |= item->var2.fHasSep << 7; write_8ubit (fd, temp8); } }
void wvPutFBSE(FBSE *item, wvStream *fd) { int i; write_8ubit(fd, item->btWin32); write_8ubit(fd, item->btMacOS); for (i = 0; i < 16; i++) write_8ubit(fd, item->rgbUid[i]); write_16ubit(fd, item->tag); write_32ubit(fd, item->size); write_32ubit(fd, item->cRef); write_32ubit(fd, item->foDelay); write_8ubit(fd, item->usage); write_8ubit(fd, item->cbName); write_8ubit(fd, item->unused2); write_8ubit(fd, item->unused3); }
U32 wvGetBitmap(BitmapBlip *abm, MSOFBH *amsofbh, wvStream *fd) { U32 i, count; char extra = 0; wvStream *stm = NULL; wvTrace(("starting bitmap at %x\n", wvStream_tell(fd))); for (i = 0; i < 16; i++) abm->m_rgbUid[i] = read_8ubit(fd); count = 16; abm->m_rgbUidPrimary[0] = 0; switch (amsofbh->fbt - msofbtBlipFirst) { case msoblipPNG: wvTrace(("msoblipPNG\n")); /* sprintf(buffer,"%s-wv-%d.png",aimage,no++); */ if (amsofbh->inst ^ msobiPNG) extra = 1; break; case msoblipJPEG: wvTrace(("msoblipJPEG\n")); /* sprintf(buffer,"%s-wv-%d.jpg",aimage,no++); */ if (amsofbh->inst ^ msobiJFIF) extra = 1; break; case msoblipDIB: wvTrace(("msoblipDIB\n")); /* sprintf(buffer,"%s-wv-%d.dib",aimage,no++); */ if (amsofbh->inst ^ msobiDIB) extra = 1; break; } if (extra) { for (i = 0; i < 16; i++) abm->m_rgbUidPrimary[i] = read_8ubit(fd); count += 16; } abm->m_bTag = read_8ubit(fd); abm->m_pvBits = NULL; count++; stm = wvStream_TMP_create(amsofbh->cbLength); if (!stm) { abm->m_pvBits = NULL; return 0; } for (i = count; i < amsofbh->cbLength; i++) write_8ubit(stm, read_8ubit(fd)); wvStream_rewind(stm); abm->m_pvBits = stm; count += i; return count; }
void wvPutFIB (FIB * item, wvStream * fd) { U16 temp16 = (U16) 0; U8 temp8 = (U8) 0; write_16ubit (fd, item->nProduct); write_16ubit (fd, item->lid); write_16ubit (fd, item->pnNext); temp16 |= item->fDot; temp16 |= item->fGlsy << 1; temp16 |= item->fComplex << 2; temp16 |= item->fHasPic << 3; temp16 |= item->cQuickSaves << 4; temp16 |= item->fEncrypted << 8; temp16 |= item->fWhichTblStm << 9; temp16 |= item->fReadOnlyRecommended << 10; temp16 |= item->fWriteReservation << 11; temp16 |= item->fExtChar << 12; temp16 |= item->fLoadOverride << 13; temp16 |= item->fFarEast << 14; temp16 |= item->fCrypto << 15; /* item->fDot = (temp16 & 0x0001); item->fGlsy = (temp16 & 0x0002) >> 1; item->fComplex = (temp16 & 0x0004) >> 2; item->fHasPic = (temp16 & 0x0008) >> 3; item->cQuickSaves = (temp16 & 0x00F0) >> 4; item->fEncrypted = (temp16 & 0x0100) >> 8; item->fWhichTblStm = (temp16 & 0x0200) >> 9; item->fReadOnlyRecommended = (temp16 & 0x0400) >> 10; item->fWriteReservation = (temp16 & 0x0800) >> 11; item->fExtChar = (temp16 & 0x1000) >> 12; item->fLoadOverride = (temp16 & 0x2000) >> 13; item->fFarEast = (temp16 & 0x4000) >> 14; item->fCrypto = (temp16 & 0x8000) >> 15; */ write_16ubit (fd, temp16); write_16ubit (fd, (U16) item->nFibBack); write_32ubit (fd, item->lKey); write_8ubit (fd, (U8) item->envr); temp8 |= item->fMac; temp8 |= item->fEmptySpecial << 1; temp8 |= item->fLoadOverridePage << 2; temp8 |= item->fFutureSavedUndo << 3; temp8 |= item->fWord97Saved << 4; temp8 |= item->fSpare0 << 5; /* item->fMac = (temp8 & 0x01); item->fEmptySpecial = (temp8 & 0x02) >> 1; item->fLoadOverridePage = (temp8 & 0x04) >> 2; item->fFutureSavedUndo = (temp8 & 0x08) >> 3; item->fWord97Saved = (temp8 & 0x10) >> 4; item->fSpare0 = (temp8 & 0xFE) >> 5; */ write_8ubit (fd, temp8); write_16ubit (fd, (U16) item->chse); write_16ubit (fd, item->chsTables); write_32ubit (fd, item->fcMin); write_32ubit (fd, item->fcMac); write_16ubit (fd, item->csw); write_16ubit (fd, item->wMagicCreated); write_16ubit (fd, item->wMagicRevised); write_16ubit (fd, item->wMagicCreatedPrivate); write_16ubit (fd, item->wMagicRevisedPrivate); write_16ubit (fd, (U16) item->pnFbpChpFirst_W6); write_16ubit (fd, (U16) item->pnChpFirst_W6); write_16ubit (fd, (U16) item->cpnBteChp_W6); write_16ubit (fd, (U16) item->pnFbpPapFirst_W6); write_16ubit (fd, (U16) item->pnPapFirst_W6); write_16ubit (fd, (U16) item->cpnBtePap_W6); write_16ubit (fd, (U16) item->pnFbpLvcFirst_W6); write_16ubit (fd, (U16) item->pnLvcFirst); write_16ubit (fd, (U16) item->cpnBteLvc); write_16ubit (fd, (U16) item->lidFE); write_16ubit (fd, (U16) item->clw); write_32ubit (fd, (U32) item->cbMac); write_32ubit (fd, item->lProductCreated); write_32ubit (fd, item->lProductRevised); write_32ubit (fd, item->ccpText); write_32ubit (fd, (U32) item->ccpFtn); write_32ubit (fd, (U32) item->ccpHdr); write_32ubit (fd, (U32) item->ccpMcr); write_32ubit (fd, (U32) item->ccpAtn); write_32ubit (fd, (U32) item->ccpEdn); write_32ubit (fd, (U32) item->ccpTxbx); write_32ubit (fd, (U32) item->ccpHdrTxbx); write_32ubit (fd, (U32) item->pnFbpChpFirst); write_32ubit (fd, (U32) item->pnChpFirst); write_32ubit (fd, (U32) item->cpnBteChp); write_32ubit (fd, (U32) item->pnFbpPapFirst); write_32ubit (fd, (U32) item->pnPapFirst); write_32ubit (fd, (U32) item->cpnBtePap); write_32ubit (fd, (U32) item->pnFbpLvcFirst); write_32ubit (fd, (U32) item->pnLvcFirst); write_32ubit (fd, (U32) item->cpnBteLvc); write_32ubit (fd, (U32) item->fcIslandFirst); write_32ubit (fd, (U32) item->fcIslandLim); write_16ubit (fd, item->cfclcb); write_32ubit (fd, (U32) item->fcStshfOrig); write_32ubit (fd, (U32) item->fcStshf); write_32ubit (fd, (U32) item->lcbStshf); write_32ubit (fd, (U32) item->fcPlcffndRef); write_32ubit (fd, item->lcbPlcffndRef); write_32ubit (fd, (U32) item->fcPlcffndTxt); write_32ubit (fd, item->lcbPlcffndTxt); write_32ubit (fd, (U32) item->fcPlcfandRef); write_32ubit (fd, item->lcbPlcfandRef); write_32ubit (fd, (U32) item->fcPlcfandTxt); write_32ubit (fd, item->lcbPlcfandTxt); write_32ubit (fd, (U32) item->fcPlcfsed); write_32ubit (fd, item->lcbPlcfsed); write_32ubit (fd, (U32) item->fcPlcpad); write_32ubit (fd, item->lcbPlcpad); write_32ubit (fd, (U32) item->fcPlcfphe); write_32ubit (fd, item->lcbPlcfphe); write_32ubit (fd, (U32) item->fcSttbfglsy); write_32ubit (fd, item->lcbSttbfglsy); write_32ubit (fd, (U32) item->fcPlcfglsy); write_32ubit (fd, item->lcbPlcfglsy); write_32ubit (fd, (U32) item->fcPlcfhdd); write_32ubit (fd, item->lcbPlcfhdd); write_32ubit (fd, (U32) item->fcPlcfbteChpx); write_32ubit (fd, item->lcbPlcfbteChpx); write_32ubit (fd, (U32) item->fcPlcfbtePapx); write_32ubit (fd, item->lcbPlcfbtePapx); write_32ubit (fd, (U32) item->fcPlcfsea); write_32ubit (fd, item->lcbPlcfsea); write_32ubit (fd, (U32) item->fcSttbfffn); write_32ubit (fd, item->lcbSttbfffn); write_32ubit (fd, (U32) item->fcPlcffldMom); write_32ubit (fd, item->lcbPlcffldMom); write_32ubit (fd, (U32) item->fcPlcffldHdr); write_32ubit (fd, item->lcbPlcffldHdr); write_32ubit (fd, (U32) item->fcPlcffldFtn); write_32ubit (fd, item->lcbPlcffldFtn); write_32ubit (fd, (U32) item->fcPlcffldAtn); write_32ubit (fd, item->lcbPlcffldAtn); write_32ubit (fd, (U32) item->fcPlcffldMcr); write_32ubit (fd, item->lcbPlcffldMcr); write_32ubit (fd, (U32) item->fcSttbfbkmk); write_32ubit (fd, item->lcbSttbfbkmk); write_32ubit (fd, (U32) item->fcPlcfbkf); write_32ubit (fd, item->lcbPlcfbkf); write_32ubit (fd, (U32) item->fcPlcfbkl); write_32ubit (fd, item->lcbPlcfbkl); write_32ubit (fd, (U32) item->fcCmds); write_32ubit (fd, item->lcbCmds); write_32ubit (fd, (U32) item->fcPlcmcr); write_32ubit (fd, item->lcbPlcmcr); write_32ubit (fd, (U32) item->fcSttbfmcr); write_32ubit (fd, item->lcbSttbfmcr); write_32ubit (fd, (U32) item->fcPrDrvr); write_32ubit (fd, item->lcbPrDrvr); write_32ubit (fd, (U32) item->fcPrEnvPort); write_32ubit (fd, item->lcbPrEnvPort); write_32ubit (fd, (U32) item->fcPrEnvLand); write_32ubit (fd, item->lcbPrEnvLand); write_32ubit (fd, (U32) item->fcWss); write_32ubit (fd, item->lcbWss); write_32ubit (fd, (U32) item->fcDop); write_32ubit (fd, item->lcbDop); write_32ubit (fd, (U32) item->fcSttbfAssoc); write_32ubit (fd, item->lcbSttbfAssoc); write_32ubit (fd, (U32) item->fcClx); write_32ubit (fd, item->lcbClx); write_32ubit (fd, (U32) item->fcPlcfpgdFtn); write_32ubit (fd, item->lcbPlcfpgdFtn); write_32ubit (fd, (U32) item->fcAutosaveSource); write_32ubit (fd, item->lcbAutosaveSource); write_32ubit (fd, (U32) item->fcGrpXstAtnOwners); write_32ubit (fd, item->lcbGrpXstAtnOwners); write_32ubit (fd, (U32) item->fcSttbfAtnbkmk); write_32ubit (fd, item->lcbSttbfAtnbkmk); write_32ubit (fd, (U32) item->fcPlcdoaMom); write_32ubit (fd, item->lcbPlcdoaMom); write_32ubit (fd, (U32) item->fcPlcdoaHdr); write_32ubit (fd, item->lcbPlcdoaHdr); write_32ubit (fd, (U32) item->fcPlcspaMom); write_32ubit (fd, item->lcbPlcspaMom); write_32ubit (fd, (U32) item->fcPlcspaHdr); write_32ubit (fd, item->lcbPlcspaHdr); write_32ubit (fd, (U32) item->fcPlcfAtnbkf); write_32ubit (fd, item->lcbPlcfAtnbkf); write_32ubit (fd, (U32) item->fcPlcfAtnbkl); write_32ubit (fd, item->lcbPlcfAtnbkl); write_32ubit (fd, (U32) item->fcPms); write_32ubit (fd, item->lcbPms); write_32ubit (fd, (U32) item->fcFormFldSttbs); write_32ubit (fd, item->lcbFormFldSttbs); write_32ubit (fd, (U32) item->fcPlcfendRef); write_32ubit (fd, item->lcbPlcfendRef); write_32ubit (fd, (U32) item->fcPlcfendTxt); write_32ubit (fd, item->lcbPlcfendTxt); write_32ubit (fd, (U32) item->fcPlcffldEdn); write_32ubit (fd, item->lcbPlcffldEdn); write_32ubit (fd, (U32) item->fcPlcfpgdEdn); write_32ubit (fd, item->lcbPlcfpgdEdn); write_32ubit (fd, (U32) item->fcDggInfo); write_32ubit (fd, item->lcbDggInfo); write_32ubit (fd, (U32) item->fcSttbfRMark); write_32ubit (fd, item->lcbSttbfRMark); write_32ubit (fd, (U32) item->fcSttbCaption); write_32ubit (fd, item->lcbSttbCaption); write_32ubit (fd, (U32) item->fcSttbAutoCaption); write_32ubit (fd, item->lcbSttbAutoCaption); write_32ubit (fd, (U32) item->fcPlcfwkb); write_32ubit (fd, item->lcbPlcfwkb); write_32ubit (fd, (U32) item->fcPlcfspl); write_32ubit (fd, item->lcbPlcfspl); write_32ubit (fd, (U32) item->fcPlcftxbxTxt); write_32ubit (fd, item->lcbPlcftxbxTxt); write_32ubit (fd, (U32) item->fcPlcffldTxbx); write_32ubit (fd, item->lcbPlcffldTxbx); write_32ubit (fd, (U32) item->fcPlcfhdrtxbxTxt); write_32ubit (fd, item->lcbPlcfhdrtxbxTxt); write_32ubit (fd, (U32) item->fcPlcffldHdrTxbx); write_32ubit (fd, item->lcbPlcffldHdrTxbx); write_32ubit (fd, (U32) item->fcStwUser); write_32ubit (fd, item->lcbStwUser); write_32ubit (fd, (U32) item->fcSttbttmbd); write_32ubit (fd, item->cbSttbttmbd); write_32ubit (fd, (U32) item->fcUnused); write_32ubit (fd, item->lcbUnused); write_32ubit (fd, (U32) item->fcPgdMother); write_32ubit (fd, item->lcbPgdMother); write_32ubit (fd, (U32) item->fcBkdMother); write_32ubit (fd, item->lcbBkdMother); write_32ubit (fd, (U32) item->fcPgdFtn); write_32ubit (fd, item->lcbPgdFtn); write_32ubit (fd, (U32) item->fcBkdFtn); write_32ubit (fd, item->lcbBkdFtn); write_32ubit (fd, (U32) item->fcPgdEdn); write_32ubit (fd, item->lcbPgdEdn); write_32ubit (fd, (U32) item->fcBkdEdn); write_32ubit (fd, item->lcbBkdEdn); write_32ubit (fd, (U32) item->fcSttbfIntlFld); write_32ubit (fd, item->lcbSttbfIntlFld); write_32ubit (fd, (U32) item->fcRouteSlip); write_32ubit (fd, item->lcbRouteSlip); write_32ubit (fd, (U32) item->fcSttbSavedBy); write_32ubit (fd, item->lcbSttbSavedBy); write_32ubit (fd, (U32) item->fcSttbFnm); write_32ubit (fd, item->lcbSttbFnm); write_32ubit (fd, (U32) item->fcPlcfLst); write_32ubit (fd, item->lcbPlcfLst); write_32ubit (fd, (U32) item->fcPlfLfo); write_32ubit (fd, item->lcbPlfLfo); write_32ubit (fd, (U32) item->fcPlcftxbxBkd); write_32ubit (fd, item->lcbPlcftxbxBkd); write_32ubit (fd, (U32) item->fcPlcftxbxHdrBkd); write_32ubit (fd, item->lcbPlcftxbxHdrBkd); write_32ubit (fd, (U32) item->fcDocUndo); write_32ubit (fd, item->lcbDocUndo); write_32ubit (fd, (U32) item->fcRgbuse); write_32ubit (fd, item->lcbRgbuse); write_32ubit (fd, (U32) item->fcUsp); write_32ubit (fd, item->lcbUsp); write_32ubit (fd, (U32) item->fcUskf); write_32ubit (fd, item->lcbUskf); write_32ubit (fd, (U32) item->fcPlcupcRgbuse); write_32ubit (fd, item->lcbPlcupcRgbuse); write_32ubit (fd, (U32) item->fcPlcupcUsp); write_32ubit (fd, item->lcbPlcupcUsp); write_32ubit (fd, (U32) item->fcSttbGlsyStyle); write_32ubit (fd, item->lcbSttbGlsyStyle); write_32ubit (fd, (U32) item->fcPlgosl); write_32ubit (fd, item->lcbPlgosl); write_32ubit (fd, (U32) item->fcPlcocx); write_32ubit (fd, item->lcbPlcocx); write_32ubit (fd, (U32) item->fcPlcfbteLvc); write_32ubit (fd, item->lcbPlcfbteLvc); write_32ubit (fd, item->ftModified.dwLowDateTime); write_32ubit (fd, item->ftModified.dwHighDateTime); /* wvGetFILETIME(&(item->ftModified),fd); */ /* wvPutFILETIME(&(item->ftModified), fd) */ write_32ubit (fd, (U32) item->fcPlcflvc); write_32ubit (fd, item->lcbPlcflvc); write_32ubit (fd, (U32) item->fcPlcasumy); write_32ubit (fd, item->lcbPlcasumy); write_32ubit (fd, (U32) item->fcPlcfgram); write_32ubit (fd, item->lcbPlcfgram); write_32ubit (fd, (U32) item->fcSttbListNames); write_32ubit (fd, item->lcbSttbListNames); write_32ubit (fd, (U32) item->fcSttbfUssr); write_32ubit (fd, item->lcbSttbfUssr); }
void wvPutSTD (STD * item, U16 len, wvStream * fd) { U16 temp16 = 0; U16 i, j; int pos; int ret = 0; U16 count = 0; temp16 |= item->sti; temp16 |= item->fScratch << 12; temp16 |= item->fInvalHeight << 13; temp16 |= item->fHasUpe << 14; temp16 |= item->fMassCopy << 15; write_16ubit (fd, temp16); temp16 = 0; temp16 |= item->sgc; temp16 |= item->istdBase << 4; write_16ubit (fd, temp16); temp16 = 0; temp16 |= item->cupx; temp16 |= item->istdNext << 4; write_16ubit (fd, temp16); write_16ubit (fd, (U16) item->bchUpe); count = 8; /* add */ pos = 11; ret = 1; write_8ubit (fd, (U8) len); for (i = 0; i < len; i++) { /* if (count > 10) */ /* write_16ubit(fd, (U16)item->xstzName[i]) */ /* else */ write_8ubit (fd, (U8) item->xstzName[i]); pos++; } for (i = 0; i < item->cupx; i++) { if ((pos + 1) / 2 != pos / 2) { /* eat odd bytes */ wvStream_offset (fd, -1); /* TODO: check me */ pos++; } write_16ubit (fd, item->grupxf[i].cbUPX); pos += 2; if (item->grupxf[i].cbUPX == 0) continue; if ((item->cupx == 1) || ((item->cupx == 2) && (i == 1))) { for (j = 0; j < item->grupxf[i].cbUPX; j++) { write_8ubit (fd, item->grupxf[i].upx.chpx.grpprl[j]); pos++; } } else if ((item->cupx == 2) && (i == 0)) { write_16ubit (fd, item->grupxf[i].upx.papx.istd); pos += 2; for (j = 0; j < item->grupxf[i].cbUPX - 2; j++) { write_8ubit (fd, item->grupxf[i].upx.papx.grpprl[j]); pos++; } } else { /* something is FUBAR -- maybe try to handle it here someday */ wvError (("Something FUBAR in wbPutSTD")); } } /* eat odd bytes */ if ((pos + 1) / 2 != pos / 2) /* check me */ wvStream_offset (fd, -1); }