From 619f05405c95e656d5c9859dd052f5faa56ff4fd Mon Sep 17 00:00:00 2001
From: mattijs <mattijs>
Date: Tue, 14 Feb 2012 18:14:25 +0000
Subject: [PATCH] BUG: byteSize: return streamsize instead of label

---
 src/OpenFOAM/containers/Lists/PackedList/PackedList.H  | 4 ++--
 src/OpenFOAM/containers/Lists/PackedList/PackedListI.H | 4 ++--
 src/OpenFOAM/containers/Lists/UList/UList.C            | 6 +++---
 src/OpenFOAM/containers/Lists/UList/UList.H            | 7 ++++---
 4 files changed, 11 insertions(+), 10 deletions(-)

diff --git a/src/OpenFOAM/containers/Lists/PackedList/PackedList.H b/src/OpenFOAM/containers/Lists/PackedList/PackedList.H
index c45819f4baf..4fac0090e1f 100644
--- a/src/OpenFOAM/containers/Lists/PackedList/PackedList.H
+++ b/src/OpenFOAM/containers/Lists/PackedList/PackedList.H
@@ -2,7 +2,7 @@
   =========                 |
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 2011 OpenFOAM Foundation
+    \\  /    A nd           | Copyright (C) 2011-2012 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -276,7 +276,7 @@ public:
 
             //- Return the binary size in number of characters
             //  used in the underlying storage
-            inline label byteSize() const;
+            inline std::streamsize byteSize() const;
 
             //- Count number of bits set, O(log(n))
             //  Uses the Hamming weight (population count) method
diff --git a/src/OpenFOAM/containers/Lists/PackedList/PackedListI.H b/src/OpenFOAM/containers/Lists/PackedList/PackedListI.H
index b7022290420..303b3125be6 100644
--- a/src/OpenFOAM/containers/Lists/PackedList/PackedListI.H
+++ b/src/OpenFOAM/containers/Lists/PackedList/PackedListI.H
@@ -2,7 +2,7 @@
   =========                 |
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 2011 OpenFOAM Foundation
+    \\  /    A nd           | Copyright (C) 2011-2012 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -945,7 +945,7 @@ inline Foam::label Foam::PackedList<nBits>::packedLength() const
 
 
 template<unsigned nBits>
-inline Foam::label Foam::PackedList<nBits>::byteSize() const
+inline std::streamsize Foam::PackedList<nBits>::byteSize() const
 {
     return packedLength() * sizeof(StorageType);
 }
diff --git a/src/OpenFOAM/containers/Lists/UList/UList.C b/src/OpenFOAM/containers/Lists/UList/UList.C
index 31657dd68c3..a3d1cbb2689 100644
--- a/src/OpenFOAM/containers/Lists/UList/UList.C
+++ b/src/OpenFOAM/containers/Lists/UList/UList.C
@@ -2,7 +2,7 @@
   =========                 |
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 2011 OpenFOAM Foundation
+    \\  /    A nd           | Copyright (C) 2011-2012 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -103,7 +103,7 @@ void Foam::UList<T>::swap(UList<T>& a)
 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
 
 template<class T>
-Foam::label Foam::UList<T>::byteSize() const
+std::streamsize Foam::UList<T>::byteSize() const
 {
     if (!contiguous<T>())
     {
@@ -113,7 +113,7 @@ Foam::label Foam::UList<T>::byteSize() const
             << abort(FatalError);
     }
 
-    return this->size_*label(sizeof(T));
+    return this->size_*sizeof(T);
 }
 
 
diff --git a/src/OpenFOAM/containers/Lists/UList/UList.H b/src/OpenFOAM/containers/Lists/UList/UList.H
index d05e718ed5f..06ef4cbb61b 100644
--- a/src/OpenFOAM/containers/Lists/UList/UList.H
+++ b/src/OpenFOAM/containers/Lists/UList/UList.H
@@ -2,7 +2,7 @@
   =========                 |
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 2011 OpenFOAM Foundation
+    \\  /    A nd           | Copyright (C) 2011-2012 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -137,8 +137,9 @@ public:
 
             //- Return the binary size in number of characters of the UList
             //  if the element is a primitive type
-            //  i.e. contiguous<T>() == true
-            label byteSize() const;
+            //  i.e. contiguous<T>() == true.
+            //  Note that is of type streamsize since used in stream ops
+            std::streamsize byteSize() const;
 
 
             //- Return a const pointer to the first data element,
-- 
GitLab