Esempio n. 1
0
struct mime_store *
wfMimeList::find(const char *mimetype)
{
	struct mime_store *ret = NULL;
	struct wfListElement *tmp = head;

    for (; tmp; tmp = tmp->next)
	{
		struct mime_store *ele = (struct mime_store *) tmp->item;
		if (!wf_strcasecmp(ele->mimetype, mimetype))
		{
			ret = ele;
		}
	}

	return (ret);
}
Esempio n. 2
0
jint FontDisplayerPeerObject::
reconstruct(FontCatalogFile &fc)
{
	char buf[1024];
	int buflen;

	int over = 0;
	char *variable = NULL;
	char *value = NULL;
	char *ret;

	finalize();
	
	while (!over)
	{
		ret = fc.readline(buf, sizeof(buf));
		if (!ret)
		{
			over = 1;
			continue;
		}
		buflen = strlen((const char *)buf);
		if (buf[buflen-1] == '\n')
		{
			buf[buflen-1] = '\0';
			buflen--;
		}
		if (!strncmp(buf, "#", 1))
		{
			// Ignore comments
			continue;
		}
		wf_scanVariableAndValue(buf, buflen, variable, value);
		if (!wf_strcasecmp(variable, "displayer"))
		{
			continue;
		}
		else if (!wf_strcasecmp(variable, "type"))
		{
			if (!wf_strcasecmp(value, "dynamic"))
			{
				fpType = WF_FP_DYNAMIC;
			}
			else
			{
				deleted = 1;
				over = 1;
				continue;
			}
		}
		else if (!wf_strcasecmp(variable, "dlm"))
		{
			fontDisplayer = NULL;
			dlm.reconstruct(value);
			if (dlm.status() < 0)
			{
				deleted = 1;
				over = 1;
				continue;
			}
		}
		else if (!wf_strcasecmp(variable, "disabled"))
		{
			disabled = atoi(value);
		}
		else if (!wf_strcasecmp(variable, "name"))
		{
			if (displayerName) delete displayerName;
			displayerName = CopyString(value);
		}

		else if (!wf_strcasecmp(variable, "description"))
		{
			if (displayerDescription) delete displayerDescription;
			displayerDescription = CopyString(value);
		}
		else if (!wf_strcasecmp(variable, "mimeString"))
		{
			mimeList.reconstruct(value);
			registerConverters();
		}
		else if (!wf_strcasecmp(variable, "deleted"))
		{
			deleted = atoi(value);
		}
		else if (!wf_strcasecmp(variable, "catalog"))
		{
			catalog.reconstruct(fc);
		}
		else if (!strncmp(variable, "}", 1))
		{
			over = 1;
			continue;
		}
	}

	// sanity check the fpp
	if (dlm.filename() == NULL || dlm.status() <= 0 || fpType != WF_FP_DYNAMIC)
		deleted = 1;
	return (0);
}