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 <ugermann@inf.ed.ac.uk>2014-03-11 17:53:54 +0400
committerUlrich Germann <ugermann@inf.ed.ac.uk>2014-03-11 17:53:54 +0400
commitb3043d9b00ade834781a1b99d14cdedcf706f5fa (patch)
tree289516c2436b451f87239f4aa02613f0d62b15f6 /moses-cmd
parenta7c85780eea25a487559ca3cd8e12fff75f29e4a (diff)
Reformatting for readability. In ReadInput: delete source only if non-NULL.
Diffstat (limited to 'moses-cmd')
-rw-r--r--moses-cmd/IOWrapper.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/moses-cmd/IOWrapper.cpp b/moses-cmd/IOWrapper.cpp
index da2589acd..1483e0472 100644
--- a/moses-cmd/IOWrapper.cpp
+++ b/moses-cmd/IOWrapper.cpp
@@ -182,7 +182,9 @@ void IOWrapper::Initialization(const std::vector<FactorType> &/*inputFactorOrder
}
-InputType*IOWrapper::GetInput(InputType* inputType)
+InputType*
+IOWrapper::
+GetInput(InputType* inputType)
{
if(inputType->Read(*m_inputStream, m_inputFactorOrder)) {
if (long x = inputType->GetTranslationId()) {
@@ -605,7 +607,7 @@ void IOWrapper::OutputLatticeMBRNBestList(const vector<LatticeMBRSolution>& solu
bool ReadInput(IOWrapper &ioWrapper, InputTypeEnum inputType, InputType*& source)
{
- delete source;
+ if (source) delete source;
switch(inputType) {
case SentenceInput:
source = ioWrapper.GetInput(new Sentence);
@@ -618,6 +620,7 @@ bool ReadInput(IOWrapper &ioWrapper, InputTypeEnum inputType, InputType*& source
break;
default:
TRACE_ERR("Unknown input type: " << inputType << "\n");
+ source = NULL;
}
return (source ? true : false);
}