int FontDisplayerPeerObject::queryCatalog(struct nfrc *rc, struct nffmi *fmi) { int ret = catalog.supportsFmi(rc, fmi); if (ret < 0) { // Catalog may not have been initialized. if (!catalog.isInitialized(rc)) { // Now we need to load the dll to initialize the catalog. struct nffmi **fmis = ListFonts(rc, NULL); catalog.update(rc, fmis); if (fmis) { // XXX We need to free the fmis. We may get away // XXX doing that if we make catalog.update() not // XXX take a copy of the fmi. wf_releaseFmis(fmis); WF_FREE(fmis); } ret = catalog.supportsFmi(rc, fmi); } } return (ret); }
wfSizesList::~wfSizesList() { freeSizes(); if (rfs) { WF_FREE(rfs); } }
void wfSizesList::freeSizes() { if (sizes) { // XXX Possible alloc/free mismatch WF_FREE(sizes); sizes = NULL; } }
int FontMatchInfoObject:: releaseStringRepresentation(void) { if (stringRepresentation) { WF_FREE((char*)stringRepresentation); stringRepresentation = NULL; stringLen = stringMaxLen = 0; } return (0); }
extern "C" char * /*ARGSUSED*/ NF_AboutFonts(MWContext *context, const char *which) { #ifndef NO_HTML_DIALOGS_CHANGE cfbImpl *oimpl = nffbc2cfbImpl(WF_fbc); FontBrokerObject *fbobj = (FontBrokerObject *)oimpl->object; struct wfListElement *tmp = NULL; char *aboutData = NULL; int aboutDataLen = 0; int aboutDataMaxLen = 0; #define WF_ACCUMULATE(str) wf_addToString(&aboutData, &aboutDataLen, &aboutDataMaxLen, str); if (which && !wf_strncasecmp(which, "fonts?", 6) && !wf_strncasecmp(which+6, "people", 6)) { char *p; for (p=peopleMsg; *p; p++) *p -= 23; WF_ACCUMULATE(peopleMsg); for (p=peopleMsg; *p; p++) *p += 23; goto display; } WF_ACCUMULATE(XP_GetString(WF_MSG_ABOUT_BEGIN_1)); WF_ACCUMULATE(XP_GetString(WF_MSG_ABOUT_BEGIN_2)); WF_ACCUMULATE(XP_GetString(WF_MSG_ABOUT_BEGIN_3)); // List all the displayers and their mimetypes tmp = fbobj->fpPeers.head; for(; tmp; tmp = tmp->next) { FontDisplayerPeerObject *fpp = (FontDisplayerPeerObject *) tmp->item; char *buf = fpp->aboutData(); if (buf) { WF_ACCUMULATE(buf); WF_FREE(buf); } } display: // do html dialog static XPDialogInfo dialogInfo = { XP_DIALOG_OK_BUTTON | XP_DIALOG_CANCEL_BUTTON, wf_AboutFontsDialogDone, 600, 440 }; XPDialogStrings* strings; strings = XP_GetDialogStrings(XP_EMPTY_STRINGS); if (!strings) { if (aboutData) WF_FREE(aboutData); return (NULL); } if (aboutData) { XP_CopyDialogString(strings, 0, aboutData); WF_FREE(aboutData); aboutData = NULL; } else { XP_CopyDialogString(strings, 0, XP_GetString(WF_MSG_ABOUT_NO_DISPLAYER)); } XP_MakeHTMLDialog(context, &dialogInfo, WF_MSG_ABOUT_TITLE, strings, NULL, PR_FALSE); #undef WF_ACCUMULATE #endif /* NO_HTML_DIALOGS_CHANGE */ return (NULL); }