[PATCH] D27475: [libFuzzer] Diff 17 - Implement DirName() for Windows.

Marcos Pividori via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Dec 6 11:51:38 PST 2016


mpividori created this revision.
mpividori added reviewers: amccarth, zturner.
mpividori added a subscriber: llvm-commits.
mpividori set the repository for this revision to rL LLVM.

Repository:
  rL LLVM

https://reviews.llvm.org/D27475

Files:
  lib/Fuzzer/FuzzerIOWindows.cpp


Index: lib/Fuzzer/FuzzerIOWindows.cpp
===================================================================
--- lib/Fuzzer/FuzzerIOWindows.cpp
+++ lib/Fuzzer/FuzzerIOWindows.cpp
@@ -21,6 +21,7 @@
 #include <sys/stat.h>
 #include <sys/types.h>
 #include <windows.h>
+#include <Shlwapi.h>
 
 namespace fuzzer {
 
@@ -140,7 +141,12 @@
 }
 
 std::string DirName(const std::string &FileName) {
-  assert(0 && "Unimplemented");
+  char *Tmp = new char[FileName.size() + 1];
+  memcpy(Tmp, FileName.c_str(), FileName.size() + 1);
+  PathRemoveFileSpecA(Tmp);
+  std::string Res(Tmp);
+  delete [] Tmp;
+  return Res;
 }
 
 }  // namespace fuzzer


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D27475.80460.patch
Type: text/x-patch
Size: 637 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20161206/fbf92936/attachment.bin>


More information about the llvm-commits mailing list