Skip to content

Commit

Permalink
Several scattered coverity scan fixes, from my previous work in 2.1-2…
Browse files Browse the repository at this point in the history
….3 (Part 2)
  • Loading branch information
zeehio committed Jan 19, 2015
1 parent ae46605 commit 525a98b
Show file tree
Hide file tree
Showing 330 changed files with 9,520 additions and 5,144 deletions.
3 changes: 2 additions & 1 deletion festival/config/config.in
Expand Up @@ -58,7 +58,8 @@ include $(EST)/config/config
ALSO_INCLUDE += clunits clustergen MultiSyn

## NITECH and Tokyo Institute of Technologies HTS support
ALSO_INCLUDE += hts_engine
## hts21_engine offers backwards compatibility with HTS voices for Festival 1.96
ALSO_INCLUDE += hts_engine hts21_engine

## Old diphone code that will be delete, left in only for some
## compatibility
Expand Down
2 changes: 1 addition & 1 deletion festival/examples/text2wave.sh
Expand Up @@ -50,7 +50,7 @@
Options
-mode <string> Explicit tts mode.
-o ofile File to save waveform (default is stdout).
-otype <string> Output waveform type: ulaw, snd, aiff, riff, nist etc.
-otype <string> Output waveform type: alaw, ulaw, snd, aiff, riff, nist etc.
(default is riff)
-F <int> Output frequency.
-scale <float> Volume factor
Expand Down
10 changes: 5 additions & 5 deletions festival/src/include/modules.h
Expand Up @@ -41,12 +41,12 @@
#ifndef __MODULES_H__
#define __MODULES_H__

EST_Item *add_word(EST_Utterance *u, const EST_String &name);
EST_Item *add_word(EST_Utterance *u, LISP word);
EST_Item *add_segment(EST_Utterance *u, const EST_String &s);
EST_Item *add_phrase(EST_Utterance *u);
EST_Item *add_word(EST_Utterance &u, const EST_String &name);
EST_Item *add_word(EST_Utterance &u, LISP word);
EST_Item *add_segment(EST_Utterance &u, const EST_String &s);
EST_Item *add_phrase(EST_Utterance &u);

void create_phraseinput(EST_Utterance *u);
void create_phraseinput(EST_Utterance &u);

#endif /* __MODULES_H__ */

Expand Down
2 changes: 2 additions & 0 deletions festival/src/modules/Lexicon/complex.cc
Expand Up @@ -44,6 +44,8 @@
#include "lexiconP.h"
#include "lts.h"

using namespace std;

static LISP check_and_fix(LISP entry);
static void check_sylphones(const char *name,LISP syls);

Expand Down
8 changes: 7 additions & 1 deletion festival/src/modules/Lexicon/lexicon.cc
Expand Up @@ -43,6 +43,8 @@
#include "lexiconP.h"
#include "lts.h"

using namespace std;

static int bl_match_entry(LISP entry,const EST_String &word);
static int match_features(LISP req_feats, LISP act_feats);

Expand Down Expand Up @@ -271,7 +273,11 @@ void Lexicon::binlex_init(void)
"\" not found or unreadble " << endl;
festival_error();
}
fread(magic_number,sizeof(char),4,binlexfp);
if (fread(magic_number,sizeof(char),4,binlexfp) != 4) {
cerr << "Lexicon: compile file \"" << bl_filename <<
"\" has wrong format (could not read magic number)" << endl;
festival_error();
}
magic_number[4] = '\0';
if ((EST_String)"MNCM" == (EST_String)magic_number)
{ // A compiled lexicon plus features
Expand Down
2 changes: 2 additions & 0 deletions festival/src/modules/Lexicon/lts_rules.cc
Expand Up @@ -58,6 +58,8 @@
#include "festival.h"
#include "lts.h"

using namespace std;

class LTS_Ruleset{
private:
EST_String p_name;
Expand Down
4 changes: 2 additions & 2 deletions festival/src/modules/MultiSyn/DiphoneBackoff.h
Expand Up @@ -59,8 +59,8 @@ class DiphoneBackoff {
EST_String backoff(EST_String left, EST_String right);
int backoff(EST_Item *left_phone);

ostream& print(ostream &st = cout) const;
friend ostream& operator << (ostream &st, const DiphoneBackoff &dbo);
std::ostream& print(ostream &st = std::cout) const;
friend std::ostream& operator << (std::ostream &st, const DiphoneBackoff &dbo);

private:
int is_defaultbackoff(const EST_Item *it) const;
Expand Down
5 changes: 5 additions & 0 deletions festival/src/modules/MultiSyn/DiphoneUnitVoice.cc
Expand Up @@ -65,6 +65,9 @@

#include "EST_Val.h"

using namespace std;


SIOD_REGISTER_TYPE(itemlist,ItemList)
VAL_REGISTER_TYPE(itemlist,ItemList)

Expand Down Expand Up @@ -248,6 +251,7 @@ DiphoneUnitVoice::~DiphoneUnitVoice()

void DiphoneUnitVoice::addToCatalogue( const EST_Utterance *utt )
{
(void) utt;
// needed?
}

Expand Down Expand Up @@ -384,6 +388,7 @@ static EST_VTCandidate* getCandidatesFunction( EST_Item *s,
EST_VTCandidate* DiphoneUnitVoice::getCandidates( EST_Item *s,
EST_Features &f) const
{
(void) f;
EST_VTCandidate *c = 0;
EST_VTCandidate *moduleListHead = 0;
EST_VTCandidate *moduleListTail = 0;
Expand Down
3 changes: 3 additions & 0 deletions festival/src/modules/MultiSyn/EST_DiphoneCoverage.cc
Expand Up @@ -50,6 +50,9 @@
#include "EST_TargetCost.h"
#include "EST_DiphoneCoverage.h"

using namespace std;


/*
* This file contains some functions which may be useful for diphone
* selection. Not quite sure exactly how yet...
Expand Down
1 change: 1 addition & 0 deletions festival/src/modules/MultiSyn/EST_JoinCostCache.cc
Expand Up @@ -130,6 +130,7 @@ bool EST_JoinCostCache::computeAndCache( const EST_TList<EST_Item*> &list,
const EST_JoinCost &jc,
bool verbose )
{
(void)verbose;
unsigned char qcost; // quantized cost

unsigned int qleveln = maxVal-minVal;
Expand Down
2 changes: 0 additions & 2 deletions festival/src/modules/MultiSyn/EST_JoinCostCache.h
Expand Up @@ -60,8 +60,6 @@
#include "ling_class/EST_Item.h"
#include <iostream>

using namespace std;

class EST_JoinCost;

class EST_JoinCostCache {
Expand Down
3 changes: 3 additions & 0 deletions festival/src/modules/MultiSyn/EST_TargetCost.cc
Expand Up @@ -50,6 +50,9 @@
#include "EST_TargetCost.h"
#include "siod.h"

using namespace std;


static const EST_String simple_pos(const EST_String &s);
static const EST_Utterance *tc_get_utt(const EST_Item *seg);
static const EST_Item* tc_get_syl(const EST_Item *seg);
Expand Down
2 changes: 1 addition & 1 deletion festival/src/modules/MultiSyn/EST_TargetCost.h
Expand Up @@ -81,7 +81,7 @@ class EST_TargetCost {

// Base class operator() doesn't do much, but it will work.
virtual float operator()( const EST_Item* targp, const EST_Item* candp ) const
{ return defScore; }
{ (void)targp; (void)candp; return defScore; }

// Allow flatpacking
virtual const bool is_flatpack() const {return false;}
Expand Down
2 changes: 1 addition & 1 deletion festival/src/modules/MultiSyn/UnitSelection.cc
Expand Up @@ -468,7 +468,7 @@ static LISP FT_du_voice_setJoinCost(LISP l_voice, LISP l_tc)
CHECK_PTR(jc);
}
else
EST_error( "du_voice_setJoinCost: currently t is the only supported second arguement" );
EST_error( "du_voice_setJoinCost: currently t is the only supported second argument" );

duv->setJoinCost(jc,true);
}
Expand Down
2 changes: 2 additions & 0 deletions festival/src/modules/Text/text.cc
Expand Up @@ -49,6 +49,8 @@
#include "festival.h"
#include "text.h"

using namespace std;

static void tts_raw_token(EST_Item *t);
static void tts_raw_utt(LISP utt);

Expand Down
6 changes: 5 additions & 1 deletion festival/src/modules/Text/text_modes.cc
Expand Up @@ -52,6 +52,8 @@
#include "text.h"
#include "lexicon.h"

using namespace std;

static void um_apply_filter(const EST_String &filtername,
const EST_String &infile,
const EST_String &outname);
Expand Down Expand Up @@ -153,7 +155,9 @@ void um_apply_filter(const EST_String &filtername,
else
{
command = filtername + " '" + infile + "' > " + outfile;
system(command); // should test if this is successful or not
if (system(command) != 0) {
cerr << "Filter " << filtername << " failed" << endl;
}
}
}

4 changes: 3 additions & 1 deletion festival/src/modules/Text/tok_ext.cc
Expand Up @@ -48,6 +48,8 @@
#include "lexicon.h"
#include "text.h"

using namespace std;

static int rhc = 10;
static int lhc = 10;

Expand Down Expand Up @@ -162,5 +164,5 @@ static void append_token(EST_Relation &ps, const EST_Token &t)
EST_Item *item = ps.append();

item->set_name(t.string());
item->set("filepos",t.filepos());
item->set("filepos", (int)t.filepos());
}
10 changes: 5 additions & 5 deletions festival/src/modules/Text/token.cc
Expand Up @@ -113,13 +113,13 @@ LISP FT_Any_Token_Utt(LISP utt)
words = word_it(t,t->name());
for (w=words; w != NIL; w=cdr(w))
{
new_word = add_word(u,car(w));
new_word = add_word(*u,car(w));
append_daughter(t,"Token",new_word);
}
}
else
{ // No user token_to_word function so just do it directly
new_word = add_word(u,t->name());
new_word = add_word(*u,t->name());
append_daughter(t,"Token",new_word);
}
}
Expand Down Expand Up @@ -156,15 +156,15 @@ LISP FT_English_Token_Utt(LISP utt)
l = symbolexplode(strintern(t->f("prepunctuation").string()));
for (w=l; w != NIL; w=cdr(w))
{
new_word = add_word(u,car(w));
new_word = add_word(*u,car(w));
append_daughter(t,"Token",new_word);
}
}

// Words become words
for (w=words; w != NIL; w=cdr(w))
{
new_word = add_word(u,car(w));
new_word = add_word(*u,car(w));
append_daughter(t,"Token",new_word);
}

Expand All @@ -181,7 +181,7 @@ LISP FT_English_Token_Utt(LISP utt)
l = symbolexplode(strintern(ffeature(t,"punc").string()));
for (w=l; w != NIL; w=cdr(w))
{
new_word = add_word(u,car(w));
new_word = add_word(*u,car(w));
append_daughter(t,"Token",new_word);
}
}
Expand Down
2 changes: 2 additions & 0 deletions festival/src/modules/Text/xxml.cc
Expand Up @@ -48,6 +48,8 @@
#include "text.h"
#include "lexicon.h"

using namespace std;

static LISP xxml_get_attribute(const EST_String &remainder);
static char *xxml_process_line(const char *line);
static void tts_xxml_token(EST_Item *t);
Expand Down
2 changes: 2 additions & 0 deletions festival/src/modules/UniSyn/us_features.cc
Expand Up @@ -43,6 +43,8 @@
#include "EST_error.h"
#include "us_features.h"

using namespace std;

void add_feature_function(EST_Relation &r, const EST_String &fname,
const EST_String &funcname)
{
Expand Down
2 changes: 2 additions & 0 deletions festival/src/modules/UniSyn/us_mapping.cc
Expand Up @@ -46,6 +46,8 @@

#include <fstream>

using namespace std;

// void make_segment_single_mapping(EST_Relation &source_lab,
// EST_Track &source_pm,
// EST_Track &target_pm, EST_IVector &map)
Expand Down
2 changes: 2 additions & 0 deletions festival/src/modules/UniSyn/us_unit.cc
Expand Up @@ -49,6 +49,8 @@

#include "Phone.h"

using namespace std;

void merge_features(EST_Item *from, EST_Item *to, int keep_id);

void dp_time_align(EST_Utterance &utt, const EST_String &source_name,
Expand Down
10 changes: 6 additions & 4 deletions festival/src/modules/UniSyn_diphone/UniSyn_diphone.cc
Expand Up @@ -42,6 +42,8 @@
#include "us_diphone.h"
#include "festival.h"

using namespace std;

extern USDiphIndex *diph_index;
LISP us_dbs = NIL;
LISP us_make_group_file(LISP lname, LISP params);
Expand Down Expand Up @@ -123,10 +125,10 @@ LISP us_diphone_init(LISP args)
}
else
{
*cdebug << ":" << get_param_str("grouped",args,"") << ":" << endl;
*cdebug << "index grouped:" << d_index->grouped << endl;
*cdebug << "true:" << true << endl;
*cdebug << "false:" << false << endl;
*cdebug << ":" << get_param_str("grouped",args,"") << ":" << endl
<< "index grouped:" << d_index->grouped << endl
<< "true:" << true << endl
<< "false:" << false << endl;

d_index->coef_dir = get_param_str("coef_dir",args,"");
d_index->sig_dir = get_param_str("sig_dir",args,"");
Expand Down
2 changes: 2 additions & 0 deletions festival/src/modules/UniSyn_diphone/us_diphone_index.cc
Expand Up @@ -43,6 +43,8 @@
#include "us_diphone.h"
#include "Phone.h"

using namespace std;

static bool US_full_coefs = false;
USDiphIndex *diph_index = 0;
extern LISP us_dbs;
Expand Down
2 changes: 2 additions & 0 deletions festival/src/modules/UniSyn_diphone/us_diphone_unit.cc
Expand Up @@ -43,6 +43,8 @@
#include "us_diphone.h"
#include "Phone.h"

using namespace std;

extern USDiphIndex *diph_index;

void dur_to_end(EST_Relation &r)
Expand Down
2 changes: 2 additions & 0 deletions festival/src/modules/base/ff.cc
Expand Up @@ -41,6 +41,8 @@
#include "festival.h"
#include "modules.h"

using namespace std;

static EST_String stressname("stress");
static EST_Val val_string0("0");
static EST_Val val_string1("1");
Expand Down

0 comments on commit 525a98b

Please sign in to comment.