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
pull/1/head
Tatsuhiro Tsujikawa 2007-08-26 03:10:09 +00:00
parent 674a077bff
commit eb335ef44c
10 changed files with 16 additions and 21 deletions

View File

@ -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().

View File

@ -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

3
configure vendored
View File

@ -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

View File

@ -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)],

View File

@ -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;
}

View File

@ -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");

View File

@ -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)) {

View File

@ -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;
}

View File

@ -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() {

View File

@ -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;
}