Przeglądaj źródła

2007-08-26 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>

	Merged Ross's patch: Removed setmode(). Use _CRT_fmode to enable 
binary
	IO.
	* src/DefaultBtProgressInfoFile.cc
	* src/MetaFileUtil.cc
	* src/SimpleLogger.cc
	* src/SegmentMan.cc
	* src/Util.cc
	* src/Platform.cc
Tatsuhiro Tsujikawa 18 lat temu
rodzic
commit
eb335ef44c
10 zmienionych plików z 16 dodań i 21 usunięć
  1. 11 0
      ChangeLog
  2. 0 3
      config.h.in
  3. 1 2
      configure
  4. 1 1
      configure.ac
  5. 0 3
      src/DefaultBtProgressInfoFile.cc
  6. 0 3
      src/MetaFileUtil.cc
  7. 3 0
      src/Platform.cc
  8. 0 3
      src/SegmentMan.cc
  9. 0 3
      src/SimpleLogger.cc
  10. 0 3
      src/Util.cc

+ 11 - 0
ChangeLog

@@ -1,3 +1,14 @@
+2007-08-26  Tatsuhiro Tsujikawa  <tujikawa at rednoah dot com>
+
+	Merged Ross's patch: Removed setmode(). Use _CRT_fmode to enable binary
+	IO.
+	* src/DefaultBtProgressInfoFile.cc
+	* src/MetaFileUtil.cc
+	* src/SimpleLogger.cc
+	* src/SegmentMan.cc
+	* src/Util.cc
+	* src/Platform.cc
+
 2007-08-24  Tatsuhiro Tsujikawa  <tujikawa at rednoah dot com>
 
 	* src/Xml2MetalinkProcessor.cc (getPieceHash): Added missing .c_str().

+ 0 - 3
config.h.in

@@ -230,9 +230,6 @@
 /* Define to 1 if you have the `setlocale' function. */
 #undef HAVE_SETLOCALE
 
-/* Define to 1 if you have the `setmode' function. */
-#undef HAVE_SETMODE
-
 /* Define to 1 if you have the `sigaction' function. */
 #undef HAVE_SIGACTION
 

+ 1 - 2
configure

@@ -12694,8 +12694,7 @@ done
 
 
 
-
-for ac_func in __argz_count __argz_next __argz_stringify daemon ftruncate getcwd getpagesize inet_ntoa memchr mempcpy memset mkdir munmap nl_langinfo random rmdir select setlocale setmode sigaction sleep socket srandom stpcpy strcasecmp strchr strcspn strdup strerror strstr strtol strtoul unsetenv usleep
+for ac_func in __argz_count __argz_next __argz_stringify daemon ftruncate getcwd getpagesize inet_ntoa memchr mempcpy memset mkdir munmap nl_langinfo random rmdir select setlocale sigaction sleep socket srandom stpcpy strcasecmp strchr strcspn strdup strerror strstr strtol strtoul unsetenv usleep
 do
 as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
 { echo "$as_me:$LINENO: checking for $ac_func" >&5

+ 1 - 1
configure.ac

@@ -141,7 +141,7 @@ AC_FUNC_MMAP
 AC_FUNC_SELECT_ARGTYPES
 AC_FUNC_STAT
 AC_FUNC_VPRINTF
-AC_CHECK_FUNCS([__argz_count __argz_next __argz_stringify daemon ftruncate getcwd getpagesize inet_ntoa memchr mempcpy memset mkdir munmap nl_langinfo random rmdir select setlocale setmode sigaction sleep socket srandom stpcpy strcasecmp strchr strcspn strdup strerror strstr strtol strtoul unsetenv usleep])
+AC_CHECK_FUNCS([__argz_count __argz_next __argz_stringify daemon ftruncate getcwd getpagesize inet_ntoa memchr mempcpy memset mkdir munmap nl_langinfo random rmdir select setlocale sigaction sleep socket srandom stpcpy strcasecmp strchr strcspn strdup strerror strstr strtol strtoul unsetenv usleep])
 
 AC_CHECK_FUNCS([basename],
 	[AM_CONDITIONAL([HAVE_BASENAME], true)],

+ 0 - 3
src/DefaultBtProgressInfoFile.cc

@@ -162,9 +162,6 @@ FILE* DefaultBtProgressInfoFile::openFile(const string& filename,
     throw new DlAbortEx(EX_SEGMENT_FILE_OPEN,
 			filename.c_str(), strerror(errno));
   }
-#ifdef HAVE_SETMODE
-  setmode(fileno(file), O_BINARY);
-#endif
   return file;
 }
 

+ 0 - 3
src/MetaFileUtil.cc

@@ -48,9 +48,6 @@ MetaEntry* MetaFileUtil::parseMetaFile(const string& file) {
     if(fp == NULL) {
       throw new DlAbortEx("cannot open metainfo file");
     }
-#ifdef HAVE_SETMODE
-    setmode(fileno(fp), O_BINARY);
-#endif
     if(fread(buf, len, 1, fp) != 1) {
       fclose(fp);
       throw new DlAbortEx("cannot read metainfo");

+ 3 - 0
src/Platform.cc

@@ -50,8 +50,11 @@
 #include "common.h"
 #include "DlAbortEx.h"
 #include "Platform.h"
+#include <stdlib.h> /* _fmode */
+#include <fcntl.h> /*  _O_BINARY */
 
 Platform::Platform() {
+  unsigned int _CRT_fmode = _O_BINARY;
   WSADATA wsaData;
   memset((char*)&wsaData, 0, sizeof(wsaData));
   if (WSAStartup(MAKEWORD(1, 1), &wsaData)) {

+ 0 - 3
src/SegmentMan.cc

@@ -148,9 +148,6 @@ FILE* SegmentMan::openSegFile(const string& segFilename, const string& mode) con
     throw new DlAbortEx(EX_SEGMENT_FILE_OPEN,
 			segFilename.c_str(), strerror(errno));
   }
-#ifdef HAVE_SETMODE
-  setmode(fileno(segFile), O_BINARY);
-#endif
   return segFile;
 }
 

+ 0 - 3
src/SimpleLogger.cc

@@ -72,9 +72,6 @@ void SimpleLogger::openFile(const string& filename) {
   if(file == NULL) {
     throw new DlAbortEx(EX_FILE_OPEN, filename.c_str(), strerror(errno));
   }
-#ifdef HAVE_SETMODE
-  setmode(fileno(file), O_BINARY);
-#endif
 }
 
 void SimpleLogger::closeFile() {

+ 0 - 3
src/Util.cc

@@ -314,9 +314,6 @@ string Util::toHex(const unsigned char* src, int32_t len) {
 
 FILE* Util::openFile(const string& filename, const string& mode) {
   FILE* file = fopen(filename.c_str(), mode.c_str());
-#ifdef HAVE_SETMODE
-  setmode(fileno(file), O_BINARY);
-#endif
   return file;
 }