Fix bustage from TestPipe.cpp; turns out NS_NewPipe2 isn't exported from XPCOM -- who knew? r+a=bustage
git-svn-id: svn://10.0.0.236/trunk@236427 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
parent
1e089da103
commit
ddf249d5cc
@ -37,13 +37,14 @@
|
||||
|
||||
/*
|
||||
* Test harness for XPCOM objects, providing a scoped XPCOM initializer,
|
||||
* nsCOMPtr, nsRefPtr, and stdio.h/stdlib.h.
|
||||
* nsCOMPtr, nsRefPtr, do_CreateInstance, and stdio.h/stdlib.h.
|
||||
*/
|
||||
|
||||
#ifndef TestHarness_h__
|
||||
#define TestHarness_h__
|
||||
|
||||
#include "nsIServiceManager.h"
|
||||
#include "nsComponentManagerUtils.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsAutoPtr.h"
|
||||
#include <stdio.h>
|
||||
|
||||
@ -40,6 +40,33 @@
|
||||
#include "nsIPipe.h"
|
||||
#include "nsIMemory.h"
|
||||
|
||||
/** NS_NewPipe2 reimplemented, because it's not exported by XPCOM */
|
||||
nsresult NS_NewPipe2(nsIAsyncInputStream** input,
|
||||
nsIAsyncOutputStream** output,
|
||||
PRBool nonBlockingInput = PR_FALSE,
|
||||
PRBool nonBlockingOutput = PR_FALSE,
|
||||
size_t segmentSize = 0,
|
||||
PRUint32 segmentCount = 0,
|
||||
nsIMemory* segmentAlloc = nsnull)
|
||||
{
|
||||
nsCOMPtr<nsIPipe> pipe = do_CreateInstance("@mozilla.org/pipe;1");
|
||||
if (!pipe)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
nsresult rv = pipe->Init(nonBlockingInput,
|
||||
nonBlockingOutput,
|
||||
segmentSize,
|
||||
segmentCount,
|
||||
segmentAlloc);
|
||||
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
||||
pipe->GetInputStream(input);
|
||||
pipe->GetOutputStream(output);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/**
|
||||
* Allocator can allocate exactly count * size bytes, stored at mMemory;
|
||||
* immediately after the end of this is a byte-map of 0/1 values indicating
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user