From c84792b8fb813620e0e79fe5ddf9e97e34455885 Mon Sep 17 00:00:00 2001 From: Marco Biasini <marco.biasini@unibas.ch> Date: Thu, 14 Jun 2012 22:06:58 +0200 Subject: [PATCH] fix BZDNG-334 --- modules/conop/src/chemdict_tool.cc | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/modules/conop/src/chemdict_tool.cc b/modules/conop/src/chemdict_tool.cc index 6e5720675..449d22aac 100644 --- a/modules/conop/src/chemdict_tool.cc +++ b/modules/conop/src/chemdict_tool.cc @@ -72,9 +72,11 @@ int main(int argc, char const *argv[]) filtered_istream.push(istream); io::ChemdictParser cdp(filtered_istream, dialect); conop::CompoundLibPtr compound_lib; - if (!strcmp(argv[1], "create")) { - compound_lib=conop::CompoundLib::Create(argv[3]); - } else if (!strcmp(argv[1], "update")) { + bool in_mem=false; + if (!strncmp(argv[1], "create", 6)) { + compound_lib=conop::CompoundLib::Create(":memory:"); + in_mem=true; + } else if (!strncmp(argv[1], "update", 6)) { compound_lib=conop::CompoundLib::Load(argv[3]); } else { PrintUsage(); @@ -84,10 +86,11 @@ int main(int argc, char const *argv[]) return 0; } assert(compound_lib); - conop::CompoundLibPtr in_mem_lib=compound_lib->Copy(":memory:"); + conop::CompoundLibPtr in_mem_lib=in_mem ? compound_lib : + compound_lib->Copy(":memory:"); compound_lib.reset(); cdp.SetCompoundLib(in_mem_lib); cdp.Parse(); in_mem_lib->Copy(argv[3]); return 0; -} \ No newline at end of file +} -- GitLab