[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: _error->Error("func","Text"), apt-https varia



On Tue, 21 May 2002, Jason Gunthorpe wrote:

>
> On Tue, 21 May 2002, Tomas Pospisek wrote:
>
> > 1) I'm using:
> >
> > 	return _error->Errno("ssl","Could not create a ssl structure");
> >
> >    which is wrong [1], but IMO useful. Should I leave it that way or
> >    should I replace it by:
>
> Well, I don't think there is a function called 'ssl', but if there was
> then it would right only if errno contained valid stuff.. Otherwise
> you'll have to make a sslerror(....); type function to get the
> string error code via the means in the ssl library.

Ummm, the problem I was refering to is that the comment in error.cc is
talking about stdlib. But I think the real problem is, that I don't
understand the GlobalError API. More a bit further down.

You say I should make some sslerror function - but the problem is that
everyone expects stuff in _errno, so AFAIK I _have_ to put my error
messages in there as well (?).

You are declaring:

	// Call to generate an error from a library call.
	bool Errno(const char *Function,const char *Description,...) APT_MFORMAT2;
	bool WarningE(const char *Function,const char *Description,...) APT_MFORMAT2;

	/* A warning should be considered less severe than an error, and may be
	   ignored by the client. */
	bool Error(const char *Description,...) APT_MFORMAT1;
	bool Warning(const char *Description,...) APT_MFORMAT1;

Since the ssl functions are not using errno, I don't think they're
compatible wrt ERR* numbers. So I'd rather not use it. That's what the
second Errno method is for - is that correct?

Now the linker has no criterium to distinguish between the first and the
second definition if you pass more than one char* to Errno. Additionaly,
if I use:

	return _error->Errno((const char *)"Ssl connection failed");

I get:
	connect_ssl.cc:134: no matching function for call to `GlobalError::Errno (const char[22])'
	../build/include/apt-pkg/error.h:76: candidates are:
	bool GlobalError::Errno(const char *, const char *, ...)

Or wasn't that the intention of that interface? As I said, I'm probably
missing sth.

*t

-----------------------------------------------------------------------
     Tomas Pospisek
     sourcepole    -   Linux & Open Source Solutions
     http://sourcepole.com
     Elestastrasse 18,  7310 Bad Ragaz,  Switzerland
     Tel:+41 (81) 330 77 13,  Fax:+41 (81) 330 77 12
------------------------------------------------------------------------



-- 
To UNSUBSCRIBE, email to deity-request@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org



Reply to: