Mercurial > hg > audiodb
comparison audioDB.cpp @ 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 | 3b6cd1dfbddb |
comparison
equal
deleted
inserted
replaced
361:f172ac07230e | 362:ee0a97b3a630 |
---|---|
524 command=COM_POWER; | 524 command=COM_POWER; |
525 dbName=args_info.database_arg; | 525 dbName=args_info.database_arg; |
526 return 0; | 526 return 0; |
527 } | 527 } |
528 | 528 |
529 if(args_info.INSERT_given){ | 529 if(args_info.INSERT_given) { |
530 command=COM_INSERT; | 530 command=COM_INSERT; |
531 dbName=args_info.database_arg; | 531 dbName=args_info.database_arg; |
532 inFile=args_info.features_arg; | 532 inFile=args_info.features_arg; |
533 if(args_info.key_given) | 533 if(args_info.key_given) { |
534 if(!args_info.features_given) | 534 if(!args_info.features_given) { |
535 error("INSERT: '-k key' argument depends on '-f features'"); | 535 error("INSERT: '-k key' argument depends on '-f features'"); |
536 else | 536 } else { |
537 key=args_info.key_arg; | 537 key=args_info.key_arg; |
538 if(args_info.times_given){ | 538 } |
539 } | |
540 if(args_info.times_given) { | |
539 timesFileName=args_info.times_arg; | 541 timesFileName=args_info.times_arg; |
540 if(strlen(timesFileName)>0){ | 542 if(strlen(timesFileName)>0) { |
541 if(!(timesFile = new std::ifstream(timesFileName,std::ios::in))) | 543 if(!(timesFile = new std::ifstream(timesFileName,std::ios::in))) { |
542 error("Could not open times file for reading", timesFileName); | 544 error("Could not open times file for reading", timesFileName); |
545 } | |
543 usingTimes=1; | 546 usingTimes=1; |
544 } | 547 } |
545 } | 548 } |
546 if (args_info.power_given) { | 549 if (args_info.power_given) { |
547 powerFileName = args_info.power_arg; | 550 powerFileName = args_info.power_arg; |
553 } | 556 } |
554 } | 557 } |
555 return 0; | 558 return 0; |
556 } | 559 } |
557 | 560 |
558 if(args_info.BATCHINSERT_given){ | 561 if(args_info.BATCHINSERT_given) { |
559 command=COM_BATCHINSERT; | 562 command=COM_BATCHINSERT; |
560 dbName=args_info.database_arg; | 563 dbName=args_info.database_arg; |
561 inFile=args_info.featureList_arg; | 564 inFile=args_info.featureList_arg; |
562 if(args_info.keyList_given) | 565 if(args_info.keyList_given) { |
563 if(!args_info.featureList_given) | 566 if(!args_info.featureList_given) { |
564 error("BATCHINSERT: '-K keyList' argument depends on '-F featureList'"); | 567 error("BATCHINSERT: '-K keyList' argument depends on '-F featureList'"); |
565 else | 568 } else { |
566 key=args_info.keyList_arg; // INCONSISTENT NO CHECK | 569 key=args_info.keyList_arg; // INCONSISTENT NO CHECK |
567 | 570 } |
571 } | |
568 /* TO DO: REPLACE WITH | 572 /* TO DO: REPLACE WITH |
569 if(args_info.keyList_given){ | 573 if(args_info.keyList_given){ |
570 trackFileName=args_info.keyList_arg; | 574 trackFileName=args_info.keyList_arg; |
571 if(strlen(trackFileName)>0 && !(trackFile = new std::ifstream(trackFileName,std::ios::in))) | 575 if(strlen(trackFileName)>0 && !(trackFile = new std::ifstream(trackFileName,std::ios::in))) |
572 error("Could not open keyList file for reading",trackFileName); | 576 error("Could not open keyList file for reading",trackFileName); |
573 } | 577 } |
574 AND UPDATE BATCHINSERT() | 578 AND UPDATE BATCHINSERT() |
575 */ | 579 */ |
576 | 580 |
577 if(args_info.timesList_given){ | 581 if(args_info.timesList_given) { |
578 timesFileName=args_info.timesList_arg; | 582 timesFileName=args_info.timesList_arg; |
579 if(strlen(timesFileName)>0){ | 583 if(strlen(timesFileName)>0) { |
580 if(!(timesFile = new std::ifstream(timesFileName,std::ios::in))) | 584 if(!(timesFile = new std::ifstream(timesFileName,std::ios::in))) |
581 error("Could not open timesList file for reading", timesFileName); | 585 error("Could not open timesList file for reading", timesFileName); |
582 usingTimes=1; | 586 usingTimes=1; |
583 } | 587 } |
584 } | 588 } |
585 if(args_info.powerList_given){ | 589 if(args_info.powerList_given) { |
586 powerFileName=args_info.powerList_arg; | 590 powerFileName=args_info.powerList_arg; |
587 if(strlen(powerFileName)>0){ | 591 if(strlen(powerFileName)>0) { |
588 if(!(powerFile = new std::ifstream(powerFileName,std::ios::in))) | 592 if(!(powerFile = new std::ifstream(powerFileName,std::ios::in))) |
589 error("Could not open powerList file for reading", powerFileName); | 593 error("Could not open powerList file for reading", powerFileName); |
590 usingPower=1; | 594 usingPower=1; |
591 } | 595 } |
592 } | 596 } |
643 // Query command and arguments | 647 // Query command and arguments |
644 if(args_info.QUERY_given){ | 648 if(args_info.QUERY_given){ |
645 command=COM_QUERY; | 649 command=COM_QUERY; |
646 dbName=args_info.database_arg; | 650 dbName=args_info.database_arg; |
647 // XOR features and key search | 651 // XOR features and key search |
648 if(!args_info.features_given && !args_info.key_given || (args_info.features_given && args_info.key_given)) | 652 if((!args_info.features_given && !args_info.key_given) || (args_info.features_given && args_info.key_given)) |
649 error("QUERY requires exactly one of either -f features or -k key"); | 653 error("QUERY requires exactly one of either -f features or -k key"); |
650 if(args_info.features_given) | 654 if(args_info.features_given) |
651 inFile=args_info.features_arg; // query from file | 655 inFile=args_info.features_arg; // query from file |
652 else{ | 656 else{ |
653 query_from_key = true; | 657 query_from_key = true; |