Thank you for the clarification.

On 2015/05/01 3:38, Boris Zbarsky wrote:
> On 4/30/15 2:25 PM, ISHIKAWA, Chiaki wrote:
>> Is this to be expected?
> 
> Sure.  You're taking an _output_ stream and QIing it to
> nsI_Input_Stream.
> 

Yes, that is how the original code was written.

> It might happen that some objects implement both interfaces (and looks
> like nsMsgFileStream  does).  The object returned by
> NS_BufferOutputStream does not: it's an output stream, but not an input
> stream.

Oh, I see. So non-buffered version was OK, but now that I introduce
buffering, it is no longer possible.

> I recommend keeping track of both the input _and_ output stream in
> members, and buffering only the output, or buffering them separately, as
> you prefer.
> 

I will try to do something sensible, but I do not want to meddle with
the original code as much as possible, too.

>> I read a page about do_QueryInterface() but it does not
>> explain the principle very much.
> 
> It's simple:  You pass the object a 128-bit IID, it returns a pointer to
> something that implements that interface if that's an IID it implements,
> and null otherwise.
> 
>>    X = do_QeuryInterface(Y) is possible only when X is the direct or
>> indirect  descendant of Y?
> 
> No, that has nothing to do with it.  It's all about what the object
> claims to implement.

Now I see. I thought of do_QueryInterface() has something to do with
class hierarchy, but it has nothing to do with.
It is about the object's claim that it implements certain interface.

Thank you again.

BTW, the seeming lack of buffering was that I failed to
remove the offencing |Seek()| that negates buffering.
Once I disabled it in my local builds, everything seems AOK!



> -Boris

Chiaki Ishikawa

> 

_______________________________________________
dev-platform mailing list
dev-platform@lists.mozilla.org
https://lists.mozilla.org/listinfo/dev-platform

Reply via email to