Blob Blame History Raw
From f1c005e78aa609622b87c72f63c2bf96e993a49c Mon Sep 17 00:00:00 2001
From: Christopher Meng <i@cicku.me>
Date: Sun, 22 Feb 2015 10:26:07 +0800
Subject: [PATCH 1/2] Fix mldonkey FTBFS under gcc 5

---
 src/config/mingw/os_stubs_c.c | 10 +++++-----
 src/config/unix/os_stubs_c.c  |  6 +++---
 src/utils/cdk/zlibstubs.c     |  2 +-
 src/utils/lib/fst_hash.c      |  4 ++--
 src/utils/lib/os_stubs.h      |  4 ++--
 5 files changed, 13 insertions(+), 13 deletions(-)

diff --git a/src/config/mingw/os_stubs_c.c b/src/config/mingw/os_stubs_c.c
index 1f67816..5d7dad5 100644
--- a/src/config/mingw/os_stubs_c.c
+++ b/src/config/mingw/os_stubs_c.c
@@ -110,13 +110,13 @@ int os_getdtablesize()
 
 *******************************************************************/
 
-int64 os_getfdsize(OS_FD fd)
+int64_t os_getfdsize(OS_FD fd)
 {
   long len_high;
-  int64 ret;
+  int64_t ret;
 
   ret = GetFileSize(fd, &len_high);
-  return ((int64) len_high << 32 | ret);
+  return ((int64_t) len_high << 32 | ret);
 }
 
 /*******************************************************************
@@ -127,7 +127,7 @@ int64 os_getfdsize(OS_FD fd)
 
 *******************************************************************/
 
-int64 os_getfilesize(char *path)
+int64_t os_getfilesize(char *path)
 {
   OS_FD fd = CreateFile(path, GENERIC_READ, FILE_SHARE_READ,
 			NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL,
@@ -137,7 +137,7 @@ int64 os_getfilesize(char *path)
   if (fd != INVALID_HANDLE_VALUE){
     ret = GetFileSize(fd, &len_high);
     CloseHandle(fd);
-    return  ((int64) len_high << 32 | ret);
+    return  ((int64_t) len_high << 32 | ret);
   } else {
     long err = GetLastError();
     if (err != NO_ERROR) {
diff --git a/src/config/unix/os_stubs_c.c b/src/config/unix/os_stubs_c.c
index 3495271..a43dc7f 100644
--- a/src/config/unix/os_stubs_c.c
+++ b/src/config/unix/os_stubs_c.c
@@ -66,7 +66,7 @@ ssize_t os_read(OS_FD fd, char *buf, size_t len)
 
 void os_ftruncate(OS_FD fd, OFF_T len, /* bool */ int sparse)
 {
-  int64 cursize;
+  int64_t cursize;
   if(!fd) failwith("ftruncate32: file is closed");
   
   cursize = os_getfdsize(fd);
@@ -109,7 +109,7 @@ int os_getdtablesize()
 
 *******************************************************************/
 
-int64 os_getfdsize(OS_FD fd)
+int64_t os_getfdsize(OS_FD fd)
 {
   struct stat buf;
 
@@ -127,7 +127,7 @@ int64 os_getfdsize(OS_FD fd)
 
 *******************************************************************/
 
-int64 os_getfilesize(char *path)
+int64_t os_getfilesize(char *path)
 {
   struct stat buf;
 
diff --git a/src/utils/cdk/zlibstubs.c b/src/utils/cdk/zlibstubs.c
index 491476f..a6ec257 100644
--- a/src/utils/cdk/zlibstubs.c
+++ b/src/utils/cdk/zlibstubs.c
@@ -191,7 +191,7 @@ value camlzip_inflateEnd(value vzs)
 
 value camlzip_update_crc32(value crc, value buf, value pos, value len)
 {
-  return copy_int32(crc32((uint32) Int32_val(crc), 
+  return copy_int32(crc32((uint32_t) Int32_val(crc), 
                           &Byte_u(buf, Long_val(pos)),
                           Long_val(len)));
 }
diff --git a/src/utils/lib/fst_hash.c b/src/utils/lib/fst_hash.c
index 2f9229c..e925bb2 100755
--- a/src/utils/lib/fst_hash.c
+++ b/src/utils/lib/fst_hash.c
@@ -197,7 +197,7 @@ unsigned short fst_hash_checksum (unsigned char *hash)
 /*****************************************************************************/
 
 // hash file
-int fst_hash_file (unsigned char *fth, char *file, int64 filesize)
+int fst_hash_file (unsigned char *fth, char *file, int64_t filesize)
 {
   FILE *fp;
   unsigned char *buf;
@@ -271,7 +271,7 @@ int fst_hash_file (unsigned char *fth, char *file, int64 filesize)
 }
 
 
-void fst_hash_string (unsigned char *fth, unsigned char *file, int64 filesize)
+void fst_hash_string (unsigned char *fth, unsigned char *file, int64_t filesize)
 {
   unsigned char * buf = file;
   size_t len = filesize;
diff --git a/src/utils/lib/os_stubs.h b/src/utils/lib/os_stubs.h
index 42f2fe8..5ec0512 100644
--- a/src/utils/lib/os_stubs.h
+++ b/src/utils/lib/os_stubs.h
@@ -155,8 +155,8 @@ extern OFF_T os_lseek(OS_FD fd, OFF_T pos, int dir);
 extern void os_ftruncate(OS_FD fd, OFF_T len, int sparse);
 extern ssize_t os_read(OS_FD fd, char *buf, size_t len);
 extern int os_getdtablesize();
-extern int64 os_getfdsize(OS_FD fd);
-extern int64 os_getfilesize(char *path);
+extern int64_t os_getfdsize(OS_FD fd);
+extern int64_t os_getfilesize(char *path);
 extern void os_set_nonblock(OS_SOCKET fd);
 extern void os_uname(char buf[]);
 extern int os_os_supported();
-- 
2.3.0