예제 #1
0
파일: slprefs.c 프로젝트: jossk/OrangeC
void RestoreGeneralProps(struct xmlNode *node, int version)
{
    node = node->children;
    while (node)
    {
        if (IsNode(node, "PROP"))
        {
            struct xmlAttr *attribs = node->attribs;
            char *id = NULL;
            while (attribs)
            {
                if (IsAttrib(attribs, "ID"))
                    id = attribs->value;
                attribs = attribs->next;
            } 
            if (id)
            {
                SETTING *setting = PropFind(NULL, id);
                if (!setting)
                {
                    setting = calloc(1, sizeof(SETTING));
                    setting->type = e_text;
                    setting->id = strdup(id);
                    InsertSetting(&generalProject, setting);
                }
                if (setting)
                {
                    free(setting->value);
                    setting->value = strdup(node->textData);
                }
            }
        } 
        node = node->next;
    }
}
예제 #2
0
/* TODO refactoring in terms of variable names */
static int find_and_set_property(void *self, const struct Property *src_props,
		const char *prop_name, const struct PropertyValue *src_data)
{
	const struct Property *dst_prop = PropFind(src_props, src_data->type, prop_name);
	if (dst_prop == NULL)
		return -1;

	if (self == NULL)
		return -1;

	assert(dst_prop->SetProperty != NULL);
	return dst_prop->SetProperty(self, src_data);
}