summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan Rogers <irogers@google.com>2014-05-28 23:04:54 +0000
committerGerrit Code Review <noreply-gerritcodereview@google.com>2014-05-28 23:04:55 +0000
commit8716b70bb7a580dd667247add717ff0b6ac2c5fe (patch)
tree9d5de85848329c642530920d2f4d4f78b486c564
parentf644e7f5def7f31790f38e00658664d2b5606f01 (diff)
parent73018b4a1d088cdda0e7bd059fddf1f308a8195a (diff)
downloadsrec-8716b70bb7a580dd667247add717ff0b6ac2c5fe.tar.gz
Merge "Fix 64-bit issues and compiler warnings."
-rw-r--r--srec/ca/syn_srec.c2
-rw-r--r--srec/clib/srec_arb.c2
-rw-r--r--srec/clib/swimodel.c4
-rw-r--r--tools/grxmlcompile/Android.mk4
-rw-r--r--tools/grxmlcompile/fst-io.h11
-rw-r--r--tools/grxmlcompile/grxmlcompile.cpp8
-rw-r--r--tools/grxmlcompile/grxmldoc.cpp2
-rw-r--r--tools/grxmlcompile/grxmldoc.h2
-rw-r--r--tools/grxmlcompile/sub_supp.cpp3
-rw-r--r--tools/grxmlcompile/vocab.h2
-rw-r--r--tools/make_cfst/Android.mk2
-rw-r--r--tools/thirdparty/OpenFst/fst/lib/Android.mk2
-rw-r--r--tools/thirdparty/OpenFst/fst/lib/arcsort.h4
-rw-r--r--tools/thirdparty/OpenFst/fst/lib/compat.h19
-rw-r--r--tools/thirdparty/OpenFst/fst/lib/compose.h11
-rw-r--r--tools/thirdparty/OpenFst/fst/lib/determinize.h16
-rw-r--r--tools/thirdparty/OpenFst/fst/lib/encode.h11
-rw-r--r--tools/thirdparty/OpenFst/fst/lib/epsnormalize.h6
-rw-r--r--tools/thirdparty/OpenFst/fst/lib/equivalent.h5
-rw-r--r--tools/thirdparty/OpenFst/fst/lib/factor-weight.h8
-rw-r--r--tools/thirdparty/OpenFst/fst/lib/map.h2
-rw-r--r--tools/thirdparty/OpenFst/fst/lib/minimize.h2
-rw-r--r--tools/thirdparty/OpenFst/fst/lib/partition.h2
-rw-r--r--tools/thirdparty/OpenFst/fst/lib/queue.h3
-rw-r--r--tools/thirdparty/OpenFst/fst/lib/register.h4
-rw-r--r--tools/thirdparty/OpenFst/fst/lib/relabel.h17
-rw-r--r--tools/thirdparty/OpenFst/fst/lib/replace.h9
-rw-r--r--tools/thirdparty/OpenFst/fst/lib/rmepsilon.h12
-rw-r--r--tools/thirdparty/OpenFst/fst/lib/rmfinalepsilon.h5
-rw-r--r--tools/thirdparty/OpenFst/fst/lib/symbol-table.cpp4
-rw-r--r--tools/thirdparty/OpenFst/fst/lib/symbol-table.h13
-rw-r--r--tools/thirdparty/OpenFst/fst/lib/synchronize.h8
-rw-r--r--tools/thirdparty/OpenFst/fst/lib/test-properties.h14
-rw-r--r--tools/thirdparty/OpenFst/fst/lib/vector-fst.h4
-rw-r--r--tools/thirdparty/OpenFst/fst/lib/weight.h2
35 files changed, 99 insertions, 126 deletions
diff --git a/srec/ca/syn_srec.c b/srec/ca/syn_srec.c
index c02021f..8999463 100644
--- a/srec/ca/syn_srec.c
+++ b/srec/ca/syn_srec.c
@@ -353,7 +353,7 @@ int CA_CheckTranscription(CA_Syntax *hSyntax, const char *transcription, int no)
void CA_ClearSyntaxForRecognizer(CA_Syntax *hSyntax, CA_Recog *hRecog)
{
int rc;
- hSyntax = NULL; /* not used */
+ (void) hSyntax; /* not used */
rc = clear_grammars_for_recognition(hRecog->recm);
return;
}
diff --git a/srec/clib/srec_arb.c b/srec/clib/srec_arb.c
index 5badcd9..3cf428c 100644
--- a/srec/clib/srec_arb.c
+++ b/srec/clib/srec_arb.c
@@ -300,7 +300,7 @@ int read_arbdata_from_stream(srec_arbdata** pallotree, char* filename, int buffe
buffer = (char*)CALLOC_CLR(fpos, sizeof(char), "srec.arbdata");
pfseek(fp, 0, SEEK_SET);
- buffer_size = fpos;
+ /* buffer_size = fpos; */
pbuf = buffer;
allotree = (srec_arbdata*)buffer;
diff --git a/srec/clib/swimodel.c b/srec/clib/swimodel.c
index 2ea194c..81d9d67 100644
--- a/srec/clib/swimodel.c
+++ b/srec/clib/swimodel.c
@@ -331,7 +331,7 @@ const SWIModel* load_swimodel(const char *filename)
{
int i;
SWIModel *swimodel = NULL;
- const void* file = NULL;
+ const char* file = NULL;
#ifdef SREC_ENGINE_VERBOSE_LOGGING
PLogMessage("load_swimodel: loaded %s", filename);
@@ -366,7 +366,7 @@ const SWIModel* load_swimodel(const char *filename)
swimodel->avg_state_durations = (const featdata*)file;
file += sizeof(featdata) * swimodel->num_hmmstates;
- if (file > swimodel->mmap_zip_data + swimodel->mmap_zip_size) {
+ if (file > (const char*)swimodel->mmap_zip_data + swimodel->mmap_zip_size) {
PLogError("load_swimodel: not enough data in %s", filename);
goto CLEANUP;
}
diff --git a/tools/grxmlcompile/Android.mk b/tools/grxmlcompile/Android.mk
index 4661b43..4c9fe44 100644
--- a/tools/grxmlcompile/Android.mk
+++ b/tools/grxmlcompile/Android.mk
@@ -42,7 +42,7 @@ LOCAL_CFLAGS += \
$(ASR_GLOBAL_DEFINES) \
$(ASR_GLOBAL_CPPFLAGS) \
-fexceptions \
-
+
LOCAL_SHARED_LIBRARIES := \
libESR_Shared \
libESR_Portable \
@@ -63,6 +63,8 @@ LOCAL_CFLAGS += -DOPENFSTSDK
LOCAL_SHARED_LIBRARIES += libfst
endif
+LOCAL_CPPFLAGS += -std=c++11
+
LOCAL_STATIC_LIBRARIES := \
libtinyxml \
diff --git a/tools/grxmlcompile/fst-io.h b/tools/grxmlcompile/fst-io.h
index 7179cfb..19864bb 100644
--- a/tools/grxmlcompile/fst-io.h
+++ b/tools/grxmlcompile/fst-io.h
@@ -224,8 +224,8 @@ namespace fst {
if (col.size() == 0 || col[0][0] == '\0') // empty line
continue;
if (col.size() > 5 ||
- col.size() > 4 && accep ||
- col.size() == 3 && !accep) {
+ (col.size() > 4 && accep) ||
+ (col.size() == 3 && !accep)) {
LOG(ERROR) << "FstReader: Bad number of columns, source = " << source_
<< ", line = " << nline_;
exit(1);
@@ -318,7 +318,8 @@ namespace fst {
return n;
// remap state IDs to make dense set
- typename hash_map<StateId, StateId>::const_iterator it = states_.find(n);
+ typename std::unordered_map<StateId, StateId>::const_iterator it =
+ states_.find(n);
if (it == states_.end()) {
states_[n] = nstates_;
return nstates_++;
@@ -339,7 +340,7 @@ namespace fst {
Weight w;
istringstream strm(s);
strm >> w;
- if (strm.fail() || !allow_zero && w == Weight::Zero()) {
+ if (strm.fail() || (!allow_zero && w == Weight::Zero())) {
LOG(ERROR) << "FstReader: Bad weight = \"" << s
<< "\", source = " << source_ << ", line = " << nline_;
exit(1);
@@ -353,7 +354,7 @@ namespace fst {
const SymbolTable *isyms_; // ilabel symbol table
const SymbolTable *osyms_; // olabel symbol table
const SymbolTable *ssyms_; // slabel symbol table
- hash_map<StateId, StateId> states_; // state ID map
+ std::unordered_map<StateId, StateId> states_; // state ID map
StateId nstates_; // number of seen states
bool keep_state_numbering_;
DISALLOW_EVIL_CONSTRUCTORS(FstReader);
diff --git a/tools/grxmlcompile/grxmlcompile.cpp b/tools/grxmlcompile/grxmlcompile.cpp
index 761bbc9..aaaf152 100644
--- a/tools/grxmlcompile/grxmlcompile.cpp
+++ b/tools/grxmlcompile/grxmlcompile.cpp
@@ -19,7 +19,7 @@
#include "ptypes.h"
-#include <ext/hash_map>
+#include <unordered_map>
#include "fst/lib/fst.h"
#include "fst/lib/fstlib.h"
@@ -234,7 +234,7 @@ int main(int argc, char* argv[])
// Create grammar network files. Use prefix of input file for output.
std::string s = filename;
std::string grxmlbase = outdir + "/" + ExtractFileName(grxmlfile);
- unsigned int p1 = grxmlbase.find_last_of(".");
+ size_t p1 = grxmlbase.find_last_of(".");
if ( p1 != string::npos )
grxmlbase.assign( grxmlbase, 0, p1);
@@ -586,7 +586,7 @@ ESR_ReturnCode make_openfst_graphs( GRXMLDoc* pDoc,
int stateSt, stateEn;
size_t len;
bool do_skip_interword_silence = false;
- hash_map<string,int> homonym_count;
+ std::unordered_map<string,int> homonym_count;
int word_penalty = 0;
rc = SR_VocabularyLoad(vocabFilename, &vocab);
@@ -730,7 +730,7 @@ ESR_ReturnCode make_openfst_graphs( GRXMLDoc* pDoc,
}
/* add epsilons if this is a homonym */
string pron_string = pron;
- hash_map<string,int>::const_iterator it = homonym_count.find( pron_string);
+ std::unordered_map<string,int>::const_iterator it = homonym_count.find( pron_string);
if(it == homonym_count.end()) {
homonym_count[ pron_string] = 0;
} else {
diff --git a/tools/grxmlcompile/grxmldoc.cpp b/tools/grxmlcompile/grxmldoc.cpp
index 50c780a..68dffcc 100644
--- a/tools/grxmlcompile/grxmldoc.cpp
+++ b/tools/grxmlcompile/grxmldoc.cpp
@@ -59,7 +59,7 @@ using namespace std;
int get_range(const std::string& s, int* minCnt, int* maxCnt)
{
std::string sval;
- unsigned int p1 =s.find("-");
+ size_t p1 =s.find("-");
if ( p1 !=string::npos ) {
sval.assign( s, 0, p1 );
if(strspn(sval.c_str(),"0123456789")<1) return 1;
diff --git a/tools/grxmlcompile/grxmldoc.h b/tools/grxmlcompile/grxmldoc.h
index 7278cea..8819a39 100644
--- a/tools/grxmlcompile/grxmldoc.h
+++ b/tools/grxmlcompile/grxmldoc.h
@@ -40,7 +40,7 @@ class GRXMLDoc
public:
typedef TiXmlNode XMLNode;
// Some convenience items for string comparison
- typedef enum KeywordValues {NodeTypeGrammar, NodeTypeRule, NodeTypeRuleReference, NodeTypeOneOf, NodeTypeItem, NodeTypeTag, NodeTypeCount, NodeTypeMeta, NodeTypeBadValue};
+ enum KeywordValues {NodeTypeGrammar, NodeTypeRule, NodeTypeRuleReference, NodeTypeOneOf, NodeTypeItem, NodeTypeTag, NodeTypeCount, NodeTypeMeta, NodeTypeBadValue};
typedef std::map<std::string, KeywordValues> KEYWDPAIR;
typedef struct {
diff --git a/tools/grxmlcompile/sub_supp.cpp b/tools/grxmlcompile/sub_supp.cpp
index 4acd394..4c68633 100644
--- a/tools/grxmlcompile/sub_supp.cpp
+++ b/tools/grxmlcompile/sub_supp.cpp
@@ -363,11 +363,12 @@ void SubGraph::ClearDuplicateArcs ()
SortLanguage();
currId= 0;
for (int ii= 1; ii < numArc; ii++) {
- if (arc[forwardList[ii]]->GetInput() != DISCARD_LABEL)
+ if (arc[forwardList[ii]]->GetInput() != DISCARD_LABEL) {
if (ARC_COMPARE (forwardList[currId], forwardList[ii]) == 0)
arc[forwardList[ii]]->AssignInput (DISCARD_LABEL);
else
currId= ii;
+ }
}
return;
}
diff --git a/tools/grxmlcompile/vocab.h b/tools/grxmlcompile/vocab.h
index e526045..a61e135 100644
--- a/tools/grxmlcompile/vocab.h
+++ b/tools/grxmlcompile/vocab.h
@@ -69,7 +69,7 @@ class AcousticModel
class Pronunciation
{
public:
- typedef enum PelPosition {LEFT, RIGHT, MIDDLE};
+ enum PelPosition {LEFT, RIGHT, MIDDLE};
Pronunciation();
// Pronunciation( Vocabulary & vocab );
int lookup( Vocabulary & vocab, std::string & phrase );
diff --git a/tools/make_cfst/Android.mk b/tools/make_cfst/Android.mk
index 9e4180f..16470cd 100644
--- a/tools/make_cfst/Android.mk
+++ b/tools/make_cfst/Android.mk
@@ -24,6 +24,8 @@ LOCAL_CFLAGS += \
$(ASR_GLOBAL_DEFINES) \
$(ASR_GLOBAL_CPPFLAGS) \
+LOCAL_CPPFLAGS += -std=c++11
+
LOCAL_SHARED_LIBRARIES := \
libESR_Shared \
libESR_Portable \
diff --git a/tools/thirdparty/OpenFst/fst/lib/Android.mk b/tools/thirdparty/OpenFst/fst/lib/Android.mk
index 0593078..6e89e3c 100644
--- a/tools/thirdparty/OpenFst/fst/lib/Android.mk
+++ b/tools/thirdparty/OpenFst/fst/lib/Android.mk
@@ -16,6 +16,8 @@ LOCAL_C_INCLUDES := \
LOCAL_CFLAGS += \
-DFST_DL \
+LOCAL_CPPFLAGS += -std=c++11
+
LOCAL_SHARED_LIBRARIES := \
LOCAL_LDLIBS += -lpthread
diff --git a/tools/thirdparty/OpenFst/fst/lib/arcsort.h b/tools/thirdparty/OpenFst/fst/lib/arcsort.h
index 4d15adb..1486e50 100644
--- a/tools/thirdparty/OpenFst/fst/lib/arcsort.h
+++ b/tools/thirdparty/OpenFst/fst/lib/arcsort.h
@@ -283,7 +283,7 @@ template<class A> class ILabelCompare {
}
uint64 Properties(uint64 props) const {
- return props & kArcSortProperties | kILabelSorted;
+ return (props & kArcSortProperties) | kILabelSorted;
}
};
@@ -296,7 +296,7 @@ template<class A> class OLabelCompare {
}
uint64 Properties(uint64 props) const {
- return props & kArcSortProperties | kOLabelSorted;
+ return (props & kArcSortProperties) | kOLabelSorted;
}
};
diff --git a/tools/thirdparty/OpenFst/fst/lib/compat.h b/tools/thirdparty/OpenFst/fst/lib/compat.h
index 4c27ee3..cd80e2a 100644
--- a/tools/thirdparty/OpenFst/fst/lib/compat.h
+++ b/tools/thirdparty/OpenFst/fst/lib/compat.h
@@ -27,9 +27,9 @@
#include <string>
#include <vector>
-#include <ext/hash_map>
#include <fcntl.h>
#include <pthread.h>
+#include <stdlib.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <unistd.h>
@@ -294,21 +294,4 @@ class MD5 {
DISALLOW_EVIL_CONSTRUCTORS(MD5);
};
-// Hashing functions
-namespace __gnu_cxx {
-
-template<> struct hash<int64> {
- size_t operator()(int64 x) const {
- return x;
- }
-};
-
-template<> struct hash<string> {
- size_t operator()(const string &s) const {
- return __stl_hash_string(s.c_str());
- }
-};
-
-} // namespace __gnu_cxx
-
#endif // FST_COMPAT_H__
diff --git a/tools/thirdparty/OpenFst/fst/lib/compose.h b/tools/thirdparty/OpenFst/fst/lib/compose.h
index 0783ea5..281e2af 100644
--- a/tools/thirdparty/OpenFst/fst/lib/compose.h
+++ b/tools/thirdparty/OpenFst/fst/lib/compose.h
@@ -21,8 +21,7 @@
#include <algorithm>
-#include <ext/hash_map>
-using __gnu_cxx::hash_map;
+#include <unordered_map>
#include "fst/lib/cache.h"
#include "fst/lib/test-properties.h"
@@ -252,10 +251,8 @@ class ComposeStateTable {
};
// Lookup table mapping state tuples to state IDs.
- typedef hash_map<StateTuple,
- StateId,
- StateTupleKey,
- StateTupleEqual> StateTable;
+ typedef std::unordered_map<StateTuple, StateId, StateTupleKey,
+ StateTupleEqual> StateTable;
// Actual table data.
StateTable table_;
@@ -369,7 +366,7 @@ class ComposeFstImpl : public ComposeFstImplBase<A> {
<< "sorted (special symbols present)";
break;
case 0:
- if (!isorted && !osorted || FLAGS_fst_verify_properties) {
+ if ((!isorted && !osorted) || FLAGS_fst_verify_properties) {
osorted = fst1.Properties(kOLabelSorted, true);
if (!osorted)
isorted = fst2.Properties(kILabelSorted, true);
diff --git a/tools/thirdparty/OpenFst/fst/lib/determinize.h b/tools/thirdparty/OpenFst/fst/lib/determinize.h
index fa0bb3c..d18451b 100644
--- a/tools/thirdparty/OpenFst/fst/lib/determinize.h
+++ b/tools/thirdparty/OpenFst/fst/lib/determinize.h
@@ -23,10 +23,8 @@
#include <algorithm>
#include <map>
-#include <ext/hash_map>
-using __gnu_cxx::hash_map;
-#include <ext/slist>
-using __gnu_cxx::slist;
+#include <unordered_map>
+#include <forward_list>
#include "fst/lib/cache.h"
#include "fst/lib/factor-weight.h"
@@ -218,7 +216,7 @@ class DeterminizeFsaImpl : public DeterminizeFstImplBase<A> {
StateId state_id; // Input state Id
Weight weight; // Residual weight
};
- typedef slist<Element> Subset;
+ typedef std::forward_list<Element> Subset;
typedef map<Label, Subset*> LabelMap;
DeterminizeFsaImpl(const Fst<A> &fst, C common_divisor,
@@ -386,8 +384,10 @@ class DeterminizeFsaImpl : public DeterminizeFstImplBase<A> {
// returns, elements_ will preserve that property. We keep it
// full of NULLs so that it is ready for the next call.
bool operator()(Subset* subset1, Subset* subset2) const {
- if (subset1->size() != subset2->size())
- return false;
+ size_t subset1_size = std::distance(subset1->begin(), subset1->end());
+ size_t subset2_size = std::distance(subset2->begin(), subset2->end());
+ if (subset1_size != subset2_size)
+ return false;
// Loads first subset elements in element vector.
for (typename Subset::iterator iter1 = subset1->begin();
@@ -454,7 +454,7 @@ class DeterminizeFsaImpl : public DeterminizeFstImplBase<A> {
vector<Subset *> subsets_;
// Hashes from Subset to its StateId in the output automaton.
- typedef hash_map<Subset *, StateId, SubsetKey, SubsetEqual>
+ typedef std::unordered_map<Subset *, StateId, SubsetKey, SubsetEqual>
SubsetHash;
// Hashes from Label to Subsets corr. to destination states of current state.
diff --git a/tools/thirdparty/OpenFst/fst/lib/encode.h b/tools/thirdparty/OpenFst/fst/lib/encode.h
index 882cdd0..b577d4a 100644
--- a/tools/thirdparty/OpenFst/fst/lib/encode.h
+++ b/tools/thirdparty/OpenFst/fst/lib/encode.h
@@ -93,10 +93,7 @@ template <class A> class EncodeTable {
int32 encode_flags_;
};
- typedef hash_map<const Tuple*,
- Label,
- TupleKey,
- TupleEqual> EncodeHash;
+ typedef std::unordered_map<const Tuple*, Label, TupleKey, TupleEqual> EncodeHash;
explicit EncodeTable(uint32 encode_flags)
: flags_(encode_flags),
@@ -174,7 +171,7 @@ template <class A> class EncodeTable {
return strm;
}
- const uint32 flags() const { return flags_; }
+ uint32 flags() const { return flags_; }
private:
uint32 flags_;
vector<Tuple*> encode_tuples_;
@@ -271,8 +268,8 @@ template <class A> class EncodeMapper {
MAP_REQUIRE_SUPERFINAL : MAP_NO_SUPERFINAL;
}
- const uint32 flags() const { return flags_; }
- const EncodeType type() const { return type_; }
+ uint32 flags() const { return flags_; }
+ EncodeType type() const { return type_; }
bool Write(ostream &strm, const string& source) {
return table_->Write(strm, source);
diff --git a/tools/thirdparty/OpenFst/fst/lib/epsnormalize.h b/tools/thirdparty/OpenFst/fst/lib/epsnormalize.h
index ac4baf2..e040977 100644
--- a/tools/thirdparty/OpenFst/fst/lib/epsnormalize.h
+++ b/tools/thirdparty/OpenFst/fst/lib/epsnormalize.h
@@ -20,10 +20,8 @@
#ifndef FST_LIB_EPSNORMALIZE_H__
#define FST_LIB_EPSNORMALIZE_H__
-#include <ext/hash_map>
-using __gnu_cxx::hash_map;
-#include <ext/slist>
-using __gnu_cxx::slist;
+#include <unordered_map>
+#include <forward_list>
#include "fst/lib/factor-weight.h"
#include "fst/lib/invert.h"
diff --git a/tools/thirdparty/OpenFst/fst/lib/equivalent.h b/tools/thirdparty/OpenFst/fst/lib/equivalent.h
index e585d9b..cb648aa 100644
--- a/tools/thirdparty/OpenFst/fst/lib/equivalent.h
+++ b/tools/thirdparty/OpenFst/fst/lib/equivalent.h
@@ -21,8 +21,7 @@
#include <algorithm>
-#include <ext/hash_map>
-using __gnu_cxx::hash_map;
+#include <unordered_map>
#include "fst/lib/encode.h"
#include "fst/lib/push.h"
@@ -162,7 +161,7 @@ bool Equivalent(const Fst<Arc> &fst1, const Fst<Arc> &fst2) {
// representing destination states of the corresponding arcs in fst1
// and fst2, respectively.
typedef
- hash_map<typename Arc::Label, pair<MappedId, MappedId> >
+ std::unordered_map<typename Arc::Label, pair<MappedId, MappedId> >
Label2StatePairMap;
Label2StatePairMap arc_pairs;
diff --git a/tools/thirdparty/OpenFst/fst/lib/factor-weight.h b/tools/thirdparty/OpenFst/fst/lib/factor-weight.h
index 073a476..f1bd950 100644
--- a/tools/thirdparty/OpenFst/fst/lib/factor-weight.h
+++ b/tools/thirdparty/OpenFst/fst/lib/factor-weight.h
@@ -22,10 +22,8 @@
#include <algorithm>
-#include <ext/hash_map>
-using __gnu_cxx::hash_map;
-#include <ext/slist>
-using __gnu_cxx::slist;
+#include <unordered_map>
+#include <forward_list>
#include "fst/lib/cache.h"
#include "fst/lib/test-properties.h"
@@ -310,7 +308,7 @@ class FactorWeightFstImpl
static const int kPrime = 7853;
};
- typedef hash_map<Element, StateId, ElementKey, ElementEqual> ElementMap;
+ typedef std::unordered_map<Element, StateId, ElementKey, ElementEqual> ElementMap;
const Fst<A> *fst_;
float delta_;
diff --git a/tools/thirdparty/OpenFst/fst/lib/map.h b/tools/thirdparty/OpenFst/fst/lib/map.h
index 5d56ebe..afcc25d 100644
--- a/tools/thirdparty/OpenFst/fst/lib/map.h
+++ b/tools/thirdparty/OpenFst/fst/lib/map.h
@@ -835,7 +835,7 @@ struct GallicToNewSymbolsMapper {
}
};
- typedef hash_map<SW, Label, StringKey> Map;
+ typedef std::unordered_map<SW, Label, StringKey> Map;
MutableFst<ToArc> *fst_;
Map map_;
diff --git a/tools/thirdparty/OpenFst/fst/lib/minimize.h b/tools/thirdparty/OpenFst/fst/lib/minimize.h
index 4a2aa38..da481ca 100644
--- a/tools/thirdparty/OpenFst/fst/lib/minimize.h
+++ b/tools/thirdparty/OpenFst/fst/lib/minimize.h
@@ -365,7 +365,7 @@ class AcyclicMinimizer {
const vector<StateId>& height() const { return height_; }
- const size_t num_states() const { return num_states_; }
+ size_t num_states() const { return num_states_; }
private:
vector<StateId> height_;
diff --git a/tools/thirdparty/OpenFst/fst/lib/partition.h b/tools/thirdparty/OpenFst/fst/lib/partition.h
index 1a3f5cd..2b6db6b 100644
--- a/tools/thirdparty/OpenFst/fst/lib/partition.h
+++ b/tools/thirdparty/OpenFst/fst/lib/partition.h
@@ -212,7 +212,7 @@ class Partition {
return class_size_;
}
- const size_t class_size(T class_id) const {
+ size_t class_size(T class_id) const {
return class_size_[class_id];
}
diff --git a/tools/thirdparty/OpenFst/fst/lib/queue.h b/tools/thirdparty/OpenFst/fst/lib/queue.h
index 478dfa7..1967165 100644
--- a/tools/thirdparty/OpenFst/fst/lib/queue.h
+++ b/tools/thirdparty/OpenFst/fst/lib/queue.h
@@ -669,12 +669,13 @@ void AutoQueue<StateId>::SccQueueType(const Fst<A> &fst,
QueueType &type = (*queue_type)[scc[state]];
if (!less || ((*less)(arc.weight, Weight::One())))
type = FIFO_QUEUE;
- else if ((type == TRIVIAL_QUEUE) || (type == LIFO_QUEUE))
+ else if ((type == TRIVIAL_QUEUE) || (type == LIFO_QUEUE)) {
if (!(Weight::Properties() & kIdempotent) ||
(arc.weight != Weight::Zero() && arc.weight != Weight::One()))
type = SHORTEST_FIRST_QUEUE;
else
type = LIFO_QUEUE;
+ }
if (type != TRIVIAL_QUEUE) *all_trivial = false;
}
if (!(Weight::Properties() & kIdempotent) ||
diff --git a/tools/thirdparty/OpenFst/fst/lib/register.h b/tools/thirdparty/OpenFst/fst/lib/register.h
index d15f28f..172799d 100644
--- a/tools/thirdparty/OpenFst/fst/lib/register.h
+++ b/tools/thirdparty/OpenFst/fst/lib/register.h
@@ -55,11 +55,11 @@ class FstRegister {
return register_;
}
- const Reader GetReader(const string &type) const {
+ Reader GetReader(const string &type) const {
return GetEntry(type).reader;
}
- const Converter GetConverter(const string &type) const {
+ Converter GetConverter(const string &type) const {
return GetEntry(type).converter;
}
diff --git a/tools/thirdparty/OpenFst/fst/lib/relabel.h b/tools/thirdparty/OpenFst/fst/lib/relabel.h
index d7f5185..2c32e77 100644
--- a/tools/thirdparty/OpenFst/fst/lib/relabel.h
+++ b/tools/thirdparty/OpenFst/fst/lib/relabel.h
@@ -19,8 +19,7 @@
#ifndef FST_LIB_RELABEL_H__
#define FST_LIB_RELABEL_H__
-#include <ext/hash_map>
-using __gnu_cxx::hash_map;
+#include <unordered_map>
#include "fst/lib/cache.h"
#include "fst/lib/test-properties.h"
@@ -49,12 +48,12 @@ void Relabel(
uint64 props = fst->Properties(kFstProperties, false);
// construct label to label hash. Could
- hash_map<Label, Label> input_map;
+ std::unordered_map<Label, Label> input_map;
for (size_t i = 0; i < ipairs.size(); ++i) {
input_map[ipairs[i].first] = ipairs[i].second;
}
- hash_map<Label, Label> output_map;
+ std::unordered_map<Label, Label> output_map;
for (size_t i = 0; i < opairs.size(); ++i) {
output_map[opairs[i].first] = opairs[i].second;
}
@@ -68,7 +67,7 @@ void Relabel(
// relabel input
// only relabel if relabel pair defined
- typename hash_map<Label, Label>::iterator it =
+ typename std::unordered_map<Label, Label>::iterator it =
input_map.find(arc.ilabel);
if (it != input_map.end()) {arc.ilabel = it->second; }
@@ -277,14 +276,14 @@ class RelabelFstImpl : public CacheImpl<A> {
// relabel input
if (relabel_input_) {
- typename hash_map<Label, Label>::iterator it =
+ typename std::unordered_map<Label, Label>::iterator it =
input_map_.find(arc.ilabel);
if (it != input_map_.end()) { arc.ilabel = it->second; }
}
// relabel output
if (relabel_output_) {
- typename hash_map<Label, Label>::iterator it =
+ typename std::unordered_map<Label, Label>::iterator it =
output_map_.find(arc.olabel);
if (it != output_map_.end()) { arc.olabel = it->second; }
}
@@ -298,8 +297,8 @@ class RelabelFstImpl : public CacheImpl<A> {
private:
const Fst<A> *fst_;
- hash_map<Label, Label> input_map_;
- hash_map<Label, Label> output_map_;
+ std::unordered_map<Label, Label> input_map_;
+ std::unordered_map<Label, Label> output_map_;
bool relabel_input_;
bool relabel_output_;
diff --git a/tools/thirdparty/OpenFst/fst/lib/replace.h b/tools/thirdparty/OpenFst/fst/lib/replace.h
index 4b8622e..2c7d1f7 100644
--- a/tools/thirdparty/OpenFst/fst/lib/replace.h
+++ b/tools/thirdparty/OpenFst/fst/lib/replace.h
@@ -20,8 +20,7 @@
#ifndef FST_LIB_REPLACE_H__
#define FST_LIB_REPLACE_H__
-#include <ext/hash_map>
-using __gnu_cxx::hash_map;
+#include <unordered_map>
#include "fst/lib/fst.h"
#include "fst/lib/cache.h"
@@ -75,7 +74,7 @@ class ReplaceFstImpl : public CacheImpl<A> {
typedef typename A::StateId StateId;
typedef CacheState<A> State;
typedef A Arc;
- typedef hash_map<Label, Label> NonTerminalHash;
+ typedef std::unordered_map<Label, Label> NonTerminalHash;
// \struct StateTuple
@@ -379,7 +378,7 @@ class ReplaceFstImpl : public CacheImpl<A> {
}
};
- typedef hash_map<StateTuple, StateId, StateTupleKey, StateTupleEqual>
+ typedef std::unordered_map<StateTuple, StateId, StateTupleKey, StateTupleEqual>
StateTupleHash;
// \class PrefixTuple
@@ -451,7 +450,7 @@ class ReplaceFstImpl : public CacheImpl<A> {
}
};
- typedef hash_map<StackPrefix, int, StackPrefixKey, StackPrefixEqual>
+ typedef std::unordered_map<StackPrefix, int, StackPrefixKey, StackPrefixEqual>
StackPrefixHash;
// private methods
diff --git a/tools/thirdparty/OpenFst/fst/lib/rmepsilon.h b/tools/thirdparty/OpenFst/fst/lib/rmepsilon.h
index 69a641b..107ae07 100644
--- a/tools/thirdparty/OpenFst/fst/lib/rmepsilon.h
+++ b/tools/thirdparty/OpenFst/fst/lib/rmepsilon.h
@@ -20,10 +20,8 @@
#ifndef FST_LIB_RMEPSILON_H__
#define FST_LIB_RMEPSILON_H__
-#include <ext/hash_map>
-using __gnu_cxx::hash_map;
-#include <ext/slist>
-using __gnu_cxx::slist;
+#include <unordered_map>
+#include <forward_list>
#include "fst/lib/arcfilter.h"
#include "fst/lib/cache.h"
@@ -109,8 +107,8 @@ class RmEpsilonState {
};
private:
- typedef hash_map<Element, pair<StateId, ssize_t>,
- ElementKey, ElementEqual> ElementMap;
+ typedef std::unordered_map<Element, pair<StateId, ssize_t>,
+ ElementKey, ElementEqual> ElementMap;
const Fst<Arc> &fst_;
// Distance from state being expanded in epsilon-closure.
@@ -125,7 +123,7 @@ class RmEpsilonState {
EpsilonArcFilter<Arc> eps_filter_;
stack<StateId> eps_queue_; // Queue used to visit the epsilon-closure
vector<bool> visited_; // '[i] = true' if state 'i' has been visited
- slist<StateId> visited_states_; // List of visited states
+ std::forward_list<StateId> visited_states_; // List of visited states
vector<Arc> arcs_; // Arcs of state being expanded
Weight final_; // Final weight of state being expanded
diff --git a/tools/thirdparty/OpenFst/fst/lib/rmfinalepsilon.h b/tools/thirdparty/OpenFst/fst/lib/rmfinalepsilon.h
index 900f0bb..acf3f35 100644
--- a/tools/thirdparty/OpenFst/fst/lib/rmfinalepsilon.h
+++ b/tools/thirdparty/OpenFst/fst/lib/rmfinalepsilon.h
@@ -19,8 +19,7 @@
#ifndef FST_LIB_RMFINALEPSILON_H__
#define FST_LIB_RMFINALEPSILON_H__
-#include <ext/hash_set>
-using __gnu_cxx::hash_set;
+#include <unordered_set>
#include "fst/lib/connect.h"
#include "fst/lib/mutable-fst.h"
@@ -42,7 +41,7 @@ void RmFinalEpsilon(MutableFst<A>* fst) {
// Find potential list of removable final states. These are final states
// that have no outgoing transitions or final states that have a
// non-coaccessible future. Complexity O(S)
- hash_set<StateId> finals;
+ std::unordered_set<StateId> finals;
for (StateIterator<Fst<A> > siter(*fst); !siter.Done(); siter.Next()) {
StateId s = siter.Value();
if (fst->Final(s) != Weight::Zero()) {
diff --git a/tools/thirdparty/OpenFst/fst/lib/symbol-table.cpp b/tools/thirdparty/OpenFst/fst/lib/symbol-table.cpp
index 74c2dad..d4715da 100644
--- a/tools/thirdparty/OpenFst/fst/lib/symbol-table.cpp
+++ b/tools/thirdparty/OpenFst/fst/lib/symbol-table.cpp
@@ -80,7 +80,7 @@ void SymbolTableImpl::RecomputeCheckSum() const {
}
int64 SymbolTableImpl::AddSymbol(const string& symbol, int64 key) {
- hash_map<string, int64>::const_iterator it =
+ std::unordered_map<string, int64>::const_iterator it =
symbol_map_.find(symbol);
if (it == symbol_map_.end()) { // only add if not in table
check_sum_finalized_ = false;
@@ -134,7 +134,7 @@ bool SymbolTableImpl::Write(ostream &strm) const {
for (size_t i = 0; i < symbols_.size(); ++i) {
const string symbol = symbols_[i];
WriteType(strm, symbol);
- hash_map<string, int64>::const_iterator it = symbol_map_.find(symbol);
+ std::unordered_map<string, int64>::const_iterator it = symbol_map_.find(symbol);
WriteType(strm, it->second);
}
strm.flush();
diff --git a/tools/thirdparty/OpenFst/fst/lib/symbol-table.h b/tools/thirdparty/OpenFst/fst/lib/symbol-table.h
index 0a67f29..50b3bd1 100644
--- a/tools/thirdparty/OpenFst/fst/lib/symbol-table.h
+++ b/tools/thirdparty/OpenFst/fst/lib/symbol-table.h
@@ -19,11 +19,10 @@
#ifndef FST_LIB_SYMBOL_TABLE_H__
#define FST_LIB_SYMBOL_TABLE_H__
-#include <ext/hash_map>
-using __gnu_cxx::hash_map;
#include <fstream>
#include <iostream>
#include <string>
+#include <unordered_map>
#include <vector>
#include "fst/lib/compat.h"
@@ -70,7 +69,7 @@ class SymbolTableImpl {
// Return the string associated with the key. If the key is out of
// range (<0, >max), return an empty string.
string Find(int64 key) const {
- hash_map<int64, string>::const_iterator it =
+ std::unordered_map<int64, string>::const_iterator it =
key_map_.find(key);
if (it == key_map_.end()) {
return "";
@@ -89,7 +88,7 @@ class SymbolTableImpl {
// Return the key associated with the symbol. If the symbol
// does not exists, return -1.
int64 Find(const char* symbol) const {
- hash_map<string, int64>::const_iterator it =
+ unordered_map<string, int64>::const_iterator it =
symbol_map_.find(symbol);
if (it == symbol_map_.end()) {
return -1;
@@ -126,8 +125,8 @@ class SymbolTableImpl {
string name_;
int64 available_key_;
vector<const char *> symbols_;
- hash_map<int64, string> key_map_;
- hash_map<string, int64> symbol_map_;
+ std::unordered_map<int64, string> key_map_;
+ std::unordered_map<string, int64> symbol_map_;
mutable int ref_count_;
mutable bool check_sum_finalized_;
@@ -376,7 +375,7 @@ inline bool CompatSymbols(const SymbolTable *syms1,
return true;
else if (!syms1 && !syms2)
return true;
- else if (syms1 && !syms2 || !syms1 && syms2)
+ else if ((syms1 && !syms2) || (!syms1 && syms2))
return false;
else
return syms1->CheckSum() == syms2->CheckSum();
diff --git a/tools/thirdparty/OpenFst/fst/lib/synchronize.h b/tools/thirdparty/OpenFst/fst/lib/synchronize.h
index cf416d6..aff1e5e 100644
--- a/tools/thirdparty/OpenFst/fst/lib/synchronize.h
+++ b/tools/thirdparty/OpenFst/fst/lib/synchronize.h
@@ -22,8 +22,8 @@
#include <algorithm>
-#include <ext/hash_map>
-using __gnu_cxx::hash_map;
+#include <unordered_map>
+#include <unordered_set>
#include "fst/lib/cache.h"
#include "fst/lib/test-properties.h"
@@ -287,8 +287,8 @@ class SynchronizeFstImpl
};
- typedef hash_map<Element, StateId, ElementKey, ElementEqual> ElementMap;
- typedef hash_set<const String*, StringKey, StringEqual> StringSet;
+ typedef std::unordered_map<Element, StateId, ElementKey, ElementEqual> ElementMap;
+ typedef std::unordered_set<const String*, StringKey, StringEqual> StringSet;
const Fst<A> *fst_;
vector<Element> elements_; // mapping Fst state to Elements
diff --git a/tools/thirdparty/OpenFst/fst/lib/test-properties.h b/tools/thirdparty/OpenFst/fst/lib/test-properties.h
index b167e0a..f4710c0 100644
--- a/tools/thirdparty/OpenFst/fst/lib/test-properties.h
+++ b/tools/thirdparty/OpenFst/fst/lib/test-properties.h
@@ -19,9 +19,7 @@
#ifndef FST_LIB_TEST_PROPERTIES_H__
#define FST_LIB_TEST_PROPERTIES_H__
-#include <ext/hash_set>
-using __gnu_cxx::hash_set;
-
+#include <unordered_set>
#include "fst/lib/connect.h"
#include "fst/lib/dfs-visit.h"
@@ -35,7 +33,7 @@ namespace fst {
// For a trinary (i.e. two-bit) property, both bits are
// returned set iff either corresponding input bit is set.
inline uint64 KnownProperties(uint64 props) {
- return kBinaryProperties | props & kTrinaryProperties |
+ return kBinaryProperties | (props & kTrinaryProperties) |
(props & kPosTrinaryProperties) << 1 |
(props & kNegTrinaryProperties) >> 1;
}
@@ -114,8 +112,8 @@ uint64 ComputeProperties(const Fst<Arc> &fst, uint64 mask, uint64 *known,
if (mask & (kODeterministic | kNonODeterministic))
comp_props |= kODeterministic;
- hash_set<Label> *ilabels = 0;
- hash_set<Label> *olabels = 0;
+ std::unordered_set<Label> *ilabels = 0;
+ std::unordered_set<Label> *olabels = 0;
StateId nfinal = 0;
for (StateIterator< Fst<Arc> > siter(fst);
@@ -126,9 +124,9 @@ uint64 ComputeProperties(const Fst<Arc> &fst, uint64 mask, uint64 *known,
Arc prev_arc(kNoLabel, kNoLabel, Weight::One(), 0);
// Create these only if we need to
if (mask & (kIDeterministic | kNonIDeterministic))
- ilabels = new hash_set<Label>;
+ ilabels = new std::unordered_set<Label>;
if (mask & (kODeterministic | kNonODeterministic))
- olabels = new hash_set<Label>;
+ olabels = new std::unordered_set<Label>;
for (ArcIterator< Fst<Arc> > aiter(fst, s);
!aiter.Done();
diff --git a/tools/thirdparty/OpenFst/fst/lib/vector-fst.h b/tools/thirdparty/OpenFst/fst/lib/vector-fst.h
index 5950e6f..fde934a 100644
--- a/tools/thirdparty/OpenFst/fst/lib/vector-fst.h
+++ b/tools/thirdparty/OpenFst/fst/lib/vector-fst.h
@@ -360,7 +360,7 @@ VectorFstImpl<A> *VectorFstImpl<A>::Read(istream &strm,
impl->BaseImpl::AddState();
VectorState<A> *state = impl->GetState(s);
state->final.Read(strm);
- int64 narcs;
+ uint64 narcs;
ReadType(strm, &narcs);
if (!strm) {
LOG(ERROR) << "VectorFst::Read: read failed: " << opts.source;
@@ -429,7 +429,7 @@ bool VectorFstImpl<A>::Write(ostream &strm,
for (StateId s = 0; s < NumStates(); ++s) {
const VectorState<A> *state = this->GetState(s);
state->final.Write(strm);
- int64 narcs = state->arcs.size();
+ size_t narcs = state->arcs.size();
WriteType(strm, narcs);
for (size_t a = 0; a < narcs; ++a) {
const A &arc = state->arcs[a];
diff --git a/tools/thirdparty/OpenFst/fst/lib/weight.h b/tools/thirdparty/OpenFst/fst/lib/weight.h
index 7050f50..06c2b9e 100644
--- a/tools/thirdparty/OpenFst/fst/lib/weight.h
+++ b/tools/thirdparty/OpenFst/fst/lib/weight.h
@@ -124,7 +124,7 @@ class NaturalLess {
NaturalLess() {
uint64 props = kIdempotent | kLeftSemiring | kRightSemiring;
- if (W::Properties() & props != props)
+ if ((W::Properties() & props) != props)
LOG(ERROR) << "NaturalLess: Weight type is not idempotent and "
<< "(left and right) distributive: " << W::Type();
}