Project::OSiRiON - Git repositories
Project::OSiRiON
News . About . Screenshots . Downloads . Forum . Wiki . Tracker . Git
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/core/commandbuffer.cc9
-rw-r--r--src/core/netclient.cc5
-rw-r--r--src/core/netconnection.cc4
-rw-r--r--src/core/netconnection.h2
4 files changed, 12 insertions, 8 deletions
diff --git a/src/core/commandbuffer.cc b/src/core/commandbuffer.cc
index 6c4dbca..0d02e6b 100644
--- a/src/core/commandbuffer.cc
+++ b/src/core/commandbuffer.cc
@@ -207,8 +207,11 @@ void CommandBuffer::exec()
void CommandBuffer::complete(std::string &input, size_t &pos)
{
std::list<std::string> match;
-
- std::string partial = input.substr(0, pos);
+ size_t start = 0;
+ if (input.c_str()[0] == '/' || input.c_str()[0] == '\\')
+ start = 1;
+
+ std::string partial = input.substr(start, pos);
if (!partial.size())
return;
aux::to_lowercase(partial);
@@ -255,7 +258,7 @@ void CommandBuffer::complete(std::string &input, size_t &pos)
if (maxmatch.size() > partial.size()) {
if (match.size()==1) maxmatch += ' ';
- input.replace(0, pos, maxmatch);
+ input.replace(start, pos, maxmatch);
pos = maxmatch.size();
}
diff --git a/src/core/netclient.cc b/src/core/netclient.cc
index dc4a0bd..5254b23 100644
--- a/src/core/netclient.cc
+++ b/src/core/netclient.cc
@@ -132,7 +132,8 @@ void NetClient::transmit(int serverfd)
char zbuf[BLOCKSIZE];
const char *data = 0;
- size_t compressed_size = BLOCKSIZE - 5;
+ unsigned long compressed_size = BLOCKSIZE - 5;
+ unsigned long uncompressed_size = sendq.size();
size_t total_size = 0;
memset(zbuf,0, sizeof(zbuf));
@@ -140,7 +141,7 @@ void NetClient::transmit(int serverfd)
Stats::network_uncompressed_bytes_sent += sendq.size();
// zlib compress
- int status = compress((Bytef*)(zbuf+4), &compressed_size, (Bytef*)sendq.c_str(), sendq.size());
+ int status = compress((Bytef*)(zbuf+4), &compressed_size, (Bytef*)sendq.c_str(), uncompressed_size);
if ((status == Z_OK) && (compressed_size + 4 < sendq.size())) {
// add a header to the compress packet
diff --git a/src/core/netconnection.cc b/src/core/netconnection.cc
index 6606a9f..a0a0497 100644
--- a/src/core/netconnection.cc
+++ b/src/core/netconnection.cc
@@ -164,11 +164,11 @@ void NetConnection::receive()
zrecvbuf[received_compressed_size] = *c;
received_compressed_size++;
- if (received_compressed_size == compressed_size) {
+ if (received_compressed_size == (size_t) compressed_size) {
// uncompress
char zunbuf[BLOCKSIZE];
memset(zunbuf, 0, sizeof(zunbuf));
- size_t zunbuf_size = BLOCKSIZE - 1;
+ unsigned long zunbuf_size = BLOCKSIZE - 1;
int status = uncompress((Bytef *) zunbuf, &zunbuf_size, (Bytef *) zrecvbuf, compressed_size);
diff --git a/src/core/netconnection.h b/src/core/netconnection.h
index ddc70f0..d3c6cf7 100644
--- a/src/core/netconnection.h
+++ b/src/core/netconnection.h
@@ -107,7 +107,7 @@ private:
bool receive_compressed;
size_t received_compressed_size;
- size_t compressed_size;
+ unsigned long compressed_size;
char zrecvbuf[BLOCKSIZE];
};