Fix compile errors possible on some platforms.

Include <algorithm> in some sources that require it; addresses #430

Places where STL's min() template function could get used with
arguments of differing types can fail to deduce the right template type.
These are fixed with some type tweaking of local variables and also
giving an explicit template argument for good measure.
This commit is contained in:
Jon Siwek 2011-05-08 19:53:41 -05:00
parent cde6076857
commit 35b7caf44f
3 changed files with 10 additions and 4 deletions

View file

@ -9,6 +9,8 @@
#include <assert.h>
#include <openssl/ssl.h>
#include <algorithm>
#include "config.h"
#include "ChunkedIO.h"
#include "NetVar.h"
@ -166,13 +168,13 @@ bool ChunkedIOFd::Write(Chunk* chunk)
// We have to split it up.
char* p = chunk->data;
unsigned long left = chunk->len;
uint32 left = chunk->len;
while ( left )
{
Chunk* part = new Chunk;
part->len = min(BUFFER_SIZE - sizeof(uint32), left);
part->len = min<uint32>(BUFFER_SIZE - sizeof(uint32), left);
part->data = new char[part->len];
memcpy(part->data, p, part->len);
left -= part->len;