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.
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. 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 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. -Boris _______________________________________________ dev-platform mailing list dev-platform@lists.mozilla.org https://lists.mozilla.org/listinfo/dev-platform