[vhffs-dev] [1284] Fixed warnings with gcc 4.3.2 |
[ Thread Index |
Date Index
| More vhffs.org/vhffs-dev Archives
]
Revision: 1284
Author: gradator
Date: 2008-10-14 12:53:02 +0200 (Tue, 14 Oct 2008)
Log Message:
-----------
Fixed warnings with gcc 4.3.2
Modified Paths:
--------------
trunk/vhffs-fssync/vhffsfssync_master.c
trunk/vhffs-fssync/vhffsfssync_slave.c
Modified: trunk/vhffs-fssync/vhffsfssync_master.c
===================================================================
--- trunk/vhffs-fssync/vhffsfssync_master.c 2008-10-13 21:59:33 UTC (rev 1283)
+++ trunk/vhffs-fssync/vhffsfssync_master.c 2008-10-14 10:53:02 UTC (rev 1284)
@@ -149,8 +149,8 @@
FILE *file_stream;
off_t file_offset;
off_t file_size;
- off_t file_chunksize;
- off_t file_chunkcur;
+ ssize_t file_chunksize;
+ ssize_t file_chunkcur;
char *file_pathname;
/* pad to size of `vhffsfssync_net_message' */
@@ -159,8 +159,8 @@
- sizeof(FILE*)
- sizeof(off_t)
- sizeof(off_t)
- - sizeof(off_t)
- - sizeof(off_t)
+ - sizeof(ssize_t)
+ - sizeof(ssize_t)
- sizeof(char*) ];
} vhffsfssync_net_message_file;
@@ -384,7 +384,7 @@
// if the file is being sent, cancel it
vhffsfssync_net_remove_file(conn, pathname);
//printf("%d SENDING FILE %s\n", conn->fd, pathname);
- vhffsfssync_net_send_event(conn, g_strdup_printf("create%c%s%c", '\0', pathname, '\0') , VHFFSFSSYNC_NET_PRIO_MEDIUM);
+ vhffsfssync_net_send_event(conn, g_strdup_printf("create%c%s%c", '\0', pathname, '\0') , VHFFSFSSYNC_NET_PRIO_MEDIUM);
// the size of the file is the priority (small files are sent with more priority)
// but don't set the priority too low, low value can be used for anything else
@@ -529,7 +529,7 @@
datamsg = (vhffsfssync_net_message_data*)msg;
#if DEBUG_NET
- printf(" buffer: %d bytes, %d already written\n", datamsg->data_len, datamsg->data_cur);
+ printf(" buffer: %ld bytes, %ld already written\n", (long int)datamsg->data_len, (long int)datamsg->data_cur);
#endif
/* try to empty the buffer */
lentowrite = datamsg->data_len - datamsg->data_cur;
@@ -551,7 +551,7 @@
else {
datamsg->data_cur += written;
#if DEBUG_NET
- printf(" %d bytes written on %d bytes\n", written, lentowrite);
+ printf(" %ld bytes written on %ld bytes\n", (long int)written, (long int)lentowrite);
#endif
/* the buffer is not empty yet (but the SendQ into the kernel is) */
if(written < lentowrite) {
@@ -568,7 +568,7 @@
else if(msg->msg_family == VHFFSFSSYNC_NET_MESSAGE_FILE) {
vhffsfssync_net_message_file *filemsg;
ssize_t written;
- off_t lentowrite;
+ ssize_t lentowrite;
filemsg = (vhffsfssync_net_message_file*)msg;
#if DEBUG_NET
@@ -588,7 +588,7 @@
filemsg->file_chunkcur = 0;
// we need to make sure that the chunk will not be truncated, we set the current message to the highest priority
msg->msg_priority = 1;
- vhffsfssync_net_send_event(conn, g_strdup_printf("write%c%s%c%lld%c%lld%c", '\0', filemsg->file_pathname, '\0', (long long int)filemsg->file_offset, '\0', (long long int)filemsg->file_chunksize, '\0') , 0);
+ vhffsfssync_net_send_event(conn, g_strdup_printf("write%c%s%c%lld%c%ld%c", '\0', filemsg->file_pathname, '\0', (long long int)filemsg->file_offset, '\0', (long int)filemsg->file_chunksize, '\0') , 0);
// we need to reset here in order to consider the new priorities
continue;
}
@@ -615,7 +615,7 @@
}
else {
#if DEBUG_NET
- printf(" %d bytes written, we are at offset %lld\n", written, filemsg->file_offset);
+ printf(" %ld bytes written, we are at offset %lld\n", (long int)written, (long long int)filemsg->file_offset);
#endif
filemsg->file_chunkcur += written;
@@ -976,10 +976,10 @@
struct stat st;
if(! lstat(path, &st) ) {
if( S_ISREG(st.st_mode) ) {
- g_string_append_printf(msg, "%s%cfile%c%lld%c%ld%c", dir->d_name, '\0', '\0', st.st_size, '\0', st.st_mtime, '\0');
+ g_string_append_printf(msg, "%s%cfile%c%lld%c%ld%c", dir->d_name, '\0', '\0', (long long int)st.st_size, '\0', st.st_mtime, '\0');
}
else if( S_ISLNK(st.st_mode) ) {
- g_string_append_printf(msg, "%s%clink%c%lld%c%ld%c", dir->d_name, '\0', '\0', st.st_size, '\0', st.st_mtime, '\0');
+ g_string_append_printf(msg, "%s%clink%c%lld%c%ld%c", dir->d_name, '\0', '\0', (long long int)st.st_size, '\0', st.st_mtime, '\0');
}
/* we don't need other file types (chr, block, fifo, socket, ...) */
}
Modified: trunk/vhffs-fssync/vhffsfssync_slave.c
===================================================================
--- trunk/vhffs-fssync/vhffsfssync_slave.c 2008-10-13 21:59:33 UTC (rev 1283)
+++ trunk/vhffs-fssync/vhffsfssync_slave.c 2008-10-14 10:53:02 UTC (rev 1284)
@@ -44,7 +44,7 @@
uint32_t recvbuf_end;
FILE *chunk_file;
- size_t chunk_stilltoread;
+ ssize_t chunk_stilltoread;
vhffsfssync_net_message **messages;
uint32_t messages_begin;
@@ -118,7 +118,7 @@
ssize_t lentowrite;
#if DEBUG_NET
- printf(" buffer: %d bytes, %d already written\n", msg->data_len, msg->data_cur);
+ printf(" buffer: %ld bytes, %ld already written\n", (long int)msg->data_len, (long int)msg->data_cur);
#endif
/* try to empty the buffer */
lentowrite = msg->data_len - msg->data_cur;
@@ -140,7 +140,7 @@
else {
msg->data_cur += written;
#if DEBUG_NET
- printf(" %d bytes written on %d bytes\n", written, lentowrite);
+ printf(" %ld bytes written on %ld bytes\n", (long int)written, (long int)lentowrite);
#endif
/* the buffer is not empty yet (but the SendQ into the kernel is) */
if(written < lentowrite) {
@@ -367,8 +367,8 @@
}
else if(!strcmp(args[0], "write")) {
char *pathname = args[1];
- off_t offset = atoll(args[2]);
- size_t size = atoll(args[3]);
+ off_t offset = atoll(args[2]);
+ ssize_t size = atol(args[3]);
int fd;
conn->chunk_stilltoread = size;
@@ -526,12 +526,12 @@
size_t canread = MIN(conn->chunk_stilltoread, end-cur);
conn->chunk_stilltoread -= canread;
#if DEBUG_EVENTS
- printf("binary mode: read: %d stilltoread: %d\n", canread, conn->chunk_stilltoread);
+ printf("binary mode: read: %ld stilltoread: %ld\n", (long int)canread, (long int)conn->chunk_stilltoread);
#endif
if(conn->chunk_file) {
size_t len = fwrite(cur, 1, canread, conn->chunk_file);
#if DEBUG_EVENTS
- printf(" written=%d\n", len);
+ printf(" written: %ld\n", (long int)len);
#endif
if(len != canread) {
fprintf(stderr, "fwrite() failed: %s\n", strerror(errno));