Cleanup work to get rid of compiler warnings.

This commit is contained in:
Ulrich Germann 2014-07-29 13:51:44 +01:00
parent 7b02017da1
commit 6a1beb770d
2 changed files with 22 additions and 22 deletions

View File

@ -71,13 +71,13 @@ bool FileHandler::setStreamBuffer(bool checkExists)
{ {
// redirect stdin or stdout if necesary // redirect stdin or stdout if necesary
if (path_ == FileHandler::kStdInDescriptor) { if (path_ == FileHandler::kStdInDescriptor) {
UTIL_THROW_IF2(flags_ & std::ios::in == 0, UTIL_THROW_IF2((flags_ & std::ios::in) == 0,
"Incorrect flags: " << flags_); "Incorrect flags: " << flags_);
std::streambuf* sb = std::cin.rdbuf(); std::streambuf* sb = std::cin.rdbuf();
buffer_ = sb; buffer_ = sb;
} else if (path_ == FileHandler::kStdOutDescriptor) { } else if (path_ == FileHandler::kStdOutDescriptor) {
UTIL_THROW_IF2(flags_ & std::ios::out == 0, UTIL_THROW_IF2((flags_ & std::ios::out) == 0,
"Incorrect flags: " << flags_); "Incorrect flags: " << flags_);
std::streambuf* sb = std::cout.rdbuf(); std::streambuf* sb = std::cout.rdbuf();
buffer_ = sb; buffer_ = sb;
} else { } else {

View File

@ -31,8 +31,8 @@ void create_xml(const string &inPath)
ofstream rule((inPath + ".extract").c_str()); ofstream rule((inPath + ".extract").c_str());
ofstream ruleInv((inPath + ".extract.inv").c_str()); ofstream ruleInv((inPath + ".extract.inv").c_str());
int setenceId; // int setenceId;
float score; // float score;
string source, target, align, path; string source, target, align, path;
string *input = NULL; string *input = NULL;
int count; int count;
@ -47,11 +47,11 @@ void create_xml(const string &inPath)
//cout << inLine << endl; //cout << inLine << endl;
switch (step) { switch (step) {
case 0: case 0:
setenceId = Scan<int>(inLine); /*setenceId = */ Scan<int>(inLine);
++step; ++step;
break; break;
case 1: case 1:
score = Scan<float>(inLine); /*score = */ Scan<float>(inLine);
++step; ++step;
break; break;
case 2: case 2:
@ -124,7 +124,7 @@ CreateXMLRetValues createXML(int ruleCount, const string &source, const string &
int start_s = 0, start_i = 0; int start_s = 0, start_i = 0;
//cerr << input << endl << source << endl << target << endl << path << endl; //cerr << input << endl << source << endl << target << endl << path << endl;
for ( int p = 0 ; p < path.length() ; p++ ) { for ( int p = 0 ; p < int(path.length()) ; p++ ) {
string action = path.substr(p, 1); string action = path.substr(p, 1);
// beginning of a mismatch // beginning of a mismatch
@ -176,7 +176,7 @@ CreateXMLRetValues createXML(int ruleCount, const string &source, const string &
} }
// end of sentence? add to end // end of sentence? add to end
if ( start_t == 1000 && i > inputToks.size() - 1 ) { if ( start_t == 1000 && i > int(inputToks.size()) - 1 ) {
start_t = targetsToks.size() - 1; start_t = targetsToks.size() - 1;
} }
@ -216,13 +216,13 @@ CreateXMLRetValues createXML(int ruleCount, const string &source, const string &
if ( action != "I" ) { if ( action != "I" ) {
//cerr << " ->"; //cerr << " ->";
if (s < alignments.m_alignS2T.size()) { if (s < int(alignments.m_alignS2T.size())) {
const std::map<int, int> &targets = alignments.m_alignS2T[s]; const std::map<int, int> &targets = alignments.m_alignS2T[s];
//cerr << "s=" << s << endl; //cerr << "s=" << s << endl;
std::map<int, int>::const_iterator iter; std::map<int, int>::const_iterator iter;
for (iter = targets.begin(); iter != targets.end(); ++iter) { for (iter = targets.begin(); iter != targets.end(); ++iter) {
int tt = iter->first; // int tt = iter->first;
//cerr << " " << tt; //cerr << " " << tt;
} }
} }
@ -245,7 +245,7 @@ CreateXMLRetValues createXML(int ruleCount, const string &source, const string &
} // for ( int p = 0 } // for ( int p = 0
//cerr << target << endl; //cerr << target << endl;
for (int i = 0; i < targetBitmap.size(); ++i) { for (size_t i = 0; i < targetBitmap.size(); ++i) {
//cerr << targetBitmap[i]; //cerr << targetBitmap[i];
} }
//cerr << endl; //cerr << endl;
@ -260,13 +260,13 @@ CreateXMLRetValues createXML(int ruleCount, const string &source, const string &
int rule_pos_s = 0; int rule_pos_s = 0;
map<int, int> ruleAlignS; map<int, int> ruleAlignS;
for (int i = 0 ; i < inputBitmap.size() ; ++i ) { for (int i = 0 ; i < int(inputBitmap.size()) ; ++i ) {
if ( inputBitmap[i] ) { if ( inputBitmap[i] ) {
ret.ruleS += inputToks[i] + " "; ret.ruleS += inputToks[i] + " ";
ruleAlignS[ alignI2S[i] ] = rule_pos_s++; ruleAlignS[ alignI2S[i] ] = rule_pos_s++;
} }
for (int j = 0; j < nonTerms.size(); ++j) { for (size_t j = 0; j < nonTerms.size(); ++j) {
map<string, int> &nt = nonTerms[j]; map<string, int> &nt = nonTerms[j];
if (i == nt["start_i"]) { if (i == nt["start_i"]) {
ret.ruleS += "[X][X] "; ret.ruleS += "[X][X] ";
@ -284,7 +284,7 @@ CreateXMLRetValues createXML(int ruleCount, const string &source, const string &
ruleAlignT[t] = rule_pos_t++; ruleAlignT[t] = rule_pos_t++;
} }
for (int i = 0; i < nonTerms.size(); ++i) { for (size_t i = 0; i < nonTerms.size(); ++i) {
map<string, int> &nt = nonTerms[i]; map<string, int> &nt = nonTerms[i];
if (t == nt["start_t"]) { if (t == nt["start_t"]) {
@ -300,7 +300,7 @@ CreateXMLRetValues createXML(int ruleCount, const string &source, const string &
for (map<int, int>::const_iterator iter = ruleAlignS.begin(); iter != ruleAlignS.end(); ++iter) { for (map<int, int>::const_iterator iter = ruleAlignS.begin(); iter != ruleAlignS.end(); ++iter) {
int s = iter->first; int s = iter->first;
if (s < alignments.m_alignS2T.size()) { if (s < int(alignments.m_alignS2T.size())) {
const std::map<int, int> &targets = alignments.m_alignS2T[s]; const std::map<int, int> &targets = alignments.m_alignS2T[s];
std::map<int, int>::const_iterator iter; std::map<int, int>::const_iterator iter;
@ -316,7 +316,7 @@ CreateXMLRetValues createXML(int ruleCount, const string &source, const string &
//cerr << "numAlign=" << numAlign << endl; //cerr << "numAlign=" << numAlign << endl;
for (int i = 0; i < nonTerms.size(); ++i) { for (size_t i = 0; i < nonTerms.size(); ++i) {
map<string, int> &nt = nonTerms[i]; map<string, int> &nt = nonTerms[i];
ret.ruleAlignment += SPrint(nt["rule_pos_s"]) + "-" + SPrint(nt["rule_pos_t"]) + " "; ret.ruleAlignment += SPrint(nt["rule_pos_s"]) + "-" + SPrint(nt["rule_pos_t"]) + " ";
++numAlign; ++numAlign;
@ -329,7 +329,7 @@ CreateXMLRetValues createXML(int ruleCount, const string &source, const string &
ret.ruleAlignment = TrimInternal(ret.ruleAlignment); ret.ruleAlignment = TrimInternal(ret.ruleAlignment);
vector<string> ruleAlignmentToks = Tokenize(ret.ruleAlignment); vector<string> ruleAlignmentToks = Tokenize(ret.ruleAlignment);
for (int i = 0; i < ruleAlignmentToks.size(); ++i) { for (size_t i = 0; i < ruleAlignmentToks.size(); ++i) {
const string &alignPoint = ruleAlignmentToks[i]; const string &alignPoint = ruleAlignmentToks[i];
vector<string> toks = Tokenize(alignPoint, "-"); vector<string> toks = Tokenize(alignPoint, "-");
assert(toks.size() == 2); assert(toks.size() == 2);
@ -338,7 +338,7 @@ CreateXMLRetValues createXML(int ruleCount, const string &source, const string &
ret.ruleAlignmentInv = TrimInternal(ret.ruleAlignmentInv); ret.ruleAlignmentInv = TrimInternal(ret.ruleAlignmentInv);
// frame // frame
ret.frame; // ret.frame;
if (frameInput.find(-1) == frameInput.end()) if (frameInput.find(-1) == frameInput.end())
ret.frame = frameInput[-1]; ret.frame = frameInput[-1];
@ -346,7 +346,7 @@ CreateXMLRetValues createXML(int ruleCount, const string &source, const string &
int start_t = -1; int start_t = -1;
targetBitmap.push_back(0); targetBitmap.push_back(0);
for (int t = 0 ; t <= targetsToks.size() ; t++ ) { for (size_t t = 0 ; t <= targetsToks.size() ; t++ ) {
// beginning of tm target inclusion // beginning of tm target inclusion
if ( !currently_included && targetBitmap[t] ) { if ( !currently_included && targetBitmap[t] ) {
start_t = t; start_t = t;
@ -360,7 +360,7 @@ CreateXMLRetValues createXML(int ruleCount, const string &source, const string &
if ( start_t >= 0 ) { if ( start_t >= 0 ) {
string target = ""; string target = "";
//cerr << "for(tt=$start_t;tt<$t+$TARGET_BITMAP[$t]);\n"; //cerr << "for(tt=$start_t;tt<$t+$TARGET_BITMAP[$t]);\n";
for (int tt = start_t ; tt < t + targetBitmap[t] ; tt++ ) { for (size_t tt = start_t ; tt < t + targetBitmap[t] ; tt++ ) {
target += targetsToks[tt] + " "; target += targetsToks[tt] + " ";
} }
// target = Trim(target); TODO // target = Trim(target); TODO