zorba-coders team mailing list archive
-
zorba-coders team
-
Mailing list archive
-
Message #09309
[Merge] lp:~zorba-coders/zorba/feature-ft_module into lp:zorba
Paul J. Lucas has proposed merging lp:~zorba-coders/zorba/feature-ft_module into lp:zorba.
Requested reviews:
Paul J. Lucas (paul-lucas)
Matthias Brantner (matthias-brantner)
Related bugs:
Bug #944795 in Zorba: "XQDoc doesn't handle & in URLs"
https://bugs.launchpad.net/zorba/+bug/944795
For more details, see:
https://code.launchpad.net/~zorba-coders/zorba/feature-ft_module/+merge/105023
Fixes the stop-words core dump on 64-bit Linux.
--
https://code.launchpad.net/~zorba-coders/zorba/feature-ft_module/+merge/105023
Your team Zorba Coders is subscribed to branch lp:zorba.
=== modified file 'src/runtime/full_text/ft_stop_words_set.cpp'
--- src/runtime/full_text/ft_stop_words_set.cpp 2012-05-03 12:31:51 +0000
+++ src/runtime/full_text/ft_stop_words_set.cpp 2012-05-08 02:54:58 +0000
@@ -17,14 +17,14 @@
#include <zorba/config.h>
-#include <util/ascii_util.h>
-#include <util/cxx_util.h>
-#include <util/mmap_file.h>
-#include <util/stl_util.h>
-#include <util/uri_util.h>
-#include <context/static_context.h>
-#include <context/uri_resolver.h>
-#include <zorbautils/locale.h>
+#include "context/static_context.h"
+#include "context/uri_resolver.h"
+#include "util/ascii_util.h"
+#include "util/cxx_util.h"
+#include "util/mmap_file.h"
+#include "util/stl_util.h"
+#include "util/uri_util.h"
+#include "zorbautils/locale.h"
#include "ft_stop_words_set.h"
@@ -57,7 +57,7 @@
case LANG(pt);
case LANG(sv);
default:
- return 0;
+ return nullptr;
}
}
@@ -75,7 +75,6 @@
void ft_stop_words_set::apply_word( zstring const &word, word_set_t &word_set,
ft_stop_words_unex::type mode ) {
// TODO: should "word" be converted to lower-case?
- std::cout << "applying word " << word << std::endl;
switch ( mode ) {
case ft_stop_words_unex::union_:
word_set.insert( word );
@@ -106,12 +105,9 @@
must_delete = true;
break;
case ft_stop_words_mode::with_default:
- word_set = get_default_word_set_for( lang );
- if ( !word_set ) {
- // TODO: throw exception?
- return ptr();
- }
- break;
+ if ( (word_set = get_default_word_set_for( lang )) )
+ break;
+ // no break;
case ft_stop_words_mode::without:
return ptr();
}
@@ -133,7 +129,7 @@
dynamic_cast<internal::StreamResource*>( rsrc.get() );
if ( !stream_rsrc ) {
// Technically this should be thrown during static analysis.
- throw ZORBA_EXCEPTION( err::FTST0008, ERROR_PARAMS( uri ) );
+ throw XQUERY_EXCEPTION( err::FTST0008, ERROR_PARAMS( uri ) );
}
std::istream *const stream = stream_rsrc->getStream();
=== modified file 'src/runtime/full_text/ft_token_matcher.cpp'
--- src/runtime/full_text/ft_token_matcher.cpp 2012-05-03 12:31:51 +0000
+++ src/runtime/full_text/ft_token_matcher.cpp 2012-05-08 02:54:58 +0000
@@ -47,12 +47,17 @@
return false;
}
-inline ft_stop_words_set::ptr
+//
+// This returns a raw pointer to work around a bug where ~ft_stop_words_set()
+// is being called when it shouldn't be due to ~unique_ptr() being called
+// without transferring ownership properly.
+//
+inline ft_stop_words_set const*
get_stop_words( ftmatch_options const &options, iso639_1::type lang,
static_context const& sctx ) {
if ( ftstop_word_option const *const sw = options.get_stop_word_option() )
- return ft_stop_words_set::construct( *sw, lang, sctx );
- return ft_stop_words_set::ptr();
+ return ft_stop_words_set::construct( *sw, lang, sctx ).release();
+ return nullptr;
}
///////////////////////////////////////////////////////////////////////////////
Follow ups