[llvm-commits] CVS: llvm/lib/System/Win32/Path.cpp

Reid Spencer reid at x10sys.com
Tue Nov 9 12:27:33 PST 2004



Changes in directory llvm/lib/System/Win32:

Path.cpp updated: 1.5 -> 1.6
---
Log message:

Fix isBytecodeFile to correctly recognized compressed bytecode too.


---
Diffs of the changes:  (+7 -4)

Index: llvm/lib/System/Win32/Path.cpp
diff -u llvm/lib/System/Win32/Path.cpp:1.5 llvm/lib/System/Win32/Path.cpp:1.6
--- llvm/lib/System/Win32/Path.cpp:1.5	Fri Nov  5 16:15:36 2004
+++ llvm/lib/System/Win32/Path.cpp	Tue Nov  9 14:27:23 2004
@@ -242,10 +242,13 @@
 
 bool 
 Path::isBytecodeFile() const {
-  if (readable()) {
-    return hasMagicNumber("llvm");
-  }
-  return false;
+  char buffer[ 4];
+  buffer[0] = 0;
+  std::ifstream f(path.c_str());
+  f.read(buffer, 4);
+  if (f.bad())
+    ThrowErrno("can't read file signature");
+  return 0 == memcmp(buffer,"llvc",4) || 0 == memcmp(buffer,"llvm",4);
 }
 
 bool






More information about the llvm-commits mailing list