changeset 362:ee0a97b3a630 gcc-4.3-cleanups

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 :-)
author mas01cr
date Wed, 12 Nov 2008 13:05:14 +0000
parents f172ac07230e
children 64d5de8b1a68
files audioDB.cpp
diffstat 1 files changed, 21 insertions(+), 17 deletions(-) [+]
line wrap: on
line diff
--- 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