Cleanup for unitialized types. Patch by Jean-Daniel Dupas!
authorBill Wendling <isanbard@gmail.com>
Thu, 26 Jun 2008 08:32:05 +0000 (08:32 +0000)
committerBill Wendling <isanbard@gmail.com>
Thu, 26 Jun 2008 08:32:05 +0000 (08:32 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52775 91177308-0d34-0410-b5e6-96231b3b80d8

lib/System/Path.cpp

index baaa310214b98f19d35cd19e8a931c55bd9e6399..fbb6b6629ce831c4a8fe8f41d170e14eb17797e0 100644 (file)
@@ -91,8 +91,8 @@ sys::IdentifyFileType(const char*magic, unsigned length) {
       break;
 
     case 0xFE:
       break;
 
     case 0xFE:
-    case 0xCE:
-      uint16_t type;
+    case 0xCE: {
+      uint16_t type = 0;
       if (magic[0] == char(0xFE) && magic[1] == char(0xED) && 
           magic[2] == char(0xFA) && magic[3] == char(0xCE)) {
         /* Native endian */
       if (magic[0] == char(0xFE) && magic[1] == char(0xED) && 
           magic[2] == char(0xFA) && magic[3] == char(0xCE)) {
         /* Native endian */
@@ -101,7 +101,7 @@ sys::IdentifyFileType(const char*magic, unsigned length) {
                  magic[2] == char(0xED) && magic[3] == char(0xFE)) {
         /* Reverse endian */
         if (length >= 14) type = magic[13] << 8 | magic[12];
                  magic[2] == char(0xED) && magic[3] == char(0xFE)) {
         /* Reverse endian */
         if (length >= 14) type = magic[13] << 8 | magic[12];
-      } 
+      }
       switch (type) {
         default: break;      
         case 1: return Mach_O_Object_FileType; 
       switch (type) {
         default: break;      
         case 1: return Mach_O_Object_FileType; 
@@ -116,7 +116,7 @@ sys::IdentifyFileType(const char*magic, unsigned length) {
         case 10: break; // FIXME: MH_DSYM companion file with only debug.
       }
       break;
         case 10: break; // FIXME: MH_DSYM companion file with only debug.
       }
       break;
-
+    }
     case 0xF0: // PowerPC Windows
     case 0x83: // Alpha 32-bit
     case 0x84: // Alpha 64-bit
     case 0xF0: // PowerPC Windows
     case 0x83: // Alpha 32-bit
     case 0x84: // Alpha 64-bit