Bug 547190 - AsInt64 (and other AsXXX cpp helpers) ignores GetInt64 failures. r=asuth
authorMarco Bonardo <mbonardo@mozilla.com>
Tue, 22 Jun 2010 02:01:33 +0200
changeset 43920 6c9a642a7e5979e1f5eedf4eea07a4710d7660dd
parent 43919 1244bf803057d99bf86b3f6d528b586927fc4b5a
child 43921 73a19cbc9adc28b5feb56480ecaab8a41c4dc5c9
push idunknown
push userunknown
push dateunknown
reviewersasuth
bugs547190
milestone1.9.3a6pre
Bug 547190 - AsInt64 (and other AsXXX cpp helpers) ignores GetInt64 failures. r=asuth
storage/public/mozIStorageStatement.idl
storage/public/mozIStorageValueArray.idl
--- a/storage/public/mozIStorageStatement.idl
+++ b/storage/public/mozIStorageStatement.idl
@@ -259,51 +259,58 @@ interface mozIStorageStatement : mozISto
   /**
    * Getters for native code that return their values as
    * the return type, for convenience and sanity.
    *
    * Not virtual; no vtable bloat.
    */
 
   inline PRInt32 AsInt32(PRUint32 idx) {
-    PRInt32 v;
-    GetInt32(idx, &v);
+    PRInt32 v = 0;
+    nsresult rv = GetInt32(idx, &v);
+    NS_ABORT_IF_FALSE(NS_SUCCEEDED(rv), "Getting value failed, wrong column index?");
     return v;
   }
 
   inline PRInt64 AsInt64(PRUint32 idx) {
-    PRInt64 v;
-    GetInt64(idx, &v);
+    PRInt64 v = 0;
+    nsresult rv = GetInt64(idx, &v);
+    NS_ABORT_IF_FALSE(NS_SUCCEEDED(rv), "Getting value failed, wrong column index?");
     return v;
   }
 
   inline double AsDouble(PRUint32 idx) {
-    double v;
-    GetDouble(idx, &v);
+    double v = 0.0;
+    nsresult rv = GetDouble(idx, &v);
+    NS_ABORT_IF_FALSE(NS_SUCCEEDED(rv), "Getting value failed, wrong column index?");
     return v;
   }
 
   inline const char* AsSharedUTF8String(PRUint32 idx, PRUint32 *len) {
     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;
   }
 
   inline const PRUnichar* AsSharedWString(PRUint32 idx, PRUint32 *len) {
     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;
   }
 
   inline const PRUint8* AsSharedBlob(PRUint32 idx, PRUint32 *len) {
     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;
   }
 
   inline PRBool IsNull(PRUint32 idx) {
     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;
   }
 
 %}
 };
--- a/storage/public/mozIStorageValueArray.idl
+++ b/storage/public/mozIStorageValueArray.idl
@@ -105,52 +105,59 @@ interface mozIStorageValueArray : nsISup
   /**
    * Getters for native code that return their values as
    * the return type, for convenience and sanity.
    *
    * Not virtual; no vtable bloat.
    */
 
   inline PRInt32 AsInt32(PRUint32 idx) {
-    PRInt32 v;
-    GetInt32(idx, &v);
+    PRInt32 v = 0;
+    nsresult rv = GetInt32(idx, &v);
+    NS_ABORT_IF_FALSE(NS_SUCCEEDED(rv), "Getting value failed, wrong column index?");
     return v;
   }
 
   inline PRInt64 AsInt64(PRUint32 idx) {
-    PRInt64 v;
-    GetInt64(idx, &v);
+    PRInt64 v = 0;
+    nsresult rv = GetInt64(idx, &v);
+    NS_ABORT_IF_FALSE(NS_SUCCEEDED(rv), "Getting value failed, wrong column index?");
     return v;
   }
 
   inline double AsDouble(PRUint32 idx) {
-    double v;
-    GetDouble(idx, &v);
+    double v = 0.0;
+    nsresult rv = GetDouble(idx, &v);
+    NS_ABORT_IF_FALSE(NS_SUCCEEDED(rv), "Getting value failed, wrong column index?");
     return v;
   }
 
   inline const char* AsSharedUTF8String(PRUint32 idx, PRUint32 *len) {
     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;
   }
 
   inline const PRUnichar* AsSharedWString(PRUint32 idx, PRUint32 *len) {
     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;
   }
 
   inline const PRUint8* AsSharedBlob(PRUint32 idx, PRUint32 *len) {
     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;
   }
 
   inline PRBool IsNull(PRUint32 idx) {
     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;
   }
 
 %}
 
 };