# HG changeset patch # User mas01cr # Date 1226495114 0 # Node ID ee0a97b3a630484369fda96ef42c8c725156faf7 # Parent f172ac07230ee2a1199796b2b3395659344f81cd Add some braces to avoid ambiguous `else's. (Initially I didn't even understand why they could possibly be ambiguous, but then I realised that this isn't Python :-) diff -r f172ac07230e -r ee0a97b3a630 audioDB.cpp --- a/audioDB.cpp Wed Nov 12 13:05:13 2008 +0000 +++ b/audioDB.cpp Wed Nov 12 13:05:14 2008 +0000 @@ -526,20 +526,23 @@ return 0; } - if(args_info.INSERT_given){ + if(args_info.INSERT_given) { command=COM_INSERT; dbName=args_info.database_arg; inFile=args_info.features_arg; - if(args_info.key_given) - if(!args_info.features_given) + if(args_info.key_given) { + if(!args_info.features_given) { error("INSERT: '-k key' argument depends on '-f features'"); - else + } else { key=args_info.key_arg; - if(args_info.times_given){ + } + } + if(args_info.times_given) { timesFileName=args_info.times_arg; - if(strlen(timesFileName)>0){ - if(!(timesFile = new std::ifstream(timesFileName,std::ios::in))) + if(strlen(timesFileName)>0) { + if(!(timesFile = new std::ifstream(timesFileName,std::ios::in))) { error("Could not open times file for reading", timesFileName); + } usingTimes=1; } } @@ -555,16 +558,17 @@ return 0; } - if(args_info.BATCHINSERT_given){ + if(args_info.BATCHINSERT_given) { command=COM_BATCHINSERT; dbName=args_info.database_arg; inFile=args_info.featureList_arg; - if(args_info.keyList_given) - if(!args_info.featureList_given) + if(args_info.keyList_given) { + if(!args_info.featureList_given) { error("BATCHINSERT: '-K keyList' argument depends on '-F featureList'"); - else + } else { key=args_info.keyList_arg; // INCONSISTENT NO CHECK - + } + } /* TO DO: REPLACE WITH if(args_info.keyList_given){ trackFileName=args_info.keyList_arg; @@ -574,17 +578,17 @@ AND UPDATE BATCHINSERT() */ - if(args_info.timesList_given){ + if(args_info.timesList_given) { timesFileName=args_info.timesList_arg; - if(strlen(timesFileName)>0){ + if(strlen(timesFileName)>0) { if(!(timesFile = new std::ifstream(timesFileName,std::ios::in))) error("Could not open timesList file for reading", timesFileName); usingTimes=1; } } - if(args_info.powerList_given){ + if(args_info.powerList_given) { powerFileName=args_info.powerList_arg; - if(strlen(powerFileName)>0){ + if(strlen(powerFileName)>0) { if(!(powerFile = new std::ifstream(powerFileName,std::ios::in))) error("Could not open powerList file for reading", powerFileName); usingPower=1; @@ -645,7 +649,7 @@ command=COM_QUERY; dbName=args_info.database_arg; // XOR features and key search - if(!args_info.features_given && !args_info.key_given || (args_info.features_given && args_info.key_given)) + if((!args_info.features_given && !args_info.key_given) || (args_info.features_given && args_info.key_given)) error("QUERY requires exactly one of either -f features or -k key"); if(args_info.features_given) inFile=args_info.features_arg; // query from file