Browse Source

dtoolutil: Remove HAVE_OPEN_MASK

Rationale:
1. Per standard, fstream::open takes 2 arguments.
   If platforms add a third, they're out of spec.
2. The only platform I could find that takes a file
   mask specifically as the third argument is IRIX,
   which Panda hasn't targeted in forever.
3. The mask being requested isn't even particularly
   interesting - falling back to a platform default
   is best.
4. When USE_PANDAFILESTREAM is defined, pfstream
   is implemented as PandaFileStream, which doesn't
   have a three-argument open() and breaks immediately.
5. makepanda doesn't ever define HAVE_OPEN_MASK
6. It's been broken for so long that, if it were
   important to anybody, it would have been fixed by now.
Sam Edwards 7 years ago
parent
commit
1c6ae84cdc
2 changed files with 4 additions and 41 deletions
  1. 4 40
      dtool/src/dtoolutil/filename.cxx
  2. 0 1
      makepanda/makepanda.py

+ 4 - 40
dtool/src/dtoolutil/filename.cxx

@@ -1921,15 +1921,10 @@ open_write(ofstream &stream, bool truncate) const {
   stream.clear();
 #ifdef WIN32_VC
   wstring os_specific = to_os_specific_w();
-  stream.open(os_specific.c_str(), open_mode);
 #else
   string os_specific = to_os_specific();
-#ifdef HAVE_OPEN_MASK
-  stream.open(os_specific.c_str(), open_mode, 0666);
-#else
-  stream.open(os_specific.c_str(), open_mode);
-#endif
 #endif  // WIN32_VC
+  stream.open(os_specific.c_str(), open_mode);
 
   return (!stream.fail());
 }
@@ -1958,15 +1953,10 @@ open_append(ofstream &stream) const {
   stream.clear();
 #ifdef WIN32_VC
   wstring os_specific = to_os_specific_w();
-  stream.open(os_specific.c_str(), open_mode);
 #else
   string os_specific = to_os_specific();
-#ifdef HAVE_OPEN_MASK
-  stream.open(os_specific.c_str(), open_mode, 0666);
-#else
-  stream.open(os_specific.c_str(), open_mode);
-#endif
 #endif  // WIN32_VC
+  stream.open(os_specific.c_str(), open_mode);
 
   return (!stream.fail());
 }
@@ -2005,15 +1995,10 @@ open_read_write(fstream &stream, bool truncate) const {
   stream.clear();
 #ifdef WIN32_VC
   wstring os_specific = to_os_specific_w();
-  stream.open(os_specific.c_str(), open_mode);
 #else
   string os_specific = to_os_specific();
-#ifdef HAVE_OPEN_MASK
-  stream.open(os_specific.c_str(), open_mode, 0666);
-#else
-  stream.open(os_specific.c_str(), open_mode);
-#endif
 #endif  // WIN32_VC
+  stream.open(os_specific.c_str(), open_mode);
 
   return (!stream.fail());
 }
@@ -2042,15 +2027,10 @@ open_read_append(fstream &stream) const {
   stream.clear();
 #ifdef WIN32_VC
   wstring os_specific = to_os_specific_w();
-  stream.open(os_specific.c_str(), open_mode);
 #else
   string os_specific = to_os_specific();
-#ifdef HAVE_OPEN_MASK
-  stream.open(os_specific.c_str(), open_mode, 0666);
-#else
-  stream.open(os_specific.c_str(), open_mode);
-#endif
 #endif  // WIN32_VC
+  stream.open(os_specific.c_str(), open_mode);
 
   return (!stream.fail());
 }
@@ -2125,11 +2105,7 @@ open_write(pofstream &stream, bool truncate) const {
 
   stream.clear();
   string os_specific = to_os_specific();
-#ifdef HAVE_OPEN_MASK
-  stream.open(os_specific.c_str(), open_mode, 0666);
-#else
   stream.open(os_specific.c_str(), open_mode);
-#endif
 
   return (!stream.fail());
 }
@@ -2159,11 +2135,7 @@ open_append(pofstream &stream) const {
 
   stream.clear();
   string os_specific = to_os_specific();
-#ifdef HAVE_OPEN_MASK
-  stream.open(os_specific.c_str(), open_mode, 0666);
-#else
   stream.open(os_specific.c_str(), open_mode);
-#endif
 
   return (!stream.fail());
 }
@@ -2203,11 +2175,7 @@ open_read_write(pfstream &stream, bool truncate) const {
 
   stream.clear();
   string os_specific = to_os_specific();
-#ifdef HAVE_OPEN_MASK
-  stream.open(os_specific.c_str(), open_mode, 0666);
-#else
   stream.open(os_specific.c_str(), open_mode);
-#endif
 
   return (!stream.fail());
 }
@@ -2237,11 +2205,7 @@ open_read_append(pfstream &stream) const {
 
   stream.clear();
   string os_specific = to_os_specific();
-#ifdef HAVE_OPEN_MASK
-  stream.open(os_specific.c_str(), open_mode, 0666);
-#else
   stream.open(os_specific.c_str(), open_mode);
-#endif
 
   return (!stream.fail());
 }

+ 0 - 1
makepanda/makepanda.py

@@ -2270,7 +2270,6 @@ DTOOL_CONFIG=[
     ("DO_PIPELINING",                  '1',                      '1'),
     ("DEFAULT_PATHSEP",                '";"',                    '":"'),
     ("WORDS_BIGENDIAN",                'UNDEF',                  'UNDEF'),
-    ("HAVE_OPEN_MASK",                 'UNDEF',                  'UNDEF'),
     ("PHAVE_LOCKF",                    '1',                      '1'),
     ("HAVE_WCHAR_T",                   '1',                      '1'),
     ("HAVE_WSTRING",                   '1',                      '1'),