Bug 1197313 - remove PR_snprintf calls in netwerk/; r=froydnj

This commit is contained in:
Madhurima 2015-10-29 16:07:44 -04:00
parent bbd3965fc2
commit a687733788
6 changed files with 19 additions and 15 deletions

View File

@ -7,6 +7,9 @@
#include "mozilla/ArrayUtils.h"
#include "mozilla/Attributes.h"
#include "mozilla/IntegerPrintfMacros.h"
#include "mozilla/Snprintf.h"
#include "nsCache.h"
#include "nsDiskCache.h"
#include "nsDiskCacheDeviceSQL.h"
@ -411,7 +414,7 @@ nsOfflineCacheBinding::Create(nsIFile *cacheDir,
for (generation = 0; ; ++generation)
{
PR_snprintf(leaf, sizeof(leaf), "%014llX-%X", hash, generation);
snprintf_literal(leaf, "%014" PRIX64 "-%X", hash, generation);
rv = file->SetNativeLeafName(nsDependentCString(leaf));
if (NS_FAILED(rv))
@ -425,7 +428,7 @@ nsOfflineCacheBinding::Create(nsIFile *cacheDir,
}
else
{
PR_snprintf(leaf, sizeof(leaf), "%014llX-%X", hash, generation);
snprintf_literal(leaf, "%014" PRIX64 "-%X", hash, generation);
rv = file->AppendNative(nsDependentCString(leaf));
if (NS_FAILED(rv))
return nullptr;

View File

@ -32,9 +32,9 @@
#include "nsISupportsPriority.h"
#include "nsStandardURL.h"
#include "nsURLHelper.h"
#include "prprf.h"
#include "prnetdb.h"
#include "sslt.h"
#include "mozilla/Snprintf.h"
#ifdef DEBUG
// defined by the socket transport service while active
@ -225,11 +225,10 @@ Http2Session::LogIO(Http2Session *self, Http2Stream *stream,
LOG5(("%s", linebuf));
}
line = linebuf;
PR_snprintf(line, 128, "%08X: ", index);
snprintf(line, 128, "%08X: ", index);
line += 10;
}
PR_snprintf(line, 128 - (line - linebuf), "%02X ",
(reinterpret_cast<const uint8_t *>(data))[index]);
snprintf(line, 128 - (line - linebuf), "%02X ", (reinterpret_cast<const uint8_t *>(data))[index]);
line += 3;
}
if (index) {

View File

@ -15,12 +15,12 @@
#include "mozilla/Telemetry.h"
#include "mozilla/Preferences.h"
#include "mozilla/Snprintf.h"
#include "nsHttp.h"
#include "nsHttpHandler.h"
#include "nsHttpConnection.h"
#include "nsISchedulingContext.h"
#include "nsISupportsPriority.h"
#include "prprf.h"
#include "prnetdb.h"
#include "SpdyPush31.h"
#include "SpdySession31.h"
@ -177,11 +177,10 @@ SpdySession31::LogIO(SpdySession31 *self, SpdyStream31 *stream, const char *labe
LOG5(("%s", linebuf));
}
line = linebuf;
PR_snprintf(line, 128, "%08X: ", index);
snprintf(line, 128, "%08X: ", index);
line += 10;
}
PR_snprintf(line, 128 - (line - linebuf), "%02X ",
((unsigned char *)data)[index]);
snprintf(line, 128 - (line - linebuf), "%02X ", ((unsigned char *)data)[index]);
line += 3;
}
if (index) {

View File

@ -29,6 +29,7 @@
#include "nsCOMPtr.h"
#include "nsNetCID.h"
#include "prprf.h"
#include "mozilla/Snprintf.h"
#include "nsAsyncRedirectVerifyHelper.h"
#include "nsSocketTransportService2.h"
#include "nsAlgorithm.h"
@ -1762,9 +1763,9 @@ PrepareAcceptLanguages(const char *i_AcceptLanguages, nsACString &o_AcceptLangua
qval_str = "%s%s;q=0.%02u";
}
wrote = PR_snprintf(p2, available, qval_str, comma, token, u);
wrote = snprintf(p2, available, qval_str, comma, token, u);
} else {
wrote = PR_snprintf(p2, available, "%s%s", comma, token);
wrote = snprintf(p2, available, "%s%s", comma, token);
}
q -= dec;

View File

@ -10,6 +10,8 @@
#include "plstr.h"
#include "nsDebug.h"
#include "prprf.h"
#include "mozilla/IntegerPrintfMacros.h"
#include "mozilla/Snprintf.h"
/* ==================================================================== */
@ -485,8 +487,7 @@ int ParseFTPList(const char *line, struct list_state *state,
* than not showing the size at all.
*/
uint64_t fsz = uint64_t(strtoul(tokens[1], (char **)0, 10) * 512);
PR_snprintf(result->fe_size, sizeof(result->fe_size),
"%lld", fsz);
snprintf_literal(result->fe_size, "%" PRId64, fsz);
}
} /* if (result->fe_type != 'd') */

View File

@ -23,6 +23,7 @@
#include "nsServiceManagerUtils.h"
#include "nsXPCOM.h"
#include "prprf.h"
#include "mozilla/Snprintf.h"
// Define CIDs...
static NS_DEFINE_CID(kIOServiceCID, NS_IOSERVICE_CID);
@ -92,7 +93,7 @@ nsresult writeoutto(const char* i_pURL, char** o_Result, int32_t urlFactory = UR
output += ',';
rv = tURL->GetPort(&port);
char portbuffer[40];
PR_snprintf(portbuffer, sizeof(portbuffer), "%d", port);
snprintf_literal(portbuffer, "%d", port);
output.Append(portbuffer);
output += ',';
rv = tURL->GetDirectory(temp);