[Bug 689] New: New RTT buffer locked functionality fails to compile on Ubuntu Jaunty

https://www.fmtc.be/bugzilla/orocos/show_bug.cgi?id=689

Summary: New RTT buffer locked functionality fails to compile
on Ubuntu Jaunty
Product: RTT
Version: rtt-trunk
Platform: All
OS/Version: All
Status: NEW
Severity: normal
Priority: P3
Component: Real-Time Toolkit (RTT)
AssignedTo: orocos-dev [..] ...
ReportedBy: kiwi [dot] net [..] ...
CC: orocos-dev [..] ...
Estimated Hours: 0.0

Patch matches types in comparisons, and reorders class data to match
initialization order in constructor.

Index: src/BufferLocked.hpp
===================================================================
--- src/BufferLocked.hpp    (revision 30400)
+++ src/BufferLocked.hpp    (working copy)
@@ -87,7 +87,7 @@
         {
             write_policy.pop();
             OS::MutexLock locker(lock);
-            if (cap == buf.size() ) {
+            if (cap == (size_type)buf.size() ) {
                 write_policy.push();
                 return false;
             }
@@ -101,7 +101,7 @@
             write_policy.pop( items.size() );
             OS::MutexLock locker(lock);
             typename std::vector<T>::const_iterator itl( items.begin() );
-            while ( buf.size() != cap && itl != items.end() ) {
+            while ( ((size_type)buf.size() != cap) && (itl != items.end()) ) {
                 buf.push_back( *itl );
                 ++itl;
                 read_policy.push();
@@ -169,11 +169,11 @@
 
         bool full() const {
             OS::MutexLock locker(lock);
-            return buf.size() ==  cap;
+            return (size_type)buf.size() ==  cap;
         }
     private:
+        size_type cap;
         std::deque<T> buf;
-        size_type cap;
         mutable OS::Mutex lock;
         WritePolicy write_policy;
         ReadPolicy read_policy;

[Bug 689] New RTT buffer locked functionality fails to compile o

https://www.fmtc.be/bugzilla/orocos/show_bug.cgi?id=689

Peter Soetens <peter [..] ...> changed:

What |Removed |Added
----------------------------------------------------------------------------
CC| |peter [..] ...
Resolution| |FIXED
Status|NEW |RESOLVED

--- Comment #1 from Peter Soetens <peter [..] ...> 2009-08-10 14:44:49 ---
(In reply to comment #0)
> Patch matches types in comparisons, and reorders class data to match
> initialization order in constructor.

I applied the patch, but in retrospect, the better fix would have been to
declare 'size_type' as 'unsigned int' in BufferBase.hpp.

Peter

[Bug 689] New RTT buffer locked functionality fails to compile o

On Aug 10, 2009, at 08:44 , Peter Soetens wrote:

> https://www.fmtc.be/bugzilla/orocos/show_bug.cgi?id=689
>
>
> Peter Soetens <peter [..] ...> changed:
>
> What |Removed |Added
> ----------------------------------------------------------------------------
> CC| |peter [..] ...
> Resolution| |FIXED
> Status|NEW |RESOLVED
>
>
>
>
> --- Comment #1 from Peter Soetens <peter [..] ...>
> 2009-08-10 14:44:49 ---
> (In reply to comment #0)
>> Patch matches types in comparisons, and reorders class data to match
>> initialization order in constructor.
>
> I applied the patch, but in retrospect, the better fix would have
> been to
> declare 'size_type' as 'unsigned int' in BufferBase.hpp.
>
> Peter

I wondered that myself. What of changing it to "size_t" over "unsigned
int"?
Stephen

[Bug 689] New RTT buffer locked functionality fails to compile o

On Mon, Aug 10, 2009 at 15:04, S Roderick<kiwi [dot] net [..] ...> wrote:
> On Aug 10, 2009, at 08:44 , Peter Soetens wrote:
>
>> https://www.fmtc.be/bugzilla/orocos/show_bug.cgi?id=689
>>
>>
>> Peter Soetens <peter [..] ...> changed:
>>
>>          What    |Removed                     |Added
>>
>> ----------------------------------------------------------------------------
>>                CC|                            |peter [..] ...
>>        Resolution|                            |FIXED
>>            Status|NEW                         |RESOLVED
>>
>>
>>
>>
>> --- Comment #1 from Peter Soetens <peter [..] ...>  2009-08-10
>> 14:44:49 ---
>> (In reply to comment #0)
>>>
>>> Patch matches types in comparisons, and reorders class data to match
>>> initialization order in constructor.
>>
>> I applied the patch, but in retrospect, the better fix would have been to
>> declare 'size_type' as 'unsigned int' in BufferBase.hpp.
>>
>> Peter
>
> I wondered that myself. What of changing it to "size_t" over "unsigned int"?

That would add a dependency on <cstring>. Smells.

Peter