Use uint64_t instead of long
authorHyunho <hhstark.kang@samsung.com>
Mon, 21 Jun 2021 06:35:14 +0000 (15:35 +0900)
committer강현호/Tizen Platform Lab(SR)/Engineer/삼성전자 <hhstark.kang@samsung.com>
Mon, 21 Jun 2021 06:30:19 +0000 (15:30 +0900)
Signed-off-by: Hyunho <hhstark.kang@samsung.com>
cion/channel/client_channel.cc
cion/channel/server_channel.cc
cion/common/file_payload.cc
cion/common/file_payload.hh
cion/common/file_payload_reader_internal.cc
cion/common/file_payload_reader_internal.hh
cion/tizen-api/cion_payload.cc
cion/tizen-api/cion_payload.h
unittests/src/test-file_payload.cc

index f89b49dc47597fb7f36f2f17b4400d9d37a7c44c..7c680cb758b80a376638e4e03f3ad76a6a69c4ce 100644 (file)
@@ -376,7 +376,7 @@ void ClientChannel::Impl::OnReceived(
             file_.open(temp_path, std::ofstream::app | std::ofstream::binary);
 
             bool is_open = file_.is_open();
-            long file_size = 0;
+            uint64_t file_size = 0;
 
             if (is_open) {
               LOG(INFO) << "client receive file write open success";
index e7a380cc0b802d7bfe203cafcc82ff2ab16f6131..6686a6aa860761b30050ea0ceda9a07bff2c8924 100644 (file)
@@ -205,7 +205,7 @@ void ServerChannel::Impl::ReceiveFile(std::shared_ptr<IPayload> payload,
 
   file.open(temp_path, std::ofstream::app | std::ofstream::binary);
   bool is_open = file.is_open();
-  long file_size = 0;
+  uint64_t file_size = 0;
 
   if (is_open) {
     LOG(INFO) << "sever receive file write open success";
@@ -220,7 +220,7 @@ void ServerChannel::Impl::ReceiveFile(std::shared_ptr<IPayload> payload,
 
   if (is_open) {
     filepayload_reader.SetReceivedBytes(
-        static_cast<long long unsigned int>(file_size));
+        static_cast<uint64_t>(file_size));
     parent_->OnPayloadReceived(payload, peer);
   } else {
     parent_->OnErrorReported(cion::error::CION_ERROR_INVALID_OPERATION, peer);
index 70e67f243eda8bf50972d856b548b988f028b561..14d8ef7308abb516325b686566127a6b160fa0bb 100644 (file)
@@ -54,15 +54,15 @@ std::string FilePayload::GetFileName() {
   return path_.substr(pos + 1);
 }
 
-long FilePayload::GetReceivedBytes() {
+uint64_t FilePayload::GetReceivedBytes() {
   return received_bytes_;
 }
 
-void FilePayload::SetReceivedBytes(long size) {
+void FilePayload::SetReceivedBytes(uint64_t size) {
   received_bytes_ = size;
 }
 
-long FilePayload::GetTotalBytes() {
+uint64_t FilePayload::GetTotalBytes() {
   return total_bytes_;
 }
 
@@ -152,7 +152,7 @@ void FilePayload::ReadFromParcel(tizen_base::Parcel* parcel) {
     LOG(INFO) << "wrong payload type detected" << type;
   id_ = parcel->ReadString();
   parcel->ReadUInt64(&total);
-  total_bytes_ = static_cast<long>(total);
+  total_bytes_ = static_cast<uint64_t>(total);
   path_ = parcel->ReadString();
   tmp_file_name_ = parcel->ReadString();
 }
index 1ca0f6f056a8fdd52ff48219504e45736ee14ed5..6028393d6ad10acb49e7e002744918928bd41a63 100644 (file)
@@ -33,8 +33,8 @@ class FilePayload : public IPayload, private tizen_base::Parcelable{
  public:
   void SaveAsFile(std::string path);
   std::string GetFileName();
-  long GetReceivedBytes();
-  long GetTotalBytes();
+  uint64_t GetReceivedBytes();
+  uint64_t GetTotalBytes();
   void SetFilePath(std::string path);
   FilePayload();
   std::string& GetID() override;
@@ -47,15 +47,15 @@ class FilePayload : public IPayload, private tizen_base::Parcelable{
   std::string& GetFilePath();
   std::string& GetTemporaryFileName();
   void UpdateTemporaryFilePath();
-  void SetReceivedBytes(long size);
+  void SetReceivedBytes(uint64_t size);
   void SetTemporaryFilePath(std::string path);
   void WriteToParcel(tizen_base::Parcel* parcel) const override;
   void ReadFromParcel(tizen_base::Parcel* parcel) override;
   std::string path_;
   std::string tmp_file_name_;
   std::string tmp_path_;
-  long received_bytes_ = 0;
-  long total_bytes_ = 0;
+  uint64_t received_bytes_ = 0;
+  uint64_t total_bytes_ = 0;
   std::string id_;
 };
 
index 09f73e001c2aca6c507861909e9daf62fd8e1c11..a284abdbef4658f96481b55eca643ec2bce04336 100644 (file)
@@ -39,7 +39,7 @@ void FilePayloadReaderInternal::SetTemporaryFilePath(std::string path) {
   fp_->SetTemporaryFilePath(path);
 }
 
-void FilePayloadReaderInternal::SetReceivedBytes(unsigned long long size) {
+void FilePayloadReaderInternal::SetReceivedBytes(uint64_t) {
   fp_->SetReceivedBytes(size);
 }
 
index 82e7e59d5276889a6879e033d52309b08a148a7c..986ec6086780d4b73be0e11486ac8fd70e53199e 100644 (file)
@@ -29,7 +29,7 @@ class FilePayloadReaderInternal {
   FilePayloadReaderInternal(IPayload* payload);
   std::string GetTemporaryFileName();
   std::string GetFilePath();
-  void SetReceivedBytes(unsigned long long size);
+  void SetReceivedBytes(uint64_t size);
   void SetTemporaryFilePath(std::string path);
   void UpdateTemporaryFilePath();
 
index 3bd668bcca0b76871eefb15491ee47e02f6292a6..bfc833aa28025ef9a2ad530d6818ef99af8e662b 100644 (file)
@@ -153,7 +153,7 @@ C_EXPORT int cion_payload_get_received_file_name(cion_payload_h payload,
 }
 
 C_EXPORT int cion_payload_get_received_bytes(cion_payload_h payload,
-    long* bytes) {
+    uint64_t* bytes) {
   if (!payload || !bytes)
     return CION_ERROR_INVALID_PARAMETER;
 
@@ -168,7 +168,7 @@ C_EXPORT int cion_payload_get_received_bytes(cion_payload_h payload,
 }
 
 C_EXPORT int cion_payload_get_total_bytes(cion_payload_h payload,
-    long* bytes) {
+    uint64_t* bytes) {
   if (!payload || !bytes)
     return CION_ERROR_INVALID_PARAMETER;
 
index 111a3cd7279f18bdc219274fc6e6357071137e16..a795a42656719e03f70119fb07d4c6a72081368a 100644 (file)
@@ -76,12 +76,12 @@ int cion_payload_get_received_file_name(cion_payload_h payload,
 /**
  * @brief
  */
-int cion_payload_get_received_bytes(cion_payload_h payload, long *bytes);
+int cion_payload_get_received_bytes(cion_payload_h payload, uint64_t *bytes);
 
 /**
  * @brief
  */
-int cion_payload_get_total_bytes(cion_payload_h payload, long *bytes);
+int cion_payload_get_total_bytes(cion_payload_h payload, uint64_t *bytes);
 
 /**
  * @brief
index 98bbb783a66180db3fe3084a01f8ff7906d98ed7..516cc0869bc271c628ecf9310b50a776de3e31d5 100644 (file)
@@ -43,7 +43,7 @@ TEST_F(FilePayloadTest, Filetest) {
 
 TEST_F(FilePayloadTest, FiletestEtc) {
   int type = 3;
-  unsigned long long big = 1000000000;
+  uint64_t big = 1000000000;
   std::vector<char> dd;
   std::string size;
   std::string path = "/dir/mymyfile.txt";