--- a/xpcom/tests/gtest/TestPipes.cpp
+++ b/xpcom/tests/gtest/TestPipes.cpp
@@ -3,33 +3,33 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include <algorithm>
#include "gtest/gtest.h"
#include "Helpers.h"
#include "mozilla/ReentrantMonitor.h"
+#include "mozilla/Printf.h"
#include "nsCOMPtr.h"
#include "nsCRT.h"
#include "nsIAsyncInputStream.h"
#include "nsIAsyncOutputStream.h"
#include "nsIBufferedStreams.h"
#include "nsIClassInfo.h"
#include "nsICloneableInputStream.h"
#include "nsIInputStream.h"
#include "nsIOutputStream.h"
#include "nsIPipe.h"
#include "nsISeekableStream.h"
#include "nsIThread.h"
#include "nsIRunnable.h"
#include "nsStreamUtils.h"
#include "nsString.h"
#include "nsThreadUtils.h"
-#include "prprf.h"
#include "prinrval.h"
using namespace mozilla;
#define ITERATIONS 33333
char kTestPattern[] = "My hovercraft is full of eels.\n";
bool gTrace = false;
@@ -109,27 +109,27 @@ TestPipe(nsIInputStream* in, nsIOutputSt
nsCOMPtr<nsIThread> thread;
rv = NS_NewNamedThread("TestPipe", getter_AddRefs(thread), receiver);
if (NS_FAILED(rv)) return rv;
uint32_t total = 0;
PRIntervalTime start = PR_IntervalNow();
for (uint32_t i = 0; i < ITERATIONS; i++) {
uint32_t writeCount;
- char *buf = PR_smprintf("%d %s", i, kTestPattern);
+ char *buf = mozilla::Smprintf("%d %s", i, kTestPattern);
uint32_t len = strlen(buf);
rv = WriteAll(out, buf, len, &writeCount);
if (gTrace) {
printf("wrote: ");
for (uint32_t j = 0; j < writeCount; j++) {
putc(buf[j], stdout);
}
printf("\n");
}
- PR_smprintf_free(buf);
+ mozilla::SmprintfFree(buf);
if (NS_FAILED(rv)) return rv;
total += writeCount;
}
rv = out->Close();
if (NS_FAILED(rv)) return rv;
PRIntervalTime end = PR_IntervalNow();
@@ -227,28 +227,28 @@ TestShortWrites(nsIInputStream* in, nsIO
nsCOMPtr<nsIThread> thread;
rv = NS_NewNamedThread("TestShortWrites", getter_AddRefs(thread),
receiver);
if (NS_FAILED(rv)) return rv;
uint32_t total = 0;
for (uint32_t i = 0; i < ITERATIONS; i++) {
uint32_t writeCount;
- char* buf = PR_smprintf("%d %s", i, kTestPattern);
+ char* buf = mozilla::Smprintf("%d %s", i, kTestPattern);
uint32_t len = strlen(buf);
len = len * rand() / RAND_MAX;
len = std::min(1u, len);
rv = WriteAll(out, buf, len, &writeCount);
if (NS_FAILED(rv)) return rv;
EXPECT_EQ(writeCount, len);
total += writeCount;
if (gTrace)
printf("wrote %d bytes: %s\n", writeCount, buf);
- PR_smprintf_free(buf);
+ mozilla::SmprintfFree(buf);
//printf("calling Flush\n");
out->Flush();
//printf("calling WaitForReceipt\n");
#ifdef DEBUG
const uint32_t received =
receiver->WaitForReceipt(writeCount);
EXPECT_EQ(received, writeCount);
@@ -340,29 +340,29 @@ TEST(Pipes, ChainedPipes)
nsCOMPtr<nsIThread> receiverThread;
rv = NS_NewNamedThread("ChainedPipeRecv", getter_AddRefs(receiverThread),
receiver);
if (NS_FAILED(rv)) return;
uint32_t total = 0;
for (uint32_t i = 0; i < ITERATIONS; i++) {
uint32_t writeCount;
- char* buf = PR_smprintf("%d %s", i, kTestPattern);
+ char* buf = mozilla::Smprintf("%d %s", i, kTestPattern);
uint32_t len = strlen(buf);
len = len * rand() / RAND_MAX;
len = std::max(1u, len);
rv = WriteAll(out1, buf, len, &writeCount);
if (NS_FAILED(rv)) return;
EXPECT_EQ(writeCount, len);
total += writeCount;
if (gTrace)
printf("wrote %d bytes: %s\n", writeCount, buf);
- PR_smprintf_free(buf);
+ mozilla::SmprintfFree(buf);
}
if (gTrace) {
printf("wrote total of %d bytes\n", total);
}
rv = out1->Close();
if (NS_FAILED(rv)) return;
thread->Shutdown();