From 626466daa4a1a6a8d0c0269950a1a14a714b3e06 Mon Sep 17 00:00:00 2001 From: X512 Date: Wed, 8 Apr 2020 10:10:40 +0900 Subject: [PATCH] Network kit: use off_t for download and upload size This change only applies in libnetservices.a. The implementation in libbnetapi.so will use the original definitions. Change-Id: I0aaa5a40af5fbcafaf233c32206cb4af862f8141 Reviewed-on: https://review.haiku-os.org/c/haiku/+/2465 Reviewed-by: Adrien Destugues --- .../private/netservices/UrlProtocolDispatchingListener.h | 9 +++++++++ headers/private/netservices/UrlProtocolListener.h | 9 +++++++++ src/apps/haikudepot/server/WebAppInterface.cpp | 4 ++-- src/apps/haikudepot/util/ToFileUrlProtocolListener.h | 4 ++-- 4 files changed, 22 insertions(+), 4 deletions(-) diff --git a/headers/private/netservices/UrlProtocolDispatchingListener.h b/headers/private/netservices/UrlProtocolDispatchingListener.h index a81a73b23f..768e6a6473 100644 --- a/headers/private/netservices/UrlProtocolDispatchingListener.h +++ b/headers/private/netservices/UrlProtocolDispatchingListener.h @@ -54,10 +54,19 @@ public: virtual void DataReceived(BUrlRequest* caller, const char* data, off_t position, ssize_t size); + +#ifdef LIBNETAPI_DEPRECATED virtual void DownloadProgress(BUrlRequest* caller, ssize_t bytesReceived, ssize_t bytesTotal); virtual void UploadProgress(BUrlRequest* caller, ssize_t bytesSent, ssize_t bytesTotal); +#else + virtual void DownloadProgress(BUrlRequest* caller, + off_t bytesReceived, off_t bytesTotal); + virtual void UploadProgress(BUrlRequest* caller, + off_t bytesSent, off_t bytesTotal); +#endif + virtual void RequestCompleted(BUrlRequest* caller, bool success); virtual void DebugMessage(BUrlRequest* caller, diff --git a/headers/private/netservices/UrlProtocolListener.h b/headers/private/netservices/UrlProtocolListener.h index b6c28655ba..1870490ea7 100644 --- a/headers/private/netservices/UrlProtocolListener.h +++ b/headers/private/netservices/UrlProtocolListener.h @@ -44,10 +44,19 @@ public: virtual void DataReceived(BUrlRequest* caller, const char* data, off_t position, ssize_t size); + +#ifdef LIBNETAPI_DEPRECATED virtual void DownloadProgress(BUrlRequest* caller, ssize_t bytesReceived, ssize_t bytesTotal); virtual void UploadProgress(BUrlRequest* caller, ssize_t bytesSent, ssize_t bytesTotal); +#else + virtual void DownloadProgress(BUrlRequest* caller, + off_t bytesReceived, off_t bytesTotal); + virtual void UploadProgress(BUrlRequest* caller, + off_t bytesSent, off_t bytesTotal); +#endif + virtual void RequestCompleted(BUrlRequest* caller, bool success); virtual void DebugMessage(BUrlRequest* caller, diff --git a/src/apps/haikudepot/server/WebAppInterface.cpp b/src/apps/haikudepot/server/WebAppInterface.cpp index f85b7d9ae7..5e94317760 100644 --- a/src/apps/haikudepot/server/WebAppInterface.cpp +++ b/src/apps/haikudepot/server/WebAppInterface.cpp @@ -69,12 +69,12 @@ public: fDownloadIO->Write(data, size); } - virtual void DownloadProgress(BUrlRequest* caller, ssize_t bytesReceived, + virtual void DownloadProgress(BUrlRequest* caller, off_t bytesReceived, ssize_t bytesTotal) { } - virtual void UploadProgress(BUrlRequest* caller, ssize_t bytesSent, + virtual void UploadProgress(BUrlRequest* caller, off_t bytesSent, ssize_t bytesTotal) { } diff --git a/src/apps/haikudepot/util/ToFileUrlProtocolListener.h b/src/apps/haikudepot/util/ToFileUrlProtocolListener.h index 50c4d02533..20e13d3548 100644 --- a/src/apps/haikudepot/util/ToFileUrlProtocolListener.h +++ b/src/apps/haikudepot/util/ToFileUrlProtocolListener.h @@ -31,9 +31,9 @@ public: const char* data, off_t position, ssize_t size); void DownloadProgress(BUrlRequest* caller, - ssize_t bytesReceived, ssize_t bytesTotal); + off_t bytesReceived, ssize_t bytesTotal); void UploadProgress(BUrlRequest* caller, - ssize_t bytesSent, ssize_t bytesTotal); + off_t bytesSent, ssize_t bytesTotal); void RequestCompleted(BUrlRequest* caller, bool success); void DebugMessage(BUrlRequest* caller,