Bug#247964: Add missing nsMemory::Free() (+whitespace fixes). Patch by <jonathan.watt@strath.ac.uk>. SVG only - not part of default build.

This commit is contained in:
alex%croczilla.com 2004-06-21 16:58:51 +00:00
Родитель bf222aea40
Коммит 96a49cd64b
1 изменённых файлов: 15 добавлений и 13 удалений

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

@ -54,7 +54,7 @@ public:
float w=0.0f, float h=0.0f); float w=0.0f, float h=0.0f);
protected: protected:
nsSVGRect(float x, float y, float w, float h); nsSVGRect(float x, float y, float w, float h);
public: public:
// nsISupports interface: // nsISupports interface:
NS_DECL_ISUPPORTS NS_DECL_ISUPPORTS
@ -65,8 +65,8 @@ public:
// nsISVGValue interface: // nsISVGValue interface:
NS_IMETHOD SetValueString(const nsAString& aValue); NS_IMETHOD SetValueString(const nsAString& aValue);
NS_IMETHOD GetValueString(nsAString& aValue); NS_IMETHOD GetValueString(nsAString& aValue);
protected: protected:
float mX, mY, mWidth, mHeight; float mX, mY, mWidth, mHeight;
}; };
@ -80,7 +80,7 @@ nsSVGRect::Create(nsIDOMSVGRect** result,
{ {
*result = (nsIDOMSVGRect*) new nsSVGRect(x,y,w,h); *result = (nsIDOMSVGRect*) new nsSVGRect(x,y,w,h);
if(!*result) return NS_ERROR_OUT_OF_MEMORY; if(!*result) return NS_ERROR_OUT_OF_MEMORY;
NS_ADDREF(*result); NS_ADDREF(*result);
return NS_OK; return NS_OK;
} }
@ -122,7 +122,7 @@ nsSVGRect::SetValueString(const nsAString& aValue)
int i; int i;
for (i=0;i<4;++i) { for (i=0;i<4;++i) {
if (!(token = nsCRT::strtok(rest, delimiters, &rest))) break; // parse error if (!(token = nsCRT::strtok(rest, delimiters, &rest))) break; // parse error
char *end; char *end;
vals[i] = PR_strtod(token, &end); vals[i] = PR_strtod(token, &end);
if (*end != '\0') break; // parse error if (*end != '\0') break; // parse error
@ -139,7 +139,9 @@ nsSVGRect::SetValueString(const nsAString& aValue)
mHeight = (double)vals[3]; mHeight = (double)vals[3];
DidModify(); DidModify();
} }
nsMemory::Free(str);
return rv; return rv;
} }
@ -152,7 +154,7 @@ nsSVGRect::GetValueString(nsAString& aValue)
(double)mX, (double)mY, (double)mX, (double)mY,
(double)mWidth, (double)mHeight); (double)mWidth, (double)mHeight);
aValue.Append(buf); aValue.Append(buf);
return NS_OK; return NS_OK;
} }
@ -232,7 +234,7 @@ protected:
nsSVGRectPrototypeWrapper(nsIDOMSVGRect* prototype, nsSVGRectPrototypeWrapper(nsIDOMSVGRect* prototype,
nsIDOMSVGRect* body); nsIDOMSVGRect* body);
virtual ~nsSVGRectPrototypeWrapper(); virtual ~nsSVGRectPrototypeWrapper();
public: public:
// nsISupports interface: // nsISupports interface:
NS_DECL_ISUPPORTS NS_DECL_ISUPPORTS
@ -243,12 +245,12 @@ public:
// nsISVGValue interface: // nsISVGValue interface:
NS_IMETHOD SetValueString(const nsAString& aValue); NS_IMETHOD SetValueString(const nsAString& aValue);
NS_IMETHOD GetValueString(nsAString& aValue); NS_IMETHOD GetValueString(nsAString& aValue);
protected: protected:
void EnsureBody(); void EnsureBody();
nsIDOMSVGRect* Delegate() { return mBody ? mBody.get() : mPrototype.get(); } nsIDOMSVGRect* Delegate() { return mBody ? mBody.get() : mPrototype.get(); }
nsCOMPtr<nsIDOMSVGRect> mPrototype; nsCOMPtr<nsIDOMSVGRect> mPrototype;
nsCOMPtr<nsIDOMSVGRect> mBody; nsCOMPtr<nsIDOMSVGRect> mBody;
}; };
@ -263,7 +265,7 @@ nsSVGRectPrototypeWrapper::Create(nsIDOMSVGRect** result,
{ {
*result = (nsIDOMSVGRect*) new nsSVGRectPrototypeWrapper(prototype, body); *result = (nsIDOMSVGRect*) new nsSVGRectPrototypeWrapper(prototype, body);
if(!*result) return NS_ERROR_OUT_OF_MEMORY; if(!*result) return NS_ERROR_OUT_OF_MEMORY;
NS_ADDREF(*result); NS_ADDREF(*result);
return NS_OK; return NS_OK;
} }
@ -326,7 +328,7 @@ nsSVGRectPrototypeWrapper::GetValueString(nsAString& aValue)
{ {
nsCOMPtr<nsISVGValue> val = do_QueryInterface( Delegate() ); nsCOMPtr<nsISVGValue> val = do_QueryInterface( Delegate() );
NS_ASSERTION(val, "missing interface on body"); NS_ASSERTION(val, "missing interface on body");
return val->GetValueString(aValue); return val->GetValueString(aValue);
} }