moses-smt/mosesdecoder — pull request #81 by ljkieras (2014-11-04 23:58:53+00:00)
Title: mm2dTable now opens its data file read-only, using mapped_file_source, s...

...o that we don't need write permissions on the file

Anyone should be able to use/read a previously built .lex file without needing permission to write to the file. However, mm2dTable attempts to open the file for both reading and writing, unnecessarily. This causes problems if someone is trying to run an MT system built by someone else.

I changed the mm2dTable to use a mapped_file_source, which is meant for read-only access to memory-mapped files, instead of mapped_file which is for read/write access. mapped_file_source opens the file in read mode and returns const access to its contents, so I also updated the const-ness of things as necessary.