Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/moses-smt/mosesdecoder.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUlrich Germann <Ulrich.Germann@gmail.com>2015-11-11 02:05:51 +0300
committerUlrich Germann <Ulrich.Germann@gmail.com>2015-11-11 04:08:05 +0300
commit9826599cb089611f78532e583acb467572868732 (patch)
treebf9d0844287da6d25d58cdcc817e7563a053bd64 /moses-cmd
parentd7278293877afe443a8668d5abea25bb37542c6e (diff)
Enforce const-ness of command line arguments; bug fix in mosesserver.cpp.
Diffstat (limited to 'moses-cmd')
-rw-r--r--moses-cmd/LatticeMBRGrid.cpp11
-rw-r--r--moses-cmd/Main.cpp2
-rw-r--r--moses-cmd/MainVW.cpp2
3 files changed, 8 insertions, 7 deletions
diff --git a/moses-cmd/LatticeMBRGrid.cpp b/moses-cmd/LatticeMBRGrid.cpp
index a8ecf5f00..4d283e559 100644
--- a/moses-cmd/LatticeMBRGrid.cpp
+++ b/moses-cmd/LatticeMBRGrid.cpp
@@ -76,8 +76,8 @@ public:
}
/** Parse the arguments, removing those that define the grid and returning a copy of the rest */
- void parseArgs(int& argc, char**& argv) {
- char** newargv = new char*[argc+1]; //Space to add mbr parameter
+ void parseArgs(int& argc, char const**& argv) {
+ char const** newargv = new char const*[argc+1]; //Space to add mbr parameter
int newargc = 0;
for (int i = 0; i < argc; ++i) {
bool consumed = false;
@@ -113,8 +113,9 @@ public:
}
}
if (!consumed) {
- newargv[newargc] = new char[strlen(argv[i]) + 1];
- strcpy(newargv[newargc],argv[i]);
+ // newargv[newargc] = new char[strlen(argv[i]) + 1];
+ // strcpy(newargv[newargc],argv[i]);
+ newargv[newargc] = argv[i];
++newargc;
}
}
@@ -137,7 +138,7 @@ private:
} // namespace
-int main(int argc, char* argv[])
+int main(int argc, char const* argv[])
{
cerr << "Lattice MBR Grid search" << endl;
diff --git a/moses-cmd/Main.cpp b/moses-cmd/Main.cpp
index 5ee99e2db..0318d8f4e 100644
--- a/moses-cmd/Main.cpp
+++ b/moses-cmd/Main.cpp
@@ -26,7 +26,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
#include "util/string_stream.hh"
/** main function of the command line version of the decoder **/
-int main(int argc, char** argv)
+int main(int argc, char const** argv)
{
return decoder_main(argc, argv);
}
diff --git a/moses-cmd/MainVW.cpp b/moses-cmd/MainVW.cpp
index c8047c201..dbe5b74d6 100644
--- a/moses-cmd/MainVW.cpp
+++ b/moses-cmd/MainVW.cpp
@@ -74,7 +74,7 @@ void OutputFeatureWeightsForHypergraph(std::ostream &outputSearchGraphStream)
} //namespace
/** main function of the command line version of the decoder **/
-int main(int argc, char** argv)
+int main(int argc, char const** argv)
{
try {