Bug 547190 - AsInt64 (and other AsXXX cpp helpers) ignores GetInt64 failures. r=asuth

This commit is contained in:
Marco Bonardo 2010-06-22 02:01:33 +02:00
Родитель 48a603dd18
Коммит 8d8f56da0a
2 изменённых файлов: 34 добавлений и 20 удалений

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

@ -264,44 +264,51 @@ interface mozIStorageStatement : mozIStorageBaseStatement {
*/ */
inline PRInt32 AsInt32(PRUint32 idx) { inline PRInt32 AsInt32(PRUint32 idx) {
PRInt32 v; PRInt32 v = 0;
GetInt32(idx, &v); nsresult rv = GetInt32(idx, &v);
NS_ABORT_IF_FALSE(NS_SUCCEEDED(rv), "Getting value failed, wrong column index?");
return v; return v;
} }
inline PRInt64 AsInt64(PRUint32 idx) { inline PRInt64 AsInt64(PRUint32 idx) {
PRInt64 v; PRInt64 v = 0;
GetInt64(idx, &v); nsresult rv = GetInt64(idx, &v);
NS_ABORT_IF_FALSE(NS_SUCCEEDED(rv), "Getting value failed, wrong column index?");
return v; return v;
} }
inline double AsDouble(PRUint32 idx) { inline double AsDouble(PRUint32 idx) {
double v; double v = 0.0;
GetDouble(idx, &v); nsresult rv = GetDouble(idx, &v);
NS_ABORT_IF_FALSE(NS_SUCCEEDED(rv), "Getting value failed, wrong column index?");
return v; return v;
} }
inline const char* AsSharedUTF8String(PRUint32 idx, PRUint32 *len) { inline const char* AsSharedUTF8String(PRUint32 idx, PRUint32 *len) {
const char *str = nsnull; const char *str = nsnull;
GetSharedUTF8String(idx, len, &str); nsresult rv = GetSharedUTF8String(idx, len, &str);
NS_ABORT_IF_FALSE(NS_SUCCEEDED(rv), "Getting value failed, wrong column index?");
return str; return str;
} }
inline const PRUnichar* AsSharedWString(PRUint32 idx, PRUint32 *len) { inline const PRUnichar* AsSharedWString(PRUint32 idx, PRUint32 *len) {
const PRUnichar *str = nsnull; const PRUnichar *str = nsnull;
GetSharedString(idx, len, &str); nsresult rv = GetSharedString(idx, len, &str);
NS_ABORT_IF_FALSE(NS_SUCCEEDED(rv), "Getting value failed, wrong column index?");
return str; return str;
} }
inline const PRUint8* AsSharedBlob(PRUint32 idx, PRUint32 *len) { inline const PRUint8* AsSharedBlob(PRUint32 idx, PRUint32 *len) {
const PRUint8 *blob = nsnull; const PRUint8 *blob = nsnull;
GetSharedBlob(idx, len, &blob); nsresult rv = GetSharedBlob(idx, len, &blob);
NS_ABORT_IF_FALSE(NS_SUCCEEDED(rv), "Getting value failed, wrong column index?");
return blob; return blob;
} }
inline PRBool IsNull(PRUint32 idx) { inline PRBool IsNull(PRUint32 idx) {
PRBool b = PR_FALSE; PRBool b = PR_FALSE;
GetIsNull(idx, &b); nsresult rv = GetIsNull(idx, &b);
NS_ABORT_IF_FALSE(NS_SUCCEEDED(rv), "Getting value failed, wrong column index?");
return b; return b;
} }

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

@ -110,44 +110,51 @@ interface mozIStorageValueArray : nsISupports {
*/ */
inline PRInt32 AsInt32(PRUint32 idx) { inline PRInt32 AsInt32(PRUint32 idx) {
PRInt32 v; PRInt32 v = 0;
GetInt32(idx, &v); nsresult rv = GetInt32(idx, &v);
NS_ABORT_IF_FALSE(NS_SUCCEEDED(rv), "Getting value failed, wrong column index?");
return v; return v;
} }
inline PRInt64 AsInt64(PRUint32 idx) { inline PRInt64 AsInt64(PRUint32 idx) {
PRInt64 v; PRInt64 v = 0;
GetInt64(idx, &v); nsresult rv = GetInt64(idx, &v);
NS_ABORT_IF_FALSE(NS_SUCCEEDED(rv), "Getting value failed, wrong column index?");
return v; return v;
} }
inline double AsDouble(PRUint32 idx) { inline double AsDouble(PRUint32 idx) {
double v; double v = 0.0;
GetDouble(idx, &v); nsresult rv = GetDouble(idx, &v);
NS_ABORT_IF_FALSE(NS_SUCCEEDED(rv), "Getting value failed, wrong column index?");
return v; return v;
} }
inline const char* AsSharedUTF8String(PRUint32 idx, PRUint32 *len) { inline const char* AsSharedUTF8String(PRUint32 idx, PRUint32 *len) {
const char *str = nsnull; const char *str = nsnull;
GetSharedUTF8String(idx, len, &str); nsresult rv = GetSharedUTF8String(idx, len, &str);
NS_ABORT_IF_FALSE(NS_SUCCEEDED(rv), "Getting value failed, wrong column index?");
return str; return str;
} }
inline const PRUnichar* AsSharedWString(PRUint32 idx, PRUint32 *len) { inline const PRUnichar* AsSharedWString(PRUint32 idx, PRUint32 *len) {
const PRUnichar *str = nsnull; const PRUnichar *str = nsnull;
GetSharedString(idx, len, &str); nsresult rv = GetSharedString(idx, len, &str);
NS_ABORT_IF_FALSE(NS_SUCCEEDED(rv), "Getting value failed, wrong column index?");
return str; return str;
} }
inline const PRUint8* AsSharedBlob(PRUint32 idx, PRUint32 *len) { inline const PRUint8* AsSharedBlob(PRUint32 idx, PRUint32 *len) {
const PRUint8 *blob = nsnull; const PRUint8 *blob = nsnull;
GetSharedBlob(idx, len, &blob); nsresult rv = GetSharedBlob(idx, len, &blob);
NS_ABORT_IF_FALSE(NS_SUCCEEDED(rv), "Getting value failed, wrong column index?");
return blob; return blob;
} }
inline PRBool IsNull(PRUint32 idx) { inline PRBool IsNull(PRUint32 idx) {
PRBool b = PR_FALSE; PRBool b = PR_FALSE;
GetIsNull(idx, &b); nsresult rv = GetIsNull(idx, &b);
NS_ABORT_IF_FALSE(NS_SUCCEEDED(rv), "Getting value failed, wrong column index?");
return b; return b;
} }