endianness...
This commit is contained in:
@@ -4,7 +4,7 @@
|
||||
#include <limits.h>
|
||||
#include <sys/stat.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include <arpa/inet.h>
|
||||
#include "jamlib/jam.h"
|
||||
|
||||
char *baseoutdir = NULL;
|
||||
@@ -18,14 +18,14 @@ struct msgarea_t {
|
||||
};
|
||||
|
||||
struct msg_t {
|
||||
int area;
|
||||
uint32_t area;
|
||||
char from[32];
|
||||
char to[32];
|
||||
char subject[64];
|
||||
uint32_t timedate;
|
||||
int oaddr;
|
||||
int daddr;
|
||||
int type;
|
||||
uint32_t oaddr;
|
||||
uint32_t daddr;
|
||||
uint32_t type;
|
||||
char reply[36];
|
||||
} __attribute__ ((packed));
|
||||
|
||||
@@ -35,6 +35,14 @@ int mynode = 0;
|
||||
int hubnode = 0;
|
||||
int imhub = 0;
|
||||
|
||||
void msg_to_nl(struct msg_t *msg) {
|
||||
msg->area = htonl(msg->area);
|
||||
msg->timedate = htonl(msg->timedate);
|
||||
msg->oaddr = htonl(msg->oaddr);
|
||||
msg->daddr = htonl(msg->daddr);
|
||||
msg->type = htonl(msg->type);
|
||||
}
|
||||
|
||||
s_JamBase *open_jam_base(char *path) {
|
||||
int ret;
|
||||
s_JamBase *jb;
|
||||
@@ -313,6 +321,8 @@ int export_messages(int area) {
|
||||
continue;
|
||||
}
|
||||
|
||||
msg_to_nl(&msg);
|
||||
|
||||
fwrite(&msg, sizeof(struct msg_t), 1, fptr);
|
||||
fwrite(body, strlen(body), 1, fptr);
|
||||
fclose(fptr);
|
||||
@@ -341,6 +351,8 @@ int export_messages(int area) {
|
||||
fprintf(stderr, "Error creating file %s\n", buffer);
|
||||
continue;
|
||||
}
|
||||
|
||||
msg_to_nl(&msg);
|
||||
|
||||
fwrite(&msg, sizeof(struct msg_t), 1, fptr);
|
||||
fwrite(body, strlen(body), 1, fptr);
|
||||
|
Reference in New Issue
Block a user