~zooko/cryptopp/trunk

« back to all changes in this revision

Viewing changes to mqueue.cpp

  • Committer: weidai
  • Date: 2005-07-12 04:23:32 UTC
  • Revision ID: svn-v4:57ff6487-cd31-0410-9ec3-f628ee90f5f0:trunk/c5:198
port to MSVC .NET 2005 beta 2

Show diffs side-by-side

added added

removed removed

Lines of Context:
13
13
{
14
14
}
15
15
 
16
 
unsigned int MessageQueue::CopyRangeTo2(BufferedTransformation &target, unsigned long &begin, unsigned long end, const std::string &channel, bool blocking) const
 
16
size_t MessageQueue::CopyRangeTo2(BufferedTransformation &target, lword &begin, lword end, const std::string &channel, bool blocking) const
17
17
{
18
18
        if (begin >= MaxRetrievable())
19
19
                return 0;
21
21
        return m_queue.CopyRangeTo2(target, begin, STDMIN(MaxRetrievable(), end), channel, blocking);
22
22
}
23
23
 
24
 
unsigned int MessageQueue::TransferTo2(BufferedTransformation &target, unsigned long &transferBytes, const std::string &channel, bool blocking)
 
24
size_t MessageQueue::TransferTo2(BufferedTransformation &target, lword &transferBytes, const std::string &channel, bool blocking)
25
25
{
26
26
        transferBytes = STDMIN(MaxRetrievable(), transferBytes);
27
 
        unsigned int blockedBytes = m_queue.TransferTo2(target, transferBytes, channel, blocking);
 
27
        size_t blockedBytes = m_queue.TransferTo2(target, transferBytes, channel, blocking);
28
28
        m_lengths.front() -= transferBytes;
29
29
        return blockedBytes;
30
30
}
45
45
unsigned int MessageQueue::CopyMessagesTo(BufferedTransformation &target, unsigned int count, const std::string &channel) const
46
46
{
47
47
        ByteQueue::Walker walker(m_queue);
48
 
        std::deque<unsigned long>::const_iterator it = m_lengths.begin();
 
48
        std::deque<lword>::const_iterator it = m_lengths.begin();
49
49
        unsigned int i;
50
50
        for (i=0; i<count && it != --m_lengths.end(); ++i, ++it)
51
51
        {
62
62
        m_lengths.swap(rhs.m_lengths);
63
63
}
64
64
 
65
 
const byte * MessageQueue::Spy(unsigned int &contiguousSize) const
 
65
const byte * MessageQueue::Spy(size_t &contiguousSize) const
66
66
{
67
67
        const byte *result = m_queue.Spy(contiguousSize);
68
 
        contiguousSize = (unsigned int)STDMIN((unsigned long)contiguousSize, MaxRetrievable());
 
68
        contiguousSize = UnsignedMin(contiguousSize, MaxRetrievable());
69
69
        return result;
70
70
}
71
71
 
81
81
                return 2;
82
82
}
83
83
 
84
 
unsigned int EqualityComparisonFilter::ChannelPut2(const std::string &channel, const byte *inString, unsigned int length, int messageEnd, bool blocking)
 
84
size_t EqualityComparisonFilter::ChannelPut2(const std::string &channel, const byte *inString, size_t length, int messageEnd, bool blocking)
85
85
{
86
86
        if (!blocking)
87
87
                throw BlockingInputOnly("EqualityComparisonFilter");
101
101
 
102
102
                while (length > 0 && q2.AnyRetrievable())
103
103
                {
104
 
                        unsigned int len = length;
 
104
                        size_t len = length;
105
105
                        const byte *data = q2.Spy(len);
106
106
                        len = STDMIN(len, length);
107
107
                        if (memcmp(inString, data, len) != 0)