[Xapian-devel] Re: [Xapian-discuss] Fixing issue with PHP5/Windows

Daniel Ménard Daniel.Menard at bdsp.tm.fr
Thu Apr 5 10:11:40 BST 2007


Olly Betts a écrit :
> It's not safe to output the result of .data() using printf, as there may
> be no terminating nul.  That probably puts this into the realms of
> undefined behaviour, so we perhaps need to take that output with a pinch
> of salt...
>   
of course it was just to test...
> So in that loop in we should have:
>
>     std::string term = *i;
>     add_next_index_stringl(return_value, term.data(), term.length(), 1);
>
> Can you replace the code in xapian_wrap.cc with this and check if that
> fixes the problem?
>   
I get a fatal error:

    php5\xapian_wrap.cc(11629) : error C2664: 'add_next_index_stringl' :
    impossible de convertir le paramètre 2 de 'const char *' en 'char *'

which roughly means: "unable to convert the 2nd parameter from 'const 
char *' to 'char *'

Here is the complete loop, just to be sure I did not make any mistake:

        for (Xapian::TermIterator i = (&result)->first; i !=
    (&result)->second; ++i) {
            std::string term = *i;
            add_next_index_stringl(return_value, term.data(),
    term.length(), 1);
        }



Daniel



More information about the Xapian-devel mailing list