From fc53174a4f336c2661031c581bff9461b62ca6ee Mon Sep 17 00:00:00 2001 From: "cls%seawood.org" Date: Tue, 17 Nov 1998 16:53:02 +0000 Subject: [PATCH] Added check for ios::binary which seems to just be the new ANSI/ISO standard for ios::bin . git-svn-id: svn://10.0.0.236/trunk@14804 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/configure.in | 21 +++++++++++++++++++ mozilla/htmlparser/src/SelfTest.cpp | 6 ++++++ mozilla/htmlparser/src/nsScanner.cpp | 8 +++---- mozilla/htmlparser/tests/windows/Selftest.cpp | 7 ++++++- mozilla/parser/htmlparser/src/SelfTest.cpp | 6 ++++++ mozilla/parser/htmlparser/src/nsScanner.cpp | 8 +++---- .../htmlparser/tests/windows/Selftest.cpp | 7 ++++++- 7 files changed, 53 insertions(+), 10 deletions(-) diff --git a/mozilla/configure.in b/mozilla/configure.in index c89255a6205..a8b5e51c5e8 100644 --- a/mozilla/configure.in +++ b/mozilla/configure.in @@ -235,6 +235,27 @@ else AC_MSG_RESULT(no) fi +dnl Checks for c++ features +dnl Is there a way to make AC_TRY_COMPILE use CXX instead of CC? +_SAVE_CC=$CC +CC=$CXX +AC_MSG_CHECKING(for ios::binary) +AC_CACHE_VAL(ac_cv_ios_binary, + [AC_TRY_COMPILE([#include ], + [char *buffer = "config.log"; + fstream *mFileStream=new fstream(buffer, ios::binary);], + [ac_ios_binary=true], + [ac_ios_binary=false]) + ac_cv_ios_binary=$ac_ios_binary]) +ac_syserrlist=$ac_cv_ios_binary +if test $ac_ios_binary = true ; then + AC_DEFINE(HAVE_IOS_BINARY) + AC_MSG_RESULT(yes) +else + AC_MSG_RESULT(no) +fi +CC=$_SAVE_CC + dnl Checks for libraries. dnl ======================================================== AC_CHECK_LIB(c_r, gethostbyname_r) diff --git a/mozilla/htmlparser/src/SelfTest.cpp b/mozilla/htmlparser/src/SelfTest.cpp index 5bd5948d84c..c7a8cd358ec 100644 --- a/mozilla/htmlparser/src/SelfTest.cpp +++ b/mozilla/htmlparser/src/SelfTest.cpp @@ -45,8 +45,14 @@ PRBool compareFiles(const char* file1,const char* file2,int& failpos) { char ch1,ch2; int eof1,eof2; +#if defined(HAVE_IOS_BINARY) || !defined(XP_UNIX) + /* HAVE_IOS_BINARY needs to be set for mac & win */ ifstream input1(file1,ios::in && ios::binary,filebuf::openprot); ifstream input2(file2,ios::in && ios::binary,filebuf::openprot); +#else + ifstream input1(file1,ios::in && ios::bin,filebuf::openprot); + ifstream input2(file2,ios::in && ios::bin,filebuf::openprot); +#endif input1.setmode(filebuf::binary); input2.setmode(filebuf::binary); failpos=-1; diff --git a/mozilla/htmlparser/src/nsScanner.cpp b/mozilla/htmlparser/src/nsScanner.cpp index b3fc55b97b8..9e7ddb3bb17 100644 --- a/mozilla/htmlparser/src/nsScanner.cpp +++ b/mozilla/htmlparser/src/nsScanner.cpp @@ -72,11 +72,11 @@ CScanner::CScanner(nsString& aFilename,PRBool aCreateStream) : if(aCreateStream) { char buffer[513]; aFilename.ToCString(buffer,sizeof(buffer)-1); - #if defined(XP_UNIX) && (defined(IRIX) || defined(MKLINUX)) - /* XXX: IRIX does not support ios::binary */ - mFileStream=new fstream(buffer,ios::in); - #else + #if defined(HAVE_IOS_BINARY) || !defined(XP_UNIX) + /* XXX: HAVE_IOS_BINARY needs to be set for mac & win */ mFileStream=new fstream(buffer,ios::in|ios::binary); + #else + mFileStream=new fstream(buffer,ios::in|ios::bin); #endif } //if } diff --git a/mozilla/htmlparser/tests/windows/Selftest.cpp b/mozilla/htmlparser/tests/windows/Selftest.cpp index 0660fc576ba..4bce01ffc3a 100644 --- a/mozilla/htmlparser/tests/windows/Selftest.cpp +++ b/mozilla/htmlparser/tests/windows/Selftest.cpp @@ -34,9 +34,14 @@ bool compareFiles(const char* file1,const char* file2) { char ch1,ch2; int eof1,eof2; +#if defined(HAVE_IOS_BINARY) || !defined(XP_UNIX) + /* XXX: HAVE_IOS_BINARY needs to be set for mac & win */ ifstream input1(file1,ios::in && ios::binary,filebuf::openprot); ifstream input2(file2,ios::in && ios::binary,filebuf::openprot); - +#else + ifstream input1(file1,ios::in && ios::bin,filebuf::openprot); + ifstream input2(file2,ios::in && ios::bin,filebuf::openprot); +#endif while(!done) { while(!(eof1=input1.eof())) { diff --git a/mozilla/parser/htmlparser/src/SelfTest.cpp b/mozilla/parser/htmlparser/src/SelfTest.cpp index 5bd5948d84c..c7a8cd358ec 100644 --- a/mozilla/parser/htmlparser/src/SelfTest.cpp +++ b/mozilla/parser/htmlparser/src/SelfTest.cpp @@ -45,8 +45,14 @@ PRBool compareFiles(const char* file1,const char* file2,int& failpos) { char ch1,ch2; int eof1,eof2; +#if defined(HAVE_IOS_BINARY) || !defined(XP_UNIX) + /* HAVE_IOS_BINARY needs to be set for mac & win */ ifstream input1(file1,ios::in && ios::binary,filebuf::openprot); ifstream input2(file2,ios::in && ios::binary,filebuf::openprot); +#else + ifstream input1(file1,ios::in && ios::bin,filebuf::openprot); + ifstream input2(file2,ios::in && ios::bin,filebuf::openprot); +#endif input1.setmode(filebuf::binary); input2.setmode(filebuf::binary); failpos=-1; diff --git a/mozilla/parser/htmlparser/src/nsScanner.cpp b/mozilla/parser/htmlparser/src/nsScanner.cpp index b3fc55b97b8..9e7ddb3bb17 100644 --- a/mozilla/parser/htmlparser/src/nsScanner.cpp +++ b/mozilla/parser/htmlparser/src/nsScanner.cpp @@ -72,11 +72,11 @@ CScanner::CScanner(nsString& aFilename,PRBool aCreateStream) : if(aCreateStream) { char buffer[513]; aFilename.ToCString(buffer,sizeof(buffer)-1); - #if defined(XP_UNIX) && (defined(IRIX) || defined(MKLINUX)) - /* XXX: IRIX does not support ios::binary */ - mFileStream=new fstream(buffer,ios::in); - #else + #if defined(HAVE_IOS_BINARY) || !defined(XP_UNIX) + /* XXX: HAVE_IOS_BINARY needs to be set for mac & win */ mFileStream=new fstream(buffer,ios::in|ios::binary); + #else + mFileStream=new fstream(buffer,ios::in|ios::bin); #endif } //if } diff --git a/mozilla/parser/htmlparser/tests/windows/Selftest.cpp b/mozilla/parser/htmlparser/tests/windows/Selftest.cpp index 0660fc576ba..4bce01ffc3a 100644 --- a/mozilla/parser/htmlparser/tests/windows/Selftest.cpp +++ b/mozilla/parser/htmlparser/tests/windows/Selftest.cpp @@ -34,9 +34,14 @@ bool compareFiles(const char* file1,const char* file2) { char ch1,ch2; int eof1,eof2; +#if defined(HAVE_IOS_BINARY) || !defined(XP_UNIX) + /* XXX: HAVE_IOS_BINARY needs to be set for mac & win */ ifstream input1(file1,ios::in && ios::binary,filebuf::openprot); ifstream input2(file2,ios::in && ios::binary,filebuf::openprot); - +#else + ifstream input1(file1,ios::in && ios::bin,filebuf::openprot); + ifstream input2(file2,ios::in && ios::bin,filebuf::openprot); +#endif while(!done) { while(!(eof1=input1.eof())) {