Skip to content

Instantly share code, notes, and snippets.

@deoxxa
Created December 12, 2010 08:26
Show Gist options
  • Save deoxxa/737931 to your computer and use it in GitHub Desktop.
Save deoxxa/737931 to your computer and use it in GitHub Desktop.
diff --git a/src/trxlogger.cpp b/src/trxlogger.cpp
index 956d01b..ef352d6 100644
--- a/src/trxlogger.cpp
+++ b/src/trxlogger.cpp
@@ -34,6 +34,7 @@
#include <string>
#include <time.h>
#include <vector>
+#include <cstring>
#include "trxlogger.h"
#include "logger.h"
@@ -138,18 +139,17 @@ bool TrxLogger::getLogs(std::vector<event_t> *logs) {
log_stream.flush();
log_stream.seekg(0, std::ios::beg);
- while(log_stream.good()) {
-
- log_stream.get((char *) &event.timestamp, sizeof(time_t));
- log_stream.get((char *) &event.x, sizeof(int));
- log_stream.get((char *) &event.y, sizeof(int));
- log_stream.get((char *) &event.z, sizeof(int));
- log_stream.get((char *) &event.otype, sizeof(uint8));
- log_stream.get((char *) &event.ntype, sizeof(uint8));
- log_stream.get((char *) &event.ometa, sizeof(uint8));
- log_stream.get((char *) &event.nmeta, sizeof(uint8));
- log_stream.get((char *) &event.nsize, sizeof(int));
- log_stream.get((char *) &event.nick, event.nsize+1);
+ while(log_stream.good()) {
+ log_stream.read((char *) &event.timestamp, sizeof(time_t));
+ log_stream.read((char *) &event.x, sizeof(int));
+ log_stream.read((char *) &event.y, sizeof(int));
+ log_stream.read((char *) &event.z, sizeof(int));
+ log_stream.read((char *) &event.otype, sizeof(uint8));
+ log_stream.read((char *) &event.ntype, sizeof(uint8));
+ log_stream.read((char *) &event.ometa, sizeof(uint8));
+ log_stream.read((char *) &event.nmeta, sizeof(uint8));
+ log_stream.read((char *) &event.nsize, sizeof(int));
+ log_stream.read((char *) &event.nick, event.nsize+1);
logs->push_back(event);
}
diff --git a/src/trxlogger.h b/src/trxlogger.h
index bd00f21..2ab7702 100644
--- a/src/trxlogger.h
+++ b/src/trxlogger.h
@@ -32,6 +32,7 @@
#include <string>
#include <fstream>
#include <time.h>
+#include <cstring>
#include "tools.h"
@@ -45,7 +46,7 @@ struct event_t {
uint8 otype, ntype;
uint8 ometa, nmeta;
int nsize;
- char nick[17];
+ char nick[32];
};
class TrxLogger
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment