fix-win-off_t.patch 1.3 KB

12345678910111213141516171819202122232425262728293031323334
  1. From 1ffb6c77389111de72985a92bf1519352d86ada4 Mon Sep 17 00:00:00 2001
  2. From: fenlog <[email protected]>
  3. Date: Tue, 20 Jun 2023 11:34:06 +0800
  4. Subject: [PATCH] fix off_t(windows is long, not longlong)
  5. ---
  6. trantor/net/inner/TcpConnectionImpl.cc | 4 ++--
  7. 1 file changed, 2 insertions(+), 2 deletions(-)
  8. diff --git a/trantor/net/inner/TcpConnectionImpl.cc b/trantor/net/inner/TcpConnectionImpl.cc
  9. index 22f90c9..633050e 100644
  10. --- a/trantor/net/inner/TcpConnectionImpl.cc
  11. +++ b/trantor/net/inner/TcpConnectionImpl.cc
  12. @@ -1477,7 +1477,7 @@ void TcpConnectionImpl::sendFile(FILE *fp, size_t offset, size_t length)
  13. BufferNodePtr node = std::make_shared<BufferNode>();
  14. node->sendFp_ = fp;
  15. #endif
  16. - node->offset_ = static_cast<off_t>(offset);
  17. + node->offset_ = offset;
  18. node->fileBytesToSend_ = length;
  19. if (loop_->isInLoopThread())
  20. {
  21. @@ -1758,7 +1758,7 @@ void TcpConnectionImpl::sendFileInLoop(const BufferNodePtr &filePtr)
  22. if (nSend >= 0)
  23. {
  24. filePtr->fileBytesToSend_ -= nSend;
  25. - filePtr->offset_ += static_cast<off_t>(nSend);
  26. + filePtr->offset_ += nSend;
  27. if (static_cast<size_t>(nSend) < static_cast<size_t>(n))
  28. {
  29. if (!ioChannelPtr_->isWriting())
  30. --
  31. 2.37.1.windows.1