Various bugfixes. Some submitted upstream.

This commit is contained in:
Tobias Nygren 2006-08-15 05:46:25 +00:00 committed by Thomas Klausner
parent 9df33a89a6
commit 36890789fb
6 changed files with 119 additions and 1 deletions

View file

@ -1,5 +1,10 @@
$NetBSD: distinfo,v 1.9 2006/07/26 17:23:07 tnn2 Exp $
$NetBSD: distinfo,v 1.10 2006/08/15 05:46:25 tnn2 Exp $
SHA1 (patch-af) = dda2e4f0c26c81f38fe4538749470ae990041b09
SHA1 (patch-aj) = 75b236d0a2dcb33a8c4439f22f6a94034acdb253
SHA1 (patch-ak) = 79dfbeae186302a1413c3a866100b14f2a6b5904
SHA1 (patch-al) = d033475350fe68d48f7b0f5964a5adc4726f6e13
SHA1 (patch-am) = cd1c32336bcf070cdc35941a450afe6d143c560d
SHA1 (patch-an) = 7499704d6b3d94e36d3dba1d1c03427660e180a3
SHA1 (patch-ao) = b14550c9078a7642848824b06cbcc0a1722df29a
SHA1 (patch-ap) = 4a3e9ebd4f88c9d27c62f163ab676369a4b7b780

16
ldcpp/patches/patch-al Normal file
View file

@ -0,0 +1,16 @@
$NetBSD: patch-al,v 1.1 2006/08/15 05:46:25 tnn2 Exp $
--- client/AdcCommand.h.orig 2006-08-15 07:11:30.000000000 +0200
+++ client/AdcCommand.h
@@ -79,7 +79,11 @@ public:
static const char TYPE_HUB = 'H';
static const char TYPE_UDP = 'U';
+#if defined(_WIN32) || defined(__i386__) || defined(__x86_64__) || defined(__alpha)
#define C(n, a, b, c) static const u_int32_t CMD_##n = (((u_int32_t)a) | (((u_int32_t)b)<<8) | (((u_int32_t)c)<<16)); typedef Type<CMD_##n> n
+#else
+#define C(n, a, b, c) static const u_int32_t CMD_##n = ((((u_int32_t)a)<<24) | (((u_int32_t)b)<<16) | (((u_int32_t)c)<<8)); typedef Type<CMD_##n> n
+#endif
// Base commands
C(SUP, 'S','U','P');
C(STA, 'S','T','A');

13
ldcpp/patches/patch-am Normal file
View file

@ -0,0 +1,13 @@
$NetBSD: patch-am,v 1.1 2006/08/15 05:46:25 tnn2 Exp $
--- client/DirectoryListing.cpp.orig 2006-08-15 07:19:57.000000000 +0200
+++ client/DirectoryListing.cpp
@@ -95,7 +95,7 @@ void DirectoryListing::loadFile(const st
::File ff(name, ::File::READ, ::File::OPEN);
FilteredInputStream<UnBZFilter, false> f(&ff);
const size_t BUF_SIZE = 64*1024;
- char buf[BUF_SIZE];
+ AutoArray<char> buf(BUF_SIZE);
size_t len;
size_t bytesRead = 0;
for(;;) {

58
ldcpp/patches/patch-an Normal file
View file

@ -0,0 +1,58 @@
$NetBSD: patch-an,v 1.1 2006/08/15 05:46:25 tnn2 Exp $
--- client/FilteredFile.h.orig 2006-08-15 07:19:11.000000000 +0200
+++ client/FilteredFile.h
@@ -24,6 +24,7 @@
#endif // _MSC_VER > 1000
#include "Streams.h"
+#include "Util.h"
template<class Filter, bool managed>
class CalcOutputStream : public OutputStream {
@@ -72,7 +73,7 @@ class FilteredOutputStream : public Outp
public:
using OutputStream::write;
- FilteredOutputStream(OutputStream* aFile) : f(aFile), flushed(false) { }
+ FilteredOutputStream(OutputStream* aFile) : f(aFile), flushed(false), buf(BUF_SIZE) { }
~FilteredOutputStream() throw() { if(manage) delete f; }
size_t flush() throw(Exception) {
@@ -123,19 +124,19 @@ public:
}
private:
- enum { BUF_SIZE = 64*1024 };
+ static const size_t BUF_SIZE = 64*1024;
OutputStream* f;
Filter filter;
- u_int8_t buf[BUF_SIZE];
+ AutoArray<u_int8_t> buf;
bool flushed;
};
template<class Filter, bool managed>
class FilteredInputStream : public InputStream {
public:
- FilteredInputStream(InputStream* aFile) : f(aFile), pos(0), valid(0), more(true) { }
+ FilteredInputStream(InputStream* aFile) : f(aFile), pos(0), valid(0), more(true), buf(BUF_SIZE) { }
virtual ~FilteredInputStream() throw() { if(managed) delete f; }
/**
@@ -173,11 +174,11 @@ public:
}
private:
- enum { BUF_SIZE = 64*1024 };
+ static const size_t BUF_SIZE = 64*1024;
InputStream* f;
Filter filter;
- u_int8_t buf[BUF_SIZE];
+ AutoArray<u_int8_t> buf;
size_t pos;
size_t valid;
bool more;

13
ldcpp/patches/patch-ao Normal file
View file

@ -0,0 +1,13 @@
$NetBSD: patch-ao,v 1.1 2006/08/15 05:46:25 tnn2 Exp $
--- client/ShareManager.cpp.orig 2006-08-15 07:21:02.000000000 +0200
+++ client/ShareManager.cpp
@@ -339,7 +339,7 @@ bool ShareManager::loadCache() {
::File ff(Util::getConfigPath() + "files.xml.bz2", ::File::READ, ::File::OPEN);
FilteredInputStream<UnBZFilter, false> f(&ff);
const size_t BUF_SIZE = 64*1024;
- char buf[BUF_SIZE];
+ AutoArray<char> buf(BUF_SIZE);
size_t len;
for(;;) {
size_t n = BUF_SIZE;

13
ldcpp/patches/patch-ap Normal file
View file

@ -0,0 +1,13 @@
$NetBSD: patch-ap,v 1.1 2006/08/15 05:46:25 tnn2 Exp $
--- client/Util.cpp.orig 2006-08-15 07:39:50.000000000 +0200
+++ client/Util.cpp
@@ -423,7 +423,7 @@ double Util::toBytes(TCHAR* aSize) {
}
#else
double Util::toBytes(char* aSize) {
- double bytes = strtof(aSize, NULL);
+ double bytes = strtod(aSize, NULL);
if (strstr(aSize, CTSTRING(PIB))) {
return bytes * 1024.0 * 1024.0 * 1024.0 * 1024.0 * 1024.0;
} else if (strstr(aSize, CTSTRING(TiB))) {