]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
test/test_cors.cc: initialize key_type in constructor
authorDanny Al-Gaaf <danny.al-gaaf@bisect.de>
Mon, 13 May 2013 12:36:53 +0000 (14:36 +0200)
committerDanny Al-Gaaf <danny.al-gaaf@bisect.de>
Tue, 14 May 2013 16:39:31 +0000 (18:39 +0200)
CID 1019635 (#1 of 1): Uninitialized pointer field (UNINIT_CTOR)
  uninit_member: Non-static class member "kt" is not initialized in
  this constructor nor in any functions that it calls.

Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
src/test/test_cors.cc

index 3c1203c8b4f7d2792a103a7907c945af79f005f6..4d385bc037e94caf90dc5fd66fc004538b07b7d0 100644 (file)
@@ -40,7 +40,8 @@ using namespace std;
 extern "C" int ceph_armor(char *dst, const char *dst_end, 
                           const char *src, const char *end);
 enum key_type {
-  KEY_TYPE_SWIFT = 1,
+  KEY_TYPE_UNDEFINED = 0,
+  KEY_TYPE_SWIFT,
   KEY_TYPE_S3
 };
 
@@ -65,7 +66,7 @@ class test_cors_helper {
     unsigned resp_code;
     key_type kt;
   public:
-    test_cors_helper() : resp_data(NULL){
+    test_cors_helper() : resp_data(NULL), kt(KEY_TYPE_UNDEFINED){
       curl_global_init(CURL_GLOBAL_ALL);
     }
     ~test_cors_helper(){
@@ -247,8 +248,11 @@ int test_cors_helper::send_request(string method, string res,
       string s3auth;
       if(get_s3_auth(method, creds, date, res, s3auth) < 0)return -1;
       auth.append(string("Authorization: AWS ") + s3auth);
-    }else if(kt == KEY_TYPE_SWIFT){
+    } else if(kt == KEY_TYPE_SWIFT){
       auth.append(string("X-Auth-Token: ") + creds);
+    } else {
+      cout << "Unknown state (" << kt << ")\n";
+      return -1;
     }
 
     struct curl_slist *slist = NULL;