diff options
| author | Dimitry Andric <dim@FreeBSD.org> | 2017-06-01 20:58:36 +0000 | 
|---|---|---|
| committer | Dimitry Andric <dim@FreeBSD.org> | 2017-06-01 20:58:36 +0000 | 
| commit | f382538d471e38a9b98f016c4caebd24c8d60b62 (patch) | |
| tree | d30f3d58b1044b5355d50c17a6a96c6a0b35703a /lib/Support | |
| parent | ee2f195dd3e40f49698ca4dc2666ec09c770e80d (diff) | |
Notes
Diffstat (limited to 'lib/Support')
| -rw-r--r-- | lib/Support/BinaryStreamReader.cpp | 20 | ||||
| -rw-r--r-- | lib/Support/Unix/Path.inc | 5 | 
2 files changed, 25 insertions, 0 deletions
| diff --git a/lib/Support/BinaryStreamReader.cpp b/lib/Support/BinaryStreamReader.cpp index 862232971162..bfb658cfa0b7 100644 --- a/lib/Support/BinaryStreamReader.cpp +++ b/lib/Support/BinaryStreamReader.cpp @@ -69,6 +69,26 @@ Error BinaryStreamReader::readCString(StringRef &Dest) {    return Error::success();  } +Error BinaryStreamReader::readWideString(ArrayRef<UTF16> &Dest) { +  uint32_t Length = 0; +  uint32_t OriginalOffset = getOffset(); +  const UTF16 *C; +  while (true) { +    if (auto EC = readObject(C)) +      return EC; +    if (*C == 0x0000) +      break; +    ++Length; +  } +  uint32_t NewOffset = getOffset(); +  setOffset(OriginalOffset); + +  if (auto EC = readArray(Dest, Length)) +    return EC; +  setOffset(NewOffset); +  return Error::success(); +} +  Error BinaryStreamReader::readFixedString(StringRef &Dest, uint32_t Length) {    ArrayRef<uint8_t> Bytes;    if (auto EC = readBytes(Bytes, Length)) diff --git a/lib/Support/Unix/Path.inc b/lib/Support/Unix/Path.inc index fa28ba1b6ab6..ce638d453c19 100644 --- a/lib/Support/Unix/Path.inc +++ b/lib/Support/Unix/Path.inc @@ -381,6 +381,11 @@ static bool is_local_impl(struct STATVFS &Vfs) {  #elif defined(__CYGWIN__)    // Cygwin doesn't expose this information; would need to use Win32 API.    return false; +#elif defined(__sun) +  // statvfs::f_basetype contains a null-terminated FSType name of the mounted target +  StringRef fstype(Vfs.f_basetype); +  // NFS is the only non-local fstype?? +  return !fstype.equals("nfs");  #else    return !!(STATVFS_F_FLAG(Vfs) & MNT_LOCAL);  #endif | 
