BOOL LLFeatureManager::parseFeatureTable(std::string filename) { llinfos << "Looking for feature table in " << filename << llendl; llifstream file; std::string name; U32 version; file.open(filename); /*Flawfinder: ignore*/ if (!file) { LL_WARNS("RenderInit") << "Unable to open feature table " << filename << LL_ENDL; return FALSE; } // Check file version file >> name; file >> version; if (name != "version") { LL_WARNS("RenderInit") << filename << " does not appear to be a valid feature table!" << LL_ENDL; return FALSE; } mTableVersion = version; LLFeatureList *flp = NULL; while (file >> name) { char buffer[MAX_STRING]; /*Flawfinder: ignore*/ if (name.substr(0,2) == "//") { // This is a comment. file.getline(buffer, MAX_STRING); continue; } if (name == "list") { if (flp) { //flp->dump(); } // It's a new mask, create it. file >> name; if (mMaskList.count(name)) { LL_ERRS("RenderInit") << "Overriding mask " << name << ", this is invalid!" << LL_ENDL; } flp = new LLFeatureList(name); mMaskList[name] = flp; } else { if (!flp) { LL_ERRS("RenderInit") << "Specified parameter before <list> keyword!" << LL_ENDL; return FALSE; } S32 available; F32 recommended; file >> available >> recommended; flp->addFeature(name, available, recommended); } }
BOOL LLFeatureManager::loadFeatureTables() { // *TODO - if I or anyone else adds something else to the skipped list // make this data driven. Put it in the feature table and parse it // correctly mSkippedFeatures.insert("RenderAnisotropic"); mSkippedFeatures.insert("RenderGamma"); mSkippedFeatures.insert("RenderVBOEnable"); mSkippedFeatures.insert("RenderFogRatio"); std::string data_path = gDirUtilp->getAppRODataDir(); data_path += gDirUtilp->getDirDelimiter(); data_path += FEATURE_TABLE_FILENAME; lldebugs << "Looking for feature table in " << data_path << llendl; llifstream file; std::string name; U32 version; file.open(data_path); /*Flawfinder: ignore*/ if (!file) { LL_WARNS("RenderInit") << "Unable to open feature table!" << LL_ENDL; return FALSE; } // Check file version file >> name; file >> version; if (name != "version") { LL_WARNS("RenderInit") << data_path << " does not appear to be a valid feature table!" << LL_ENDL; return FALSE; } mTableVersion = version; LLFeatureList *flp = NULL; while (!file.eof() && file.good()) { char buffer[MAX_STRING]; /*Flawfinder: ignore*/ file >> name; if (name.substr(0,2) == "//") { // This is a comment. file.getline(buffer, MAX_STRING); continue; } if (name.empty()) { // This is a blank line file.getline(buffer, MAX_STRING); continue; } if (name == "list") { if (flp) { //flp->dump(); } // It's a new mask, create it. file >> name; if (mMaskList.count(name)) { LL_ERRS("RenderInit") << "Overriding mask " << name << ", this is invalid!" << LL_ENDL; } flp = new LLFeatureList(name); mMaskList[name] = flp; } else { if (!flp) { LL_ERRS("RenderInit") << "Specified parameter before <list> keyword!" << LL_ENDL; } S32 available; F32 recommended; file >> available >> recommended; flp->addFeature(name, available, recommended); } }