[prev in list] [next in list] [prev in thread] [next in thread]
List: koffice-devel
Subject: Re: Thesaurus KDataTool
From: Simon Hausmann <hausmann () kde ! org>
Date: 2001-10-31 22:08:20
[Download RAW message or body]
On Wed, Oct 31, 2001 at 10:41:01PM +0100, Daniel Naber wrote:
> On Monday 29 October 2001 16:59, David Faure wrote:
>
> > > Is it okay to commit the tool to kdeaddons/kdatatools (does not exist
> > > yet)?
> >
> > Yes, although: wouldn't people expect to see this as part of koffice,
> > rather than having to get kdeaddons (imagine people not using KDE, who
> > want to use koffice, but don't care about konq/noatun plugins....) ?
>
> I thought we moved K(o)DataTool outside KOffice so that it's available
> anywhere :-) Anway, I don't have a strong opinion on that and we can later
> move it if we want, so I commited it to koffice/tools.
>
> Now I have two problems that I need help with:
>
> 1.) Why does the output of the external command contain binary garbage at
> the end (using KProcess->start())? It works fine when called in a shell.
> Can someone have a look at the source? -- It's just 300 lines long.
void Thesaurus::receivedStdout(KProcess *proc, char *result, int len)
{
char result_tmp[len+1];
strncpy(result_tmp, result, len);
procresult_stdout += QString(result_tmp);
//printf("##### %s\n", result);
//printf("##### %s\n", result_tmp);
//kdDebug(31000) << "#### stdout: " <<
//QString(result_tmp) << endl;
}
I guess it's because result_tmp isn't going to get zero terminated.
I didn't test it, but how about this:
procresult_stdout += QString::fromLocal8Bit( QCString( result, len + 1 ) );
About the //TODO in the factory: You shouldn't need to emit any
signal. In fact the whole factory and extern "C" stuff you should be
able to replace with one single line:
K_EXPORT_COMPONENT_FACTORY( libthesaurustool, KGenericFactory<Thesaurus> );
That macro will take care of defining the extern "C" entry point and
the template will take care of implementing a proper KLibFactory
with all magic associated.
(you'll need to #include <kgenericfactory.h> for that)
Simon
_______________________________________________
koffice-devel mailing list
koffice-devel@mail.kde.org
http://mail.kde.org/mailman/listinfo/koffice-devel
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic