Bug 745659 - Removed the nsPrintfCString constructor which takes a length and all corresponding instances that call that particular constructor. This is accomplished by removing the length component from the instantiation. r=jlebar

This commit is contained in:
Patrick Wong 2012-04-24 14:43:00 -04:00
parent b43365343d
commit 4ccd1d2fbb
28 changed files with 83 additions and 109 deletions

View File

@ -955,13 +955,13 @@ nsCanvasRenderingContext2D::StyleColorToString(const nscolor& aColor, nsAString&
// We can't reuse the normal CSS color stringification code,
// because the spec calls for a different algorithm for canvas.
if (NS_GET_A(aColor) == 255) {
CopyUTF8toUTF16(nsPrintfCString(100, "#%02x%02x%02x",
CopyUTF8toUTF16(nsPrintfCString("#%02x%02x%02x",
NS_GET_R(aColor),
NS_GET_G(aColor),
NS_GET_B(aColor)),
aStr);
} else {
CopyUTF8toUTF16(nsPrintfCString(100, "rgba(%d, %d, %d, ",
CopyUTF8toUTF16(nsPrintfCString("rgba(%d, %d, %d, ",
NS_GET_R(aColor),
NS_GET_G(aColor),
NS_GET_B(aColor)),

View File

@ -1146,13 +1146,13 @@ nsCanvasRenderingContext2DAzure::StyleColorToString(const nscolor& aColor, nsASt
// We can't reuse the normal CSS color stringification code,
// because the spec calls for a different algorithm for canvas.
if (NS_GET_A(aColor) == 255) {
CopyUTF8toUTF16(nsPrintfCString(100, "#%02x%02x%02x",
CopyUTF8toUTF16(nsPrintfCString("#%02x%02x%02x",
NS_GET_R(aColor),
NS_GET_G(aColor),
NS_GET_B(aColor)),
aStr);
} else {
CopyUTF8toUTF16(nsPrintfCString(100, "rgba(%d, %d, %d, ",
CopyUTF8toUTF16(nsPrintfCString("rgba(%d, %d, %d, ",
NS_GET_R(aColor),
NS_GET_G(aColor),
NS_GET_B(aColor)),

View File

@ -571,13 +571,9 @@ txXPathNodeUtils::getOwnerDocument(const txXPathNode& aNode)
}
#ifndef HAVE_64BIT_OS
#define kFmtSize 13
#define kFmtSizeAttr 24
const char gPrintfFmt[] = "id0x%08p";
const char gPrintfFmtAttr[] = "id0x%08p-%010i";
#else
#define kFmtSize 21
#define kFmtSizeAttr 32
const char gPrintfFmt[] = "id0x%016p";
const char gPrintfFmtAttr[] = "id0x%016p-%010i";
#endif
@ -590,11 +586,11 @@ txXPathNodeUtils::getXSLTId(const txXPathNode& aNode,
{
uintptr_t nodeid = ((uintptr_t)aNode.mNode) - ((uintptr_t)aBase.mNode);
if (!aNode.isAttribute()) {
CopyASCIItoUTF16(nsPrintfCString(kFmtSize, gPrintfFmt, nodeid),
CopyASCIItoUTF16(nsPrintfCString(gPrintfFmt, nodeid),
aResult);
}
else {
CopyASCIItoUTF16(nsPrintfCString(kFmtSizeAttr, gPrintfFmtAttr,
CopyASCIItoUTF16(nsPrintfCString(gPrintfFmtAttr,
nodeid, aNode.mIndex), aResult);
}

View File

@ -687,7 +687,6 @@ txEXSLTFunctionCall::evaluate(txIEvalContext *aContext,
// http://exslt.org/date/functions/date-time/
// format: YYYY-MM-DDTTHH:MM:SS.sss+00:00
char formatstr[] = "%04hd-%02ld-%02ldT%02ld:%02ld:%02ld.%03ld%c%02ld:%02ld";
const size_t max = sizeof("YYYY-MM-DDTHH:MM:SS.sss+00:00");
PRExplodedTime prtime;
PR_ExplodeTime(PR_Now(), PR_LocalTimeParameters, &prtime);
@ -702,7 +701,7 @@ txEXSLTFunctionCall::evaluate(txIEvalContext *aContext,
rv = aContext->recycler()->getStringResult(&strRes);
NS_ENSURE_SUCCESS(rv, rv);
CopyASCIItoUTF16(nsPrintfCString(max, formatstr,
CopyASCIItoUTF16(nsPrintfCString(formatstr,
prtime.tm_year, prtime.tm_month + 1, prtime.tm_mday,
prtime.tm_hour, prtime.tm_min, prtime.tm_sec,
prtime.tm_usec / 10000,

View File

@ -677,7 +677,7 @@ NS_IMETHODIMP
nsWindowMemoryReporter::
NumGhostsReporter::GetDescription(nsACString& aDesc)
{
nsPrintfCString str(1024,
nsPrintfCString str(
"The number of ghost windows present (the number of nodes underneath \
explicit/window-objects/top(none)/ghost, modulo race conditions). A ghost \
window is not shown in any tab, does not share a domain with any non-detached \

View File

@ -366,8 +366,7 @@ ContentChild::RecvPMemoryReportRequestConstructor(PMemoryReportRequestChild* chi
InfallibleTArray<MemoryReport> reports;
static const int maxLength = 31; // big enough; pid is only a few chars
nsPrintfCString process(maxLength, "Content (%d)", getpid());
nsPrintfCString process("Content (%d)", getpid());
// First do the vanilla memory reporters.
nsCOMPtr<nsISimpleEnumerator> e;

View File

@ -1175,7 +1175,7 @@ nsresult nsPluginStreamListenerPeer::SetUpStreamListener(nsIRequest *request,
}
// Assemble everything and pass to listener.
nsPrintfCString status(100, "HTTP%s %lu %s", ver.get(), statusNum,
nsPrintfCString status("HTTP%s %lu %s", ver.get(), statusNum,
statusText.get());
static_cast<nsIHTTPHeaderListener*>(mPStreamListener)->StatusLine(status.get());
}

View File

@ -321,7 +321,7 @@ nsDOMStorageDBWrapper::CreateOriginScopeDBKey(nsIURI* aUri, nsACString& aKey)
PRInt32 port = NS_GetRealPort(aUri);
if (port != -1) {
aKey.AppendLiteral(":");
aKey.Append(nsPrintfCString(32, "%d", port));
aKey.Append(nsPrintfCString("%d", port));
}
return NS_OK;

View File

@ -75,7 +75,7 @@ AppendToString(nsACString& s, const void* p,
const char* pfx="", const char* sfx="")
{
s += pfx;
s += nsPrintfCString(64, "%p", p);
s += nsPrintfCString("%p", p);
return s += sfx;
}
@ -113,7 +113,7 @@ AppendToString(nsACString& s, const gfxRGBA& c,
{
s += pfx;
s += nsPrintfCString(
128, "rgba(%d, %d, %d, %g)",
"rgba(%d, %d, %d, %g)",
PRUint8(c.r*255.0), PRUint8(c.g*255.0), PRUint8(c.b*255.0), c.a);
return s += sfx;
}
@ -129,11 +129,11 @@ AppendToString(nsACString& s, const gfx3DMatrix& m,
gfxMatrix matrix;
if (m.Is2D(&matrix)) {
s += nsPrintfCString(
96, "[ %g %g; %g %g; %g %g; ]",
"[ %g %g; %g %g; %g %g; ]",
matrix.xx, matrix.yx, matrix.xy, matrix.yy, matrix.x0, matrix.y0);
} else {
s += nsPrintfCString(
256, "[ %g %g %g %g; %g %g %g %g; %g %g %g %g; %g %g %g %g; ]",
"[ %g %g %g %g; %g %g %g %g; %g %g %g %g; %g %g %g %g; ]",
m._11, m._12, m._13, m._14,
m._21, m._22, m._23, m._24,
m._31, m._32, m._33, m._34,
@ -148,7 +148,7 @@ AppendToString(nsACString& s, const nsIntPoint& p,
const char* pfx="", const char* sfx="")
{
s += pfx;
s += nsPrintfCString(128, "(x=%d, y=%d)", p.x, p.y);
s += nsPrintfCString("(x=%d, y=%d)", p.x, p.y);
return s += sfx;
}
@ -158,7 +158,7 @@ AppendToString(nsACString& s, const nsIntRect& r,
{
s += pfx;
s += nsPrintfCString(
256, "(x=%d, y=%d, w=%d, h=%d)",
"(x=%d, y=%d, w=%d, h=%d)",
r.x, r.y, r.width, r.height);
return s += sfx;
}
@ -183,7 +183,7 @@ AppendToString(nsACString& s, const nsIntSize& sz,
const char* pfx="", const char* sfx="")
{
s += pfx;
s += nsPrintfCString(128, "(w=%d, h=%d)", sz.width, sz.height);
s += nsPrintfCString("(w=%d, h=%d)", sz.width, sz.height);
return s += sfx;
}
@ -657,7 +657,7 @@ nsACString&
Layer::PrintInfo(nsACString& aTo, const char* aPrefix)
{
aTo += aPrefix;
aTo += nsPrintfCString(64, "%s%s (0x%p)", mManager->Name(), Name(), this);
aTo += nsPrintfCString("%s%s (0x%p)", mManager->Name(), Name(), this);
::PrintInfo(aTo, AsShadowLayer());
@ -821,7 +821,7 @@ nsACString&
LayerManager::PrintInfo(nsACString& aTo, const char* aPrefix)
{
aTo += aPrefix;
return aTo += nsPrintfCString(64, "%sLayerManager (0x%p)", Name(), this);
return aTo += nsPrintfCString("%sLayerManager (0x%p)", Name(), this);
}
/*static*/ void

View File

@ -697,8 +697,7 @@ nsStringBundleService::insertIntoCache(nsIStringBundle* aBundle,
NS_ASSERTION(mBundleMap.Exists(cacheEntry->mHashKey),
"Element will not be removed!");
#ifdef DEBUG_alecf
NS_WARNING(nsPrintfCString(300,
"Booting %s to make room for %s\n",
NS_WARNING(nsPrintfCString("Booting %s to make room for %s\n",
cacheEntry->mHashKey->GetString(),
aHashKey->GetString()).get());
#endif

View File

@ -1235,8 +1235,7 @@ GetCompartmentName(JSCompartment *c, bool getAddress, nsCString &name)
if (getAddress) {
// ample; 64-bit address max is 18 chars
const int maxLength = 31;
nsPrintfCString address(maxLength, ", 0x%llx", PRUint64(c));
nsPrintfCString address(", 0x%llx", PRUint64(c));
name.Append(address);
}
}

View File

@ -267,7 +267,7 @@ ARENA_POISON_init()
bool enabled;
if (cr && NS_SUCCEEDED(cr->GetEnabled(&enabled)) && enabled) {
cr->AnnotateCrashReport(NS_LITERAL_CSTRING("FramePoisonBase"),
nsPrintfCString(17, "%.16llx", PRUint64(rgnbase)));
nsPrintfCString("%.16llx", PRUint64(rgnbase)));
cr->AnnotateCrashReport(NS_LITERAL_CSTRING("FramePoisonSize"),
nsPrintfCString("%lu", PRUint32(rgnsize)));
}

View File

@ -604,7 +604,7 @@ Declaration::GetValue(nsCSSProperty aProperty, nsAString& aValue) const
*data->ValueFor(eCSSProperty_text_decoration_style);
NS_ABORT_IF_FALSE(decorationStyle.GetUnit() == eCSSUnit_Enumerated,
nsPrintfCString(32, "bad text-decoration-style unit %d",
nsPrintfCString("bad text-decoration-style unit %d",
decorationStyle.GetUnit()).get());
if (decorationColor.GetUnit() != eCSSUnit_Enumerated ||
@ -620,10 +620,10 @@ Declaration::GetValue(nsCSSProperty aProperty, nsAString& aValue) const
*data->ValueFor(eCSSProperty_text_decoration_line);
NS_ABORT_IF_FALSE(textBlink.GetUnit() == eCSSUnit_Enumerated,
nsPrintfCString(32, "bad text-blink unit %d",
nsPrintfCString("bad text-blink unit %d",
textBlink.GetUnit()).get());
NS_ABORT_IF_FALSE(decorationLine.GetUnit() == eCSSUnit_Enumerated,
nsPrintfCString(32, "bad text-decoration-line unit %d",
nsPrintfCString("bad text-decoration-line unit %d",
decorationLine.GetUnit()).get());
bool blinkNone = (textBlink.GetIntValue() == NS_STYLE_TEXT_BLINK_NONE);
@ -657,15 +657,15 @@ Declaration::GetValue(nsCSSProperty aProperty, nsAString& aValue) const
NS_ABORT_IF_FALSE(transDuration.GetUnit() == eCSSUnit_List ||
transDuration.GetUnit() == eCSSUnit_ListDep,
nsPrintfCString(32, "bad t-duration unit %d",
nsPrintfCString("bad t-duration unit %d",
transDuration.GetUnit()).get());
NS_ABORT_IF_FALSE(transTiming.GetUnit() == eCSSUnit_List ||
transTiming.GetUnit() == eCSSUnit_ListDep,
nsPrintfCString(32, "bad t-timing unit %d",
nsPrintfCString("bad t-timing unit %d",
transTiming.GetUnit()).get());
NS_ABORT_IF_FALSE(transDelay.GetUnit() == eCSSUnit_List ||
transDelay.GetUnit() == eCSSUnit_ListDep,
nsPrintfCString(32, "bad t-delay unit %d",
nsPrintfCString("bad t-delay unit %d",
transDelay.GetUnit()).get());
const nsCSSValueList* dur = transDuration.GetListValue();
@ -692,7 +692,7 @@ Declaration::GetValue(nsCSSProperty aProperty, nsAString& aValue) const
} else {
NS_ABORT_IF_FALSE(transProp.GetUnit() == eCSSUnit_List ||
transProp.GetUnit() == eCSSUnit_ListDep,
nsPrintfCString(32, "bad t-prop unit %d",
nsPrintfCString("bad t-prop unit %d",
transProp.GetUnit()).get());
const nsCSSValueList* pro = transProp.GetListValue();
for (;;) {
@ -736,7 +736,7 @@ Declaration::GetValue(nsCSSProperty aProperty, nsAString& aValue) const
values[i] = data->ValueFor(subprops[i]);
NS_ABORT_IF_FALSE(values[i]->GetUnit() == eCSSUnit_List ||
values[i]->GetUnit() == eCSSUnit_ListDep,
nsPrintfCString(32, "bad a-duration unit %d",
nsPrintfCString("bad a-duration unit %d",
values[i]->GetUnit()).get());
lists[i] = values[i]->GetListValue();
}

View File

@ -741,8 +741,7 @@ nsUserFontSet::LogMessage(gfxProxyFontEntry *aProxy,
}
nsPrintfCString
msg(1024,
"downloadable font: %s "
msg("downloadable font: %s "
"(font-family: \"%s\" style:%s weight:%s stretch:%s src index:%d)",
aMessage,
familyName.get(),

View File

@ -3621,7 +3621,7 @@ nsRuleNode::ComputeUserInterfaceData(void* aStartStruct,
// that's invalid.
NS_ABORT_IF_FALSE(cursorUnit == eCSSUnit_List ||
cursorUnit == eCSSUnit_ListDep,
nsPrintfCString(64, "unrecognized cursor unit %d",
nsPrintfCString("unrecognized cursor unit %d",
cursorUnit).get());
const nsCSSValueList* list = cursorValue->GetListValue();
const nsCSSValueList* list2 = list;
@ -4020,8 +4020,7 @@ nsRuleNode::ComputeDisplayData(void* aStartStruct,
transition->SetProperty(eCSSPropertyExtra_no_properties);
} else if (property.list) {
NS_ABORT_IF_FALSE(property.list->mValue.GetUnit() == eCSSUnit_Ident,
nsPrintfCString(64,
"Invalid transition property unit %d",
nsPrintfCString("Invalid transition property unit %d",
property.list->mValue.GetUnit()).get());
nsDependentString
@ -4188,7 +4187,7 @@ nsRuleNode::ComputeDisplayData(void* aStartStruct,
}
default:
NS_ABORT_IF_FALSE(false,
nsPrintfCString(64, "Invalid animation-name unit %d",
nsPrintfCString("Invalid animation-name unit %d",
animName.list->mValue.GetUnit()).get());
}
}
@ -4223,8 +4222,7 @@ nsRuleNode::ComputeDisplayData(void* aStartStruct,
animation->SetDirection(NS_STYLE_ANIMATION_DIRECTION_NORMAL);
} else if (animDirection.list) {
NS_ABORT_IF_FALSE(animDirection.list->mValue.GetUnit() == eCSSUnit_Enumerated,
nsPrintfCString(64,
"Invalid animation-direction unit %d",
nsPrintfCString("Invalid animation-direction unit %d",
animDirection.list->mValue.GetUnit()).get());
animation->SetDirection(animDirection.list->mValue.GetIntValue());
@ -4242,8 +4240,7 @@ nsRuleNode::ComputeDisplayData(void* aStartStruct,
animation->SetFillMode(NS_STYLE_ANIMATION_FILL_MODE_NONE);
} else if (animFillMode.list) {
NS_ABORT_IF_FALSE(animFillMode.list->mValue.GetUnit() == eCSSUnit_Enumerated,
nsPrintfCString(64,
"Invalid animation-fill-mode unit %d",
nsPrintfCString("Invalid animation-fill-mode unit %d",
animFillMode.list->mValue.GetUnit()).get());
animation->SetFillMode(animFillMode.list->mValue.GetIntValue());
@ -4261,8 +4258,7 @@ nsRuleNode::ComputeDisplayData(void* aStartStruct,
animation->SetPlayState(NS_STYLE_ANIMATION_PLAY_STATE_RUNNING);
} else if (animPlayState.list) {
NS_ABORT_IF_FALSE(animPlayState.list->mValue.GetUnit() == eCSSUnit_Enumerated,
nsPrintfCString(64,
"Invalid animation-play-state unit %d",
nsPrintfCString("Invalid animation-play-state unit %d",
animPlayState.list->mValue.GetUnit()).get());
animation->SetPlayState(animPlayState.list->mValue.GetIntValue());
@ -5102,7 +5098,7 @@ SetBackgroundList(nsStyleContext* aStyleContext,
default:
NS_ABORT_IF_FALSE(false,
nsPrintfCString(32, "unexpected unit %d",
nsPrintfCString("unexpected unit %d",
aValue.GetUnit()).get());
}
@ -5177,7 +5173,7 @@ SetBackgroundPairList(nsStyleContext* aStyleContext,
default:
NS_ABORT_IF_FALSE(false,
nsPrintfCString(32, "unexpected unit %d",
nsPrintfCString("unexpected unit %d",
aValue.GetUnit()).get());
}
@ -5473,7 +5469,7 @@ nsRuleNode::ComputeBorderData(void* aStartStruct,
default:
NS_ABORT_IF_FALSE(false,
nsPrintfCString(64, "unrecognized shadow unit %d",
nsPrintfCString("unrecognized shadow unit %d",
boxShadowValue->GetUnit()).get());
}
@ -6324,7 +6320,7 @@ nsRuleNode::ComputeContentData(void* aStartStruct,
default:
NS_ABORT_IF_FALSE(false,
nsPrintfCString(64, "unrecognized content unit %d",
nsPrintfCString("unrecognized content unit %d",
contentValue->GetUnit()).get());
}

View File

@ -722,7 +722,7 @@ nsresult pref_HashPref(const char *key, PrefValue value, PrefType type, PRUint32
else if ((((PrefType)(pref->flags)) & PREF_VALUETYPE_MASK) !=
(type & PREF_VALUETYPE_MASK))
{
NS_WARNING(nsPrintfCString(192, "Trying to set pref %s to with the wrong type!", key).get());
NS_WARNING(nsPrintfCString("Trying to set pref %s to with the wrong type!", key).get());
return NS_ERROR_UNEXPECTED;
}

View File

@ -2130,7 +2130,7 @@ nsOfflineCacheDevice::CreateApplicationCache(const nsACString &group,
// Include the timestamp to guarantee uniqueness across runs, and
// the gNextTemporaryClientID for uniqueness within a second.
clientID.Append(nsPrintfCString(64, "|%016lld|%d",
clientID.Append(nsPrintfCString("|%016lld|%d",
now / PR_USEC_PER_SEC,
gNextTemporaryClientID++));

View File

@ -74,7 +74,7 @@
#define DROP_DEAD() \
do { \
nsPrintfCString msg(1000,"NECKO ERROR: '%s' UNIMPLEMENTED", \
nsPrintfCString msg("NECKO ERROR: '%s' UNIMPLEMENTED", \
__FUNCTION__); \
NECKO_MAYBE_ABORT(msg); \
return NS_ERROR_NOT_IMPLEMENTED; \
@ -82,7 +82,7 @@
#define ENSURE_CALLED_BEFORE_ASYNC_OPEN() \
if (mIsPending || mWasOpened) { \
nsPrintfCString msg(1000, "'%s' called after AsyncOpen: %s +%d", \
nsPrintfCString msg("'%s' called after AsyncOpen: %s +%d", \
__FUNCTION__, __FILE__, __LINE__); \
NECKO_MAYBE_ABORT(msg); \
} \

View File

@ -75,7 +75,7 @@ nsHttpResponseHead::SetContentLength(PRInt64 len)
if (!LL_GE_ZERO(len)) // < 0
mHeaders.ClearHeader(nsHttp::Content_Length);
else
mHeaders.SetHeader(nsHttp::Content_Length, nsPrintfCString(20, "%lld", len));
mHeaders.SetHeader(nsHttp::Content_Length, nsPrintfCString("%lld", len));
}
void

View File

@ -119,8 +119,7 @@ TriplesVisitor::Visit(nsIRDFNode *aSubject, nsIRDFResource *aPredicate,
PRInt32 value;
intLit->GetValue(&value);
nsPrintfCString
object(128,
"\"%i\"^^<http://www.w3.org/2001/XMLSchema#integer> ",
object("\"%i\"^^<http://www.w3.org/2001/XMLSchema#integer> ",
value);
PRUint32 writeCount = object.Length();
rv = mOut->Write(object.get(), writeCount, &wroteCount);

View File

@ -80,7 +80,7 @@ FetchPageInfo(nsRefPtr<Database>& aDB,
// This query finds the bookmarked uri we want to set the icon for,
// walking up to two redirect levels.
nsCString query = nsPrintfCString(768,
nsCString query = nsPrintfCString(
"SELECT h.id, h.favicon_id, h.guid, ( "
"SELECT h.url FROM moz_bookmarks b WHERE b.fk = h.id "
"UNION ALL " // Union not directly bookmarked pages.

View File

@ -1595,7 +1595,7 @@ nsNavBookmarks::SetItemDateAdded(PRInt64 aItemId, PRTime aDateAdded)
OnItemChanged(bookmark.id,
NS_LITERAL_CSTRING("dateAdded"),
false,
nsPrintfCString(16, "%lld", bookmark.dateAdded),
nsPrintfCString("%lld", bookmark.dateAdded),
bookmark.dateAdded,
bookmark.type,
bookmark.parentId,
@ -1639,7 +1639,7 @@ nsNavBookmarks::SetItemLastModified(PRInt64 aItemId, PRTime aLastModified)
OnItemChanged(bookmark.id,
NS_LITERAL_CSTRING("lastModified"),
false,
nsPrintfCString(16, "%lld", bookmark.lastModified),
nsPrintfCString("%lld", bookmark.lastModified),
bookmark.lastModified,
bookmark.type,
bookmark.parentId,
@ -2095,7 +2095,7 @@ nsNavBookmarks::GetBookmarkedURIFor(nsIURI* aURI, nsIURI** _retval)
// As a bonus the query also checks first if place_id is already a bookmark,
// so you don't have to check that apart.
nsCString query = nsPrintfCString(512,
nsCString query = nsPrintfCString(
"SELECT url FROM moz_places WHERE id = ( "
"SELECT :page_id FROM moz_bookmarks WHERE fk = :page_id "
"UNION ALL "

View File

@ -1969,7 +1969,7 @@ PlacesSQLQueryBuilder::SelectAsDay()
// beginTime will become the node's time property, we don't use endTime
// because it could overlap, and we use time to sort containers and find
// insert position in a result.
mQueryString = nsPrintfCString(1024,
mQueryString = nsPrintfCString(
"SELECT null, "
"'place:type=%ld&sort=%ld&beginTime='||beginTime||'&endTime='||endTime, "
"dayTitle, null, null, beginTime, null, null, null, null, null, null "
@ -2117,7 +2117,7 @@ PlacesSQLQueryBuilder::SelectAsDay()
nsPrintfCString dateParam("dayTitle%d", i);
mAddParams.Put(dateParam, dateName);
nsPrintfCString dayRange(1024,
nsPrintfCString dayRange(
"SELECT :%s AS dayTitle, "
"%s AS beginTime, "
"%s AS endTime "
@ -2173,7 +2173,7 @@ PlacesSQLQueryBuilder::SelectAsSite()
"'&endTime='||:end_time");
}
mQueryString = nsPrintfCString(2048,
mQueryString = nsPrintfCString(
"SELECT null, 'place:type=%ld&sort=%ld&domain=&domainIsHost=true'%s, "
":localhost, :localhost, null, null, null, null, null, null, null "
"WHERE EXISTS ( "
@ -2225,7 +2225,7 @@ PlacesSQLQueryBuilder::SelectAsTag()
// other history queries.
mHasDateColumns = true;
mQueryString = nsPrintfCString(2048,
mQueryString = nsPrintfCString(
"SELECT null, 'place:folder=' || id || '&queryType=%d&type=%ld', "
"title, null, null, null, null, null, null, dateAdded, "
"lastModified, null, null "
@ -2390,23 +2390,23 @@ PlacesSQLQueryBuilder::OrderBy()
void PlacesSQLQueryBuilder::OrderByColumnIndexAsc(PRInt32 aIndex)
{
mQueryString += nsPrintfCString(128, " ORDER BY %d ASC", aIndex+1);
mQueryString += nsPrintfCString(" ORDER BY %d ASC", aIndex+1);
}
void PlacesSQLQueryBuilder::OrderByColumnIndexDesc(PRInt32 aIndex)
{
mQueryString += nsPrintfCString(128, " ORDER BY %d DESC", aIndex+1);
mQueryString += nsPrintfCString(" ORDER BY %d DESC", aIndex+1);
}
void PlacesSQLQueryBuilder::OrderByTextColumnIndexAsc(PRInt32 aIndex)
{
mQueryString += nsPrintfCString(128, " ORDER BY %d COLLATE NOCASE ASC",
mQueryString += nsPrintfCString(" ORDER BY %d COLLATE NOCASE ASC",
aIndex+1);
}
void PlacesSQLQueryBuilder::OrderByTextColumnIndexDesc(PRInt32 aIndex)
{
mQueryString += nsPrintfCString(128, " ORDER BY %d COLLATE NOCASE DESC",
mQueryString += nsPrintfCString(" ORDER BY %d COLLATE NOCASE DESC",
aIndex+1);
}
@ -3978,7 +3978,7 @@ nsNavHistory::QueryToSelectClause(nsNavHistoryQuery* aQuery, // const
// it can match everything and work as a nice case insensitive comparator.
clause.Condition("AUTOCOMPLETE_MATCH(").Param(":search_string")
.Str(", h.url, page_title, tags, ")
.Str(nsPrintfCString(17, "0, 0, 0, 0, %d, 0)",
.Str(nsPrintfCString("0, 0, 0, 0, %d, 0)",
mozIPlacesAutoComplete::MATCH_ANYWHERE_UNMODIFIED).get());
// Serching by terms implicitly exclude queries.
excludeQueries = true;

View File

@ -87,7 +87,7 @@ GetDataFromPasteboard(NSPasteboard* aPasteboard, NSString* aType)
@try {
data = [aPasteboard dataForType:aType];
} @catch (NSException* e) {
NS_WARNING(nsPrintfCString(256, "Exception raised while getting data from the pasteboard: \"%s - %s\"",
NS_WARNING(nsPrintfCString("Exception raised while getting data from the pasteboard: \"%s - %s\"",
[[e name] UTF8String], [[e reason] UTF8String]).get());
}
return data;

View File

@ -191,21 +191,21 @@ private:
void nsPrinterFeatures::SetBoolValue( const char *tagname, bool value )
{
nsPrintfCString prefName(256, PRINTERFEATURES_PREF ".%s.%s",
nsPrintfCString prefName(PRINTERFEATURES_PREF ".%s.%s",
mPrinterName.get(), tagname);
Preferences::SetBool(prefName.get(), value);
}
void nsPrinterFeatures::SetIntValue( const char *tagname, PRInt32 value )
{
nsPrintfCString prefName(256, PRINTERFEATURES_PREF ".%s.%s",
nsPrintfCString prefName(PRINTERFEATURES_PREF ".%s.%s",
mPrinterName.get(), tagname);
Preferences::SetInt(prefName.get(), value);
}
void nsPrinterFeatures::SetCharValue( const char *tagname, const char *value )
{
nsPrintfCString prefName(256, PRINTERFEATURES_PREF ".%s.%s",
nsPrintfCString prefName(PRINTERFEATURES_PREF ".%s.%s",
mPrinterName.get(), tagname);
Preferences::SetCString(prefName.get(), value);
}
@ -236,10 +236,10 @@ void nsPrinterFeatures::SetNumPaperSizeRecords( PRInt32 aCount )
void nsPrinterFeatures::SetPaperRecord(PRInt32 aIndex, const char *aPaperName, PRInt32 aWidthMM, PRInt32 aHeightMM, bool aIsInch)
{
SetCharValue(nsPrintfCString(256, "paper.%d.name", aIndex).get(), aPaperName);
SetIntValue( nsPrintfCString(256, "paper.%d.width_mm", aIndex).get(), aWidthMM);
SetIntValue( nsPrintfCString(256, "paper.%d.height_mm", aIndex).get(), aHeightMM);
SetBoolValue(nsPrintfCString(256, "paper.%d.is_inch", aIndex).get(), aIsInch);
SetCharValue(nsPrintfCString("paper.%d.name", aIndex).get(), aPaperName);
SetIntValue( nsPrintfCString("paper.%d.width_mm", aIndex).get(), aWidthMM);
SetIntValue( nsPrintfCString("paper.%d.height_mm", aIndex).get(), aHeightMM);
SetBoolValue(nsPrintfCString("paper.%d.is_inch", aIndex).get(), aIsInch);
}
void nsPrinterFeatures::SetCanChangeOrientation( bool aCanSetOrientation )
@ -259,7 +259,7 @@ void nsPrinterFeatures::SetNumOrientationRecords( PRInt32 aCount )
void nsPrinterFeatures::SetOrientationRecord( PRInt32 aIndex, const char *aOrientationName )
{
SetCharValue(nsPrintfCString(256, "orientation.%d.name", aIndex).get(), aOrientationName);
SetCharValue(nsPrintfCString("orientation.%d.name", aIndex).get(), aOrientationName);
}
void nsPrinterFeatures::SetCanChangePlex( bool aCanSetPlex )
@ -279,7 +279,7 @@ void nsPrinterFeatures::SetNumPlexRecords( PRInt32 aCount )
void nsPrinterFeatures::SetPlexRecord( PRInt32 aIndex, const char *aPlexName )
{
SetCharValue(nsPrintfCString(256, "plex.%d.name", aIndex).get(), aPlexName);
SetCharValue(nsPrintfCString("plex.%d.name", aIndex).get(), aPlexName);
}
void nsPrinterFeatures::SetCanChangeResolutionName( bool aCanSetResolutionName )
@ -299,7 +299,7 @@ void nsPrinterFeatures::SetNumResolutionNameRecords( PRInt32 aCount )
void nsPrinterFeatures::SetResolutionNameRecord( PRInt32 aIndex, const char *aResolutionName )
{
SetCharValue(nsPrintfCString(256, "resolution.%d.name", aIndex).get(), aResolutionName);
SetCharValue(nsPrintfCString("resolution.%d.name", aIndex).get(), aResolutionName);
}
void nsPrinterFeatures::SetCanChangeColorspace( bool aCanSetColorspace )
@ -319,7 +319,7 @@ void nsPrinterFeatures::SetNumColorspaceRecords( PRInt32 aCount )
void nsPrinterFeatures::SetColorspaceRecord( PRInt32 aIndex, const char *aColorspace )
{
SetCharValue(nsPrintfCString(256, "colorspace.%d.name", aIndex).get(), aColorspace);
SetCharValue(nsPrintfCString("colorspace.%d.name", aIndex).get(), aColorspace);
}
void nsPrinterFeatures::SetCanChangeDownloadFonts( bool aCanSetDownloadFonts )
@ -653,7 +653,7 @@ nsresult CopyPrinterCharPref(const char *modulename, const char *printername,
if (printername && modulename) {
/* Get prefs per printer name and module name */
nsPrintfCString name(512, "print.%s.printer_%s.%s", modulename, printername, prefname);
nsPrintfCString name("print.%s.printer_%s.%s", modulename, printername, prefname);
DO_PR_DEBUG_LOG(("trying to get '%s'\n", name.get()));
rv = Preferences::GetCString(name.get(), &return_buf);
}
@ -661,7 +661,7 @@ nsresult CopyPrinterCharPref(const char *modulename, const char *printername,
if (NS_FAILED(rv)) {
if (printername) {
/* Get prefs per printer name */
nsPrintfCString name(512, "print.printer_%s.%s", printername, prefname);
nsPrintfCString name("print.printer_%s.%s", printername, prefname);
DO_PR_DEBUG_LOG(("trying to get '%s'\n", name.get()));
rv = Preferences::GetCString(name.get(), &return_buf);
}
@ -669,14 +669,14 @@ nsresult CopyPrinterCharPref(const char *modulename, const char *printername,
if (NS_FAILED(rv)) {
if (modulename) {
/* Get prefs per module name */
nsPrintfCString name(512, "print.%s.%s", modulename, prefname);
nsPrintfCString name("print.%s.%s", modulename, prefname);
DO_PR_DEBUG_LOG(("trying to get '%s'\n", name.get()));
rv = Preferences::GetCString(name.get(), &return_buf);
}
if (NS_FAILED(rv)) {
/* Get prefs */
nsPrintfCString name(512, "print.%s", prefname);
nsPrintfCString name("print.%s", prefname);
DO_PR_DEBUG_LOG(("trying to get '%s'\n", name.get()));
rv = Preferences::GetCString(name.get(), &return_buf);
}
@ -776,7 +776,7 @@ NS_IMETHODIMP nsPrinterEnumeratorGTK::InitPrintSettingsFromPrinter(const PRUnich
#ifdef SET_PRINTER_FEATURES_VIA_PREFS
/* Defaults to FALSE */
nsPrintfCString prefName(256,
nsPrintfCString prefName(
PRINTERFEATURES_PREF ".%s.has_special_printerfeatures",
fullPrinterName.get());
Preferences::SetBool(prefName.get(), false);
@ -792,7 +792,7 @@ NS_IMETHODIMP nsPrinterEnumeratorGTK::InitPrintSettingsFromPrinter(const PRUnich
path = PR_GetEnv("HOME");
if (path)
filename = nsPrintfCString(PATH_MAX, "%s/mozilla.pdf", path);
filename = nsPrintfCString("%s/mozilla.pdf", path);
else
filename.AssignLiteral("mozilla.pdf");
}

View File

@ -396,7 +396,7 @@ public:
"value.");
}
else {
aDescription.Append(nsPrintfCString(1024,
aDescription.Append(nsPrintfCString(
"We fire such an event if we notice there is less than %d MB of virtual "
"address space available (controlled by the "
"'memory.low_virtual_mem_threshold_mb' pref). We'll likely crash if "
@ -438,7 +438,7 @@ public:
"value.");
}
else {
aDescription.Append(nsPrintfCString(1024,
aDescription.Append(nsPrintfCString(
"We fire such an event if we notice there is less than %d MB of "
"available commit space (controlled by the "
"'memory.low_commit_space_threshold_mb' pref). Windows will likely "
@ -480,7 +480,7 @@ public:
"value.");
}
else {
aDescription.Append(nsPrintfCString(1024,
aDescription.Append(nsPrintfCString(
"We fire such an event if we notice there is less than %d MB of "
"available physical memory (controlled by the "
"'memory.low_physical_memory_threshold_mb' pref). The machine will start "

View File

@ -572,8 +572,7 @@ nsPersistentProperties::SetStringProperty(const nsACString& aKey,
if (entry->mKey) {
aOldValue = entry->mValue;
NS_WARNING(nsPrintfCString(aKey.Length() + 30,
"the property %s already exists\n",
NS_WARNING(nsPrintfCString("the property %s already exists\n",
flatKey.get()).get());
}
else {

View File

@ -63,17 +63,6 @@ class nsPrintfCString : public nsFixedCString
va_end(ap);
}
// Obsolete form required you to specify a length in advance. The length is now
// unused.
nsPrintfCString( size_type n, const char_type* format, ...)
: nsFixedCString(mLocalBuffer, kLocalBufferSize, 0)
{
va_list ap;
va_start(ap, format);
AppendPrintf(format, ap);
va_end(ap);
}
private:
enum { kLocalBufferSize=15 };
// ought to be large enough for most things ... a |long long| needs at most 20 (so you'd better ask)