Commit 28985ea9 authored by Xiaohui Zhang's avatar Xiaohui Zhang
Browse files

trunk: fixing compilation warnings from recent g++ version

git-svn-id: https://svn.code.sf.net/p/kaldi/code/trunk@2716 5e6a8d80-dfce-4ca6-a32a-6e07a63d50c8
parent 066fa1dd
......@@ -172,7 +172,7 @@ static void UnitTestHTKCompare1() {
HtkHeader header = {
kaldi_features.NumRows(),
100000, // 10ms
sizeof(float)*kaldi_features.NumCols(),
static_cast<int16>(sizeof(float)*kaldi_features.NumCols()),
000007 // FBANK
};
{
......
......@@ -174,7 +174,7 @@ static void UnitTestHTKCompare1() {
HtkHeader header = {
kaldi_features.NumRows(),
100000, // 10ms
sizeof(float)*kaldi_features.NumCols(),
static_cast<int16>(sizeof(float)*kaldi_features.NumCols()),
021406 // MFCC_D_A_0
};
{
......@@ -255,7 +255,7 @@ static void UnitTestHTKCompare2() {
HtkHeader header = {
kaldi_features.NumRows(),
100000, // 10ms
sizeof(float)*kaldi_features.NumCols(),
static_cast<int16>(sizeof(float)*kaldi_features.NumCols()),
021406 // MFCC_D_A_0
};
{
......@@ -336,7 +336,7 @@ static void UnitTestHTKCompare3() {
HtkHeader header = {
kaldi_features.NumRows(),
100000, // 10ms
sizeof(float)*kaldi_features.NumCols(),
static_cast<int16>(sizeof(float)*kaldi_features.NumCols()),
021406 // MFCC_D_A_0
};
{
......@@ -415,7 +415,7 @@ static void UnitTestHTKCompare4() {
HtkHeader header = {
kaldi_features.NumRows(),
100000, // 10ms
sizeof(float)*kaldi_features.NumCols(),
static_cast<int16>(sizeof(float)*kaldi_features.NumCols()),
021406 // MFCC_D_A_0
};
{
......@@ -498,7 +498,7 @@ static void UnitTestHTKCompare5() {
HtkHeader header = {
kaldi_features.NumRows(),
100000, // 10ms
sizeof(float)*kaldi_features.NumCols(),
static_cast<int16>(sizeof(float)*kaldi_features.NumCols()),
021406 // MFCC_D_A_0
};
{
......@@ -581,7 +581,7 @@ static void UnitTestHTKCompare6() {
HtkHeader header = {
kaldi_features.NumRows(),
100000, // 10ms
sizeof(float)*kaldi_features.NumCols(),
static_cast<int16>(sizeof(float)*kaldi_features.NumCols()),
021406 // MFCC_D_A_0
};
{
......
......@@ -135,7 +135,7 @@ static void UnitTestHTKCompare1() {
HtkHeader header = {
kaldi_features.NumRows(),
100000, // 10ms
sizeof(float)*kaldi_features.NumCols(),
static_cast<int16>(sizeof(float)*kaldi_features.NumCols()),
021413 // PLP_D_A_0
};
{
......
......@@ -160,9 +160,9 @@ int main(int argc, char *argv[]) {
HtkHeader header = {
features.NumRows(),
100000, // 10ms shift
sizeof(float)*features.NumCols(),
007 | // FBANK
(fbank_opts.use_energy ? 0100 : 020000) // energy; otherwise c0
static_cast<int16>(sizeof(float)*features.NumCols()),
static_cast<uint16>(007 | // FBANK
(fbank_opts.use_energy ? 0100 : 020000)) // energy; otherwise c0
};
p.second = header;
htk_writer.Write(utt, p);
......
......@@ -160,9 +160,9 @@ int main(int argc, char *argv[]) {
HtkHeader header = {
features.NumRows(),
100000, // 10ms shift
sizeof(float)*features.NumCols(),
006 | // MFCC
(mfcc_opts.use_energy ? 0100 : 020000) // energy; otherwise c0
static_cast<int16>(sizeof(float)*(features.NumCols())),
static_cast<uint16>( 006 | // MFCC
(mfcc_opts.use_energy ? 0100 : 020000)) // energy; otherwise c0
};
p.second = header;
htk_writer.Write(utt, p);
......
......@@ -161,7 +161,7 @@ int main(int argc, char *argv[]) {
HtkHeader header = {
features.NumRows(),
100000, // 10ms shift
sizeof(float)*features.NumCols(),
static_cast<int16>(sizeof(float)*features.NumCols()),
013 | // PLP
020000 // C0 [no option currently to use energy in PLP.
};
......
......@@ -138,7 +138,7 @@ int main(int argc, char *argv[]) {
HtkHeader header = {
features.NumRows(),
frame_shift,
sizeof(float)*features.NumCols(),
static_cast<int16>(sizeof(float)*features.NumCols()),
007 | 020000
};
p.second = header;
......
......@@ -68,7 +68,7 @@ void TestRescaleToStochastic() {
}
float diff = 0.01;
Weight w = RescaleToStochastic(fst, diff);
RescaleToStochastic(fst, diff);
Weight tot = ShortestDistance(*fst),
tot2 = ComputeTotalWeight(*fst, Weight(-log(2.0)));
std::cerr << " tot is " << tot<<", tot2 = "<<tot2<<'\n';
......
......@@ -67,21 +67,20 @@ template<class Int, class T> void TestHashList() {
Elem *list = hash.GetList();
size_t count = 0;
for (; list != NULL; list = list->tail, count++) {
assert(m1[list->key] == list->val);
KALDI_ASSERT(m1[list->key] == list->val);
}
for (size_t j = 0; j < 10; j++) {
Int key = rand() % 200;
bool found_m1 = (m1.find(key) != m1.end());
T val_m1;
if (found_m1) val_m1 = m1[key];
if (found_m1) m1[key];
Elem *e = hash.Find(key);
assert( (e != NULL) == found_m1 );
KALDI_ASSERT( (e != NULL) == found_m1 );
if (found_m1)
assert(m1[key] == e->val);
KALDI_ASSERT(m1[key] == e->val);
}
assert(m1.size() == count);
KALDI_ASSERT(m1.size() == count);
}
}
......
......@@ -187,7 +187,7 @@ void TestContainsNullPointers() {
std::vector<char*> vec;
int sz = rand() % 3;
bool is_null = false;
for (int i = 0;i < sz;i++) { vec.push_back( (char*) (rand() % 2)); if (vec.back() == NULL) is_null = true; }
for (int i = 0;i < sz;i++) { vec.push_back( reinterpret_cast<char*>(static_cast<intptr_t>(rand() % 2))); if (vec.back() == NULL) is_null = true; }
assert(is_null == ContainsNullPointers(vec));
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment