diff -durp src.orig/include/fst/extensions/pdt/info.h src/include/fst/extensions/pdt/info.h --- src.orig/include/fst/extensions/pdt/info.h 2011-02-04 18:57:20.000000000 -0700 +++ src/include/fst/extensions/pdt/info.h 2011-02-24 11:59:51.729229125 -0700 @@ -147,21 +147,21 @@ void PrintPdtInfo(const PdtInfo &pdti pdtinfo.FstType().c_str()); fprintf(fp, "%-50s%s\n", "arc type", pdtinfo.ArcType().c_str()); - fprintf(fp, "%-50s%lld\n", "# of states", + fprintf(fp, "%-50s%" PRId64 "\n", "# of states", pdtinfo.NumStates()); - fprintf(fp, "%-50s%lld\n", "# of arcs", + fprintf(fp, "%-50s%" PRId64 "\n", "# of arcs", pdtinfo.NumArcs()); - fprintf(fp, "%-50s%lld\n", "# of open parentheses", + fprintf(fp, "%-50s%" PRId64 "\n", "# of open parentheses", pdtinfo.NumOpenParens()); - fprintf(fp, "%-50s%lld\n", "# of close parentheses", + fprintf(fp, "%-50s%" PRId64 "\n", "# of close parentheses", pdtinfo.NumCloseParens()); - fprintf(fp, "%-50s%lld\n", "# of unique open parentheses", + fprintf(fp, "%-50s%" PRId64 "\n", "# of unique open parentheses", pdtinfo.NumUniqueOpenParens()); - fprintf(fp, "%-50s%lld\n", "# of unique close parentheses", + fprintf(fp, "%-50s%" PRId64 "\n", "# of unique close parentheses", pdtinfo.NumUniqueCloseParens()); - fprintf(fp, "%-50s%lld\n", "# of open parenthesis dest. states", + fprintf(fp, "%-50s%" PRId64 "\n", "# of open parenthesis dest. states", pdtinfo.NumOpenParenStates()); - fprintf(fp, "%-50s%lld\n", "# of close parenthesis source states", + fprintf(fp, "%-50s%" PRId64 "\n", "# of close parenthesis source states", pdtinfo.NumCloseParenStates()); } diff -durp src.orig/include/fst/script/draw-impl.h src/include/fst/script/draw-impl.h --- src.orig/include/fst/script/draw-impl.h 2011-02-04 18:57:22.000000000 -0700 +++ src/include/fst/script/draw-impl.h 2011-02-24 12:00:15.705531528 -0700 @@ -127,7 +127,7 @@ template class FstDrawer { PrintString(symbol); } else { char sid[kLineLen]; - snprintf(sid, kLineLen, "%lld", id); + snprintf(sid, kLineLen, "%" PRId64, id); PrintString(sid); } } diff -durp src.orig/include/fst/script/info-impl.h src/include/fst/script/info-impl.h --- src.orig/include/fst/script/info-impl.h 2011-02-04 18:57:22.000000000 -0700 +++ src/include/fst/script/info-impl.h 2011-02-24 12:02:19.041519396 -0700 @@ -230,19 +230,19 @@ void PrintFstInfo(const FstInfo &fsti if (!fstinfo.LongInfo()) return; - fprintf(fp, "%-50s%lld\n", "# of states", + fprintf(fp, "%-50s%" PRId64 "\n", "# of states", fstinfo.NumStates()); - fprintf(fp, "%-50s%lld\n", "# of arcs", + fprintf(fp, "%-50s%" PRId64 "\n", "# of arcs", fstinfo.NumArcs()); - fprintf(fp, "%-50s%lld\n", "initial state", + fprintf(fp, "%-50s%" PRId64 "\n", "initial state", fstinfo.Start()); - fprintf(fp, "%-50s%lld\n", "# of final states", + fprintf(fp, "%-50s%" PRId64 "\n", "# of final states", fstinfo.NumFinal()); - fprintf(fp, "%-50s%lld\n", "# of input/output epsilons", + fprintf(fp, "%-50s%" PRId64 "\n", "# of input/output epsilons", fstinfo.NumEpsilons()); - fprintf(fp, "%-50s%lld\n", "# of input epsilons", + fprintf(fp, "%-50s%" PRId64 "\n", "# of input epsilons", fstinfo.NumInputEpsilons()); - fprintf(fp, "%-50s%lld\n", "# of output epsilons", + fprintf(fp, "%-50s%" PRId64 "\n", "# of output epsilons", fstinfo.NumOutputEpsilons()); string arc_type = ""; @@ -254,19 +254,19 @@ void PrintFstInfo(const FstInfo &fsti arc_type = "output-epsilon "; string accessible_label = "# of " + arc_type + "accessible states"; - fprintf(fp, "%-50s%lld\n", accessible_label.c_str(), + fprintf(fp, "%-50s%" PRId64 "\n", accessible_label.c_str(), fstinfo.NumAccessible()); string coaccessible_label = "# of " + arc_type + "coaccessible states"; - fprintf(fp, "%-50s%lld\n", coaccessible_label.c_str(), + fprintf(fp, "%-50s%" PRId64 "\n", coaccessible_label.c_str(), fstinfo.NumCoAccessible()); string connected_label = "# of " + arc_type + "connected states"; - fprintf(fp, "%-50s%lld\n", connected_label.c_str(), + fprintf(fp, "%-50s%" PRId64 "\n", connected_label.c_str(), fstinfo.NumConnected()); string numcc_label = "# of " + arc_type + "connected components"; - fprintf(fp, "%-50s%lld\n", numcc_label.c_str(), + fprintf(fp, "%-50s%" PRId64 "\n", numcc_label.c_str(), fstinfo.NumCc()); string numscc_label = "# of " + arc_type + "strongly conn components"; - fprintf(fp, "%-50s%lld\n", numscc_label.c_str(), + fprintf(fp, "%-50s%" PRId64 "\n", numscc_label.c_str(), fstinfo.NumScc()); fprintf(fp, "%-50s%c\n", "input matcher", diff -durp src.orig/include/fst/types.h src/include/fst/types.h --- src.orig/include/fst/types.h 2010-09-03 13:02:47.000000000 -0600 +++ src/include/fst/types.h 2011-02-24 12:03:32.616653299 -0700 @@ -18,12 +18,13 @@ // Various type definitions (mostly for Google compatibility). #include // for ssize_t -#include // *int*_t #include // for DISALLOW_COPY_AND_ASSIGN #ifndef FST_LIB_TYPES_H__ #define FST_LIB_TYPES_H__ +#define __STDC_FORMAT_MACROS +#include // *int*_t typedef int8_t int8; typedef int16_t int16; diff -durp src.orig/lib/symbol-table.cc src/lib/symbol-table.cc --- src.orig/lib/symbol-table.cc 2011-02-04 18:57:18.000000000 -0700 +++ src/lib/symbol-table.cc 2011-02-24 12:04:32.775939305 -0700 @@ -85,7 +85,7 @@ void SymbolTableImpl::MaybeRecomputeChec labeled_check_sum_.Reset(); char line[kLineLen]; for (int64 key = 0; key < dense_key_limit_; ++key) { - snprintf(line, kLineLen, "%s\t%lld", symbols_[key], key); + snprintf(line, kLineLen, "%s\t%" PRId64, symbols_[key], key); labeled_check_sum_.Update(line); } for (map::const_iterator it = @@ -93,7 +93,7 @@ void SymbolTableImpl::MaybeRecomputeChec it != key_map_.end(); ++it) { if (it->first >= dense_key_limit_) { - snprintf(line, kLineLen, "%s\t%lld", it->second, it->first); + snprintf(line, kLineLen, "%s\t%" PRId64, it->second, it->first); labeled_check_sum_.Update(line); } } @@ -226,7 +226,7 @@ void SymbolTable::AddTable(const SymbolT bool SymbolTable::WriteText(ostream &strm) const { for (SymbolTableIterator iter(*this); !iter.Done(); iter.Next()) { char line[kLineLen]; - snprintf(line, kLineLen, "%s%c%lld\n", + snprintf(line, kLineLen, "%s%c%" PRId64 "\n", iter.Symbol().c_str(), FLAGS_fst_field_separator[0], iter.Value()); strm.write(line, strlen(line)); diff -durp src.orig/lib/util.cc src/lib/util.cc --- src.orig/lib/util.cc 2011-02-04 18:57:18.000000000 -0700 +++ src/lib/util.cc 2011-02-24 12:04:57.944405852 -0700 @@ -39,7 +39,7 @@ int64 StrToInt64(const string &s, const void Int64ToStr(int64 n, string *s) { const int kNumLen = 128; char nstr[kNumLen]; - snprintf(nstr, kNumLen, "%lld", n); + snprintf(nstr, kNumLen, "%" PRId64, n); *s += nstr; }