kde kioslave: fix for new wasaToRcl shared_ptr interface. Misc warnings suppression

This commit is contained in:
Jean-Francois Dockes
2020-12-28 14:20:33 +01:00
parent 3c7e3ccbc7
commit 663da54c04
7 changed files with 249 additions and 251 deletions
+24 -26
View File
@@ -81,10 +81,10 @@ zend_object_value query_create_handler(zend_class_entry *type TSRMLS_DC)
ALLOC_HASHTABLE(obj->std.properties);
zend_hash_init(obj->std.properties, 0, NULL, ZVAL_PTR_DTOR, 0);
zend_hash_copy(obj->std.properties, &type->default_properties,
(copy_ctor_func_t)zval_add_ref, (void *)&tmp, sizeof(zval *));
(copy_ctor_func_t)zval_add_ref, (void *)&tmp, sizeof(zval *));
retval.handle = zend_objects_store_put(obj, NULL,
query_free_storage, NULL TSRMLS_CC);
query_free_storage, NULL TSRMLS_CC);
retval.handlers = &query_object_handlers;
return retval;
@@ -100,40 +100,38 @@ PHP_METHOD(Query, query)
long ctxwords;
if (zend_parse_parameters(3 TSRMLS_CC, "sll", &qs_c, &qs_len, &maxchars, &ctxwords) == FAILURE) {
printf("failed to get parameters\n");
RETURN_BOOL(false);
printf("failed to get parameters\n");
RETURN_BOOL(false);
}
string qs = qs_c;
RclConfig *rclconfig = recollinit(0, 0, 0, reason, &a_config);
if (!rclconfig || !rclconfig->ok()) {
fprintf(stderr, "Recoll init failed: %s\n", reason.c_str());
RETURN_BOOL(false);
fprintf(stderr, "Recoll init failed: %s\n", reason.c_str());
RETURN_BOOL(false);
}
Rcl::Db *pRclDb = new Rcl::Db(rclconfig);
if (!pRclDb->open(Rcl::Db::DbRO)) {
cerr << "Cant open database in " << rclconfig->getDbDir() <<
" reason: " << pRclDb->getReason() << endl;
RETURN_BOOL(false);
cerr << "Cant open database in " << rclconfig->getDbDir() <<
" reason: " << pRclDb->getReason() << endl;
RETURN_BOOL(false);
}
pRclDb->setAbstractParams(-1, maxchars, ctxwords);
Rcl::SearchData *sd = 0;
// jf: the original implementation built an AND clause. It would
// be nice to offer an option, but the next best thing is to
// default to the query language
sd = wasaStringToRcl(rclconfig, "english", qs, reason);
auto sdata = wasaStringToRcl(rclconfig, "english", qs, reason);
if (!sd) {
cerr << "Query string interpretation failed: " << reason << endl;
RETURN_BOOL(false);
if (!sdata) {
cerr << "Query string interpretation failed: " << reason << endl;
RETURN_BOOL(false);
}
std::shared_ptr<Rcl::SearchData> rq(sd);
Rcl::Query *pRclQuery = new Rcl::Query(pRclDb);
pRclQuery->setQuery(rq);
pRclQuery->setQuery(sdata);
query_object *obj = (query_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
obj->pRclQuery = pRclQuery;
@@ -151,8 +149,8 @@ PHP_METHOD(Query, get_doc)
pRclQuery = obj->pRclQuery;
if(NULL == pRclQuery)
{
printf("error, NULL pointer pRclQuery\n");
RETURN_BOOL(false);
printf("error, NULL pointer pRclQuery\n");
RETURN_BOOL(false);
}
long index;
@@ -163,7 +161,7 @@ PHP_METHOD(Query, get_doc)
Rcl::Doc doc;
if (!pRclQuery->getDoc(index, doc))
{
RETURN_BOOL(false);
RETURN_BOOL(false);
}
string abs;
@@ -172,10 +170,10 @@ PHP_METHOD(Query, get_doc)
char splitter[] = {7,8,1,2,0};
char ret_string[1000];
snprintf(ret_string, 1000, "mime:%s%surl:%s%stitle:%s%sabs:%s",
doc.mimetype.c_str(),splitter,
doc.url.c_str(),splitter,
doc.meta[Rcl::Doc::keytt].c_str(), splitter,
abs.c_str());
doc.mimetype.c_str(),splitter,
doc.url.c_str(),splitter,
doc.meta[Rcl::Doc::keytt].c_str(), splitter,
abs.c_str());
RETURN_STRING(ret_string, 1);
}
@@ -211,7 +209,7 @@ PHP_MINIT_FUNCTION(recoll)
query_ce = zend_register_internal_class(&ce TSRMLS_CC);
query_ce->create_object = query_create_handler;
memcpy(&query_object_handlers,
zend_get_std_object_handlers(), sizeof(zend_object_handlers));
zend_get_std_object_handlers(), sizeof(zend_object_handlers));
query_object_handlers.clone_obj = NULL;
return SUCCESS;
}
@@ -235,7 +233,7 @@ zend_module_entry recoll_module_entry = {
#ifdef COMPILE_DL_RECOLL
extern "C" {
ZEND_GET_MODULE(recoll)
ZEND_GET_MODULE(recoll)
}
#endif