nsresult rv;
nsresult rv = NS_ERROR_FAILURE;
MyListener::OnDataAvailable(nsIRequest *req, nsISupports *ctxt,                            nsIInputStream *stream,                            PRUint32 offset, PRUint32 count){    //printf(">>> OnDataAvailable [count=%u]\n", count);    nsresult rv;    PRUint32 bytesRead=0;    int i=0;    char buf[1024];       if(ctxt == nsnull) {      bytesRead=0;      rv = stream->ReadSegments(streamParse, &offset, count, &bytesRead);    } else {      while (count) {        PRUint32 amount = PR_MIN(count, sizeof(buf));        rv = stream->Read(buf, amount, &bytesRead);          count -= bytesRead;      }    }    if (NS_FAILED(rv)) {      printf(">>> stream->Read failed with rv=%x\n", rv);      return rv;    }    return NS_OK;}