[Lldb-commits] [lldb] r154423 - /lldb/branches/lldb-platform-work/source/Host/common/Host.cpp
Johnny Chen
johnny.chen at apple.com
Tue Apr 10 11:41:57 PDT 2012
Author: johnny
Date: Tue Apr 10 13:41:57 2012
New Revision: 154423
URL: http://llvm.org/viewvc/llvm-project?rev=154423&view=rev
Log:
Fix Host::Read/WriteFile() to return UINT32_MAX to signal that an error occurred.
Use of 0 is wrong since it collides with end of file while reading.
Modified:
lldb/branches/lldb-platform-work/source/Host/common/Host.cpp
Modified: lldb/branches/lldb-platform-work/source/Host/common/Host.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/source/Host/common/Host.cpp?rev=154423&r1=154422&r2=154423&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/source/Host/common/Host.cpp (original)
+++ lldb/branches/lldb-platform-work/source/Host/common/Host.cpp Tue Apr 10 13:41:57 2012
@@ -1323,22 +1323,22 @@
Host::WriteFile (lldb::user_id_t fd, uint64_t offset, void* data, size_t data_len)
{
if (fd == UINT64_MAX)
- return false;
+ return UINT32_MAX;
FDToFileMap::iterator i = GetFDToFileMap().find(fd),
end = GetFDToFileMap().end();
if (i == end)
- return false;
+ return UINT32_MAX;
FileSP file_sp = i->second;
off_t offset_ = offset;
Error err = file_sp->SeekFromStart(offset_);
if (err.Fail())
- return 0;
+ return UINT32_MAX;
if (!file_sp)
- return 0;
+ return UINT32_MAX;
size_t data_len_ = data_len;
err = file_sp->Write(data,data_len_);
if (err.Fail())
- return 0;
+ return UINT32_MAX;
return data_len_;
}
@@ -1346,22 +1346,22 @@
Host::ReadFile (lldb::user_id_t fd, uint64_t offset, void* data_ptr, size_t len_wanted)
{
if (fd == UINT64_MAX)
- return false;
+ return UINT32_MAX;
FDToFileMap::iterator i = GetFDToFileMap().find(fd),
end = GetFDToFileMap().end();
if (i == end)
- return false;
+ return UINT32_MAX;
FileSP file_sp = i->second;
off_t offset_ = offset;
Error err = file_sp->SeekFromStart(offset_);
if (err.Fail())
- return 0;
+ return UINT32_MAX;
if (!file_sp)
- return 0;
+ return UINT32_MAX;
size_t len_wanted_ = len_wanted;
err = file_sp->Read(data_ptr,len_wanted_);
if (err.Fail())
- return 0;
+ return UINT32_MAX;
return len_wanted_;
}
More information about the lldb-commits
mailing list