Bug 678222 - Fix build with clang and c++0x; r=roc

Change AppUnitsPerDevPixel to return a PRUint32. It should never return
negative values and it is used in initializer lists that expect unsigned
values, which is not valid c++0x.
I have also change the member variables to be unsigned and converted
a sentinel value to use 0 instead of -1. UINT32_MAX should work fine too
if you like it better.
This commit is contained in:
Rafael Ávila de Espíndola 2011-08-11 19:19:03 -04:00
Родитель c8de895259
Коммит 298ca7d725
8 изменённых файлов: 11 добавлений и 11 удалений

Просмотреть файл

@ -115,7 +115,7 @@ public:
* is usually a factor of AppUnitsPerCSSPixel(), although that is
* not guaranteed.
*/
PRInt32 AppUnitsPerDevPixel() const { return mAppUnitsPerDevPixel; }
PRUint32 AppUnitsPerDevPixel() const { return mAppUnitsPerDevPixel; }
/**
* Convert device pixels which is used for gfx/thebes to nearest
@ -311,7 +311,7 @@ protected:
nscoord mWidth;
nscoord mHeight;
PRUint32 mDepth;
PRInt32 mAppUnitsPerDevPixel;
PRUint32 mAppUnitsPerDevPixel;
PRInt32 mAppUnitsPerDevNotScaledPixel;
PRInt32 mAppUnitsPerPhysicalInch;
float mPixelScale;

Просмотреть файл

@ -98,7 +98,7 @@ public:
} // anon namespace
nsFontMetrics::nsFontMetrics()
: mDeviceContext(nsnull), mP2A(-1), mTextRunRTL(PR_FALSE)
: mDeviceContext(nsnull), mP2A(0), mTextRunRTL(PR_FALSE)
{
}
@ -113,7 +113,7 @@ nsFontMetrics::Init(const nsFont& aFont, nsIAtom* aLanguage,
nsDeviceContext *aContext,
gfxUserFontSet *aUserFontSet)
{
NS_ABORT_IF_FALSE(mP2A == -1, "already initialized");
NS_ABORT_IF_FALSE(mP2A == 0, "already initialized");
mFont = aFont;
mLanguage = aLanguage;

Просмотреть файл

@ -227,7 +227,7 @@ public:
gfxFontGroup* GetThebesFontGroup() { return mFontGroup; }
gfxUserFontSet* GetUserFontSet() { return mFontGroup->GetUserFontSet(); }
PRInt32 AppUnitsPerDevPixel() { return mP2A; }
PRUint32 AppUnitsPerDevPixel() { return mP2A; }
protected:
const gfxFont::Metrics& GetMetrics() const;
@ -236,7 +236,7 @@ protected:
nsRefPtr<gfxFontGroup> mFontGroup;
nsCOMPtr<nsIAtom> mLanguage;
nsDeviceContext *mDeviceContext;
PRInt32 mP2A;
PRUint32 mP2A;
PRPackedBool mTextRunRTL;
};

Просмотреть файл

@ -70,7 +70,7 @@ public:
// These accessors will never return null.
gfxContext *ThebesContext() { return mThebes; }
nsDeviceContext *DeviceContext() { return mDeviceContext; }
PRInt32 AppUnitsPerDevPixel() { return mP2A; }
PRUint32 AppUnitsPerDevPixel() { return mP2A; }
// Graphics state

Просмотреть файл

@ -592,7 +592,7 @@ public:
}
static PRInt32 AppUnitsPerCSSPixel() { return nsDeviceContext::AppUnitsPerCSSPixel(); }
PRInt32 AppUnitsPerDevPixel() const { return mDeviceContext->AppUnitsPerDevPixel(); }
PRUint32 AppUnitsPerDevPixel() const { return mDeviceContext->AppUnitsPerDevPixel(); }
static PRInt32 AppUnitsPerCSSInch() { return nsDeviceContext::AppUnitsPerCSSInch(); }
static nscoord CSSPixelsToAppUnits(PRInt32 aPixels)

Просмотреть файл

@ -253,7 +253,7 @@ public: // NOT in nsIViewManager, so private to the view module
// pending updates.
void PostPendingUpdate() { RootViewManager()->mHasPendingUpdates = PR_TRUE; }
PRInt32 AppUnitsPerDevPixel() const
PRUint32 AppUnitsPerDevPixel() const
{
return mContext->AppUnitsPerDevPixel();
}

Просмотреть файл

@ -2083,7 +2083,7 @@ NS_IMETHODIMP nsXULWindow::SetXULBrowserWindow(nsIXULBrowserWindow * aXULBrowser
// nsXULWindow: Accessors
//*****************************************************************************
PRInt32 nsXULWindow::AppUnitsPerDevPixel()
PRUint32 nsXULWindow::AppUnitsPerDevPixel()
{
if (mWindow && mWindow->GetDeviceContext()) {
mAppPerDev = mWindow->GetDeviceContext()->AppUnitsPerDevPixel();

Просмотреть файл

@ -147,7 +147,7 @@ protected:
void SetContentScrollbarVisibility(PRBool aVisible);
PRBool GetContentScrollbarVisibility();
void PersistentAttributesDirty(PRUint32 aDirtyFlags);
PRInt32 AppUnitsPerDevPixel();
PRUint32 AppUnitsPerDevPixel();
nsChromeTreeOwner* mChromeTreeOwner;
nsContentTreeOwner* mContentTreeOwner;