void Camera::parseCameraChild(xmlDocPtr doc, xmlNodePtr cur) { if (!xmlStrcmp(cur->name, (const xmlChar *) "CFA")) { if (2 != getAttributeAsInt(cur, cur->name, "width") || 2 != getAttributeAsInt(cur, cur->name, "height")) { supported = FALSE; } else { cur = cur->xmlChildrenNode; while (cur != NULL) { parseCFA(doc, cur); cur = cur->next; } } return; } if (!xmlStrcmp(cur->name, (const xmlChar *) "Crop")) { cropPos.x = getAttributeAsInt(cur, cur->name, "x"); cropPos.y = getAttributeAsInt(cur, cur->name, "y"); if (cropPos.x < 0) ThrowCME("Negative X axis crop specified in camera %s %s", make.c_str(), model.c_str()); if (cropPos.y < 0) ThrowCME("Negative Y axis crop specified in camera %s %s", make.c_str(), model.c_str()); cropSize.x = getAttributeAsInt(cur, cur->name, "width"); cropSize.y = getAttributeAsInt(cur, cur->name, "height"); return; } if (!xmlStrcmp(cur->name, (const xmlChar *) "Sensor")) { parseSensorInfo(doc, cur); return; } if (!xmlStrcmp(cur->name, (const xmlChar *) "BlackAreas")) { cur = cur->xmlChildrenNode; while (cur != NULL) { parseBlackAreas(doc, cur); cur = cur->next; } return; } if (!xmlStrcmp(cur->name, (const xmlChar *) "Aliases")) { cur = cur->xmlChildrenNode; while (cur != NULL) { parseAlias(doc, cur); cur = cur->next; } return; } if (!xmlStrcmp(cur->name, (const xmlChar *) "Hints")) { cur = cur->xmlChildrenNode; while (cur != NULL) { parseHint(doc, cur); cur = cur->next; } return; } }
void exe_alias(char **args, int argc, struct alias_List * list) { char buf[256+1]; if(argc==1){ //show the alias list. // printf("%s\n", "show alias"); show_alias(list); return; } else if(argc==2){ if(strcmp(args[1],"-a")==0){ // add here if have time! // remove all the node in alias list alias_List_remove_all(list); return; }else{ // printf("%s\n", "add or check alias"); if(strlen(args[1])>256){ fprintf(stderr, "%s\n", "alias: too long"); return; } strncpy(buf,args[1],strlen(args[1])+1); buf[strlen(args[1])]='\0'; char *left; char *right; parseAlias(buf,&left,&right); if(!right){ //add new show_alias_one(list,left); }else{ // printf("%s\n", "add"); //add the alias to the list if(check_alias(list,left)){ update_alias(list,left,right); }else{ char *left_value = calloc(strlen(left)+1,sizeof(char)); strncpy(left_value,left,strlen(left)+1); char *right_value = calloc(strlen(right)+1,sizeof(char)); strncpy(right_value,right,strlen(right)+1); alias_List_push(list,left_value,right_value); } } } } else { fprintf(stderr, "%s\n", "format error"); } }