From c8b16da63e360cfd3172ee67218df19d44f2f5bf Mon Sep 17 00:00:00 2001 From: Determinant Date: Thu, 25 Feb 2016 23:20:01 +0800 Subject: fix compilation error --- kaldi_io/src/cwrapper_kaldi.cpp | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/kaldi_io/src/cwrapper_kaldi.cpp b/kaldi_io/src/cwrapper_kaldi.cpp index 83331ce..e8b11a1 100644 --- a/kaldi_io/src/cwrapper_kaldi.cpp +++ b/kaldi_io/src/cwrapper_kaldi.cpp @@ -82,22 +82,26 @@ extern "C" { KaldiLookupFeatureRepo *kaldi_lookup_feature_repo_new(const char *feature_rspecifier, const char *map_rspecifier) { KaldiLookupFeatureRepo *repo = new KaldiLookupFeatureRepo(); - kaldi::SequentialBaseFloatMatrixReader feature_reader = kaldi::SequentialBaseFloatMatrixReader(string(feature_rspecifier)); - for (; !feature_reader.Done(); feature_reader.Next()) + kaldi::SequentialBaseFloatMatrixReader *feature_reader = \ + new kaldi::SequentialBaseFloatMatrixReader(string(feature_rspecifier)); + for (; !feature_reader->Done(); feature_reader->Next()) { - const std::string &key = feature_reader.Key(); - const kaldi::Matrix &feat = feature_reader.Value(); + const std::string &key = feature_reader->Key(); + const kaldi::Matrix &feat = feature_reader->Value(); if (repo->key2mat.find(key) != repo->key2mat.end()) fprintf(stderr, "[kaldi] warning: lookup feature for key %s already exists", key.c_str()); repo->key2mat[key] = feat; } - kaldi::SequentialTokenVectorReader map_reader = kaldi::SequentialTokenVectorReader(string(map_rspecifier)); - for (; !map_reader.Done(); map_reader.Next()) + delete feature_reader; + kaldi::SequentialTokenVectorReader *map_reader = \ + new kaldi::SequentialTokenVectorReader(string(map_rspecifier)); + for (; !map_reader->Done(); map_reader->Next()) { - const std::vector target = map_reader.Value(); + const std::vector target = map_reader->Value(); assert(target.size() >= 1); - repo->map[map_reader.Key()] = *target.begin(); + repo->map[map_reader->Key()] = *target.begin(); } + delete map_reader; return repo; } -- cgit v1.2.3-70-g09d2