Browse Source

build for gcc3.2

David Rose 23 years ago
parent
commit
411a263fe8
80 changed files with 381 additions and 1668 deletions
  1. 4 0
      dtool/Config.Irix.pp
  2. 7 3
      dtool/Config.Linux.pp
  3. 4 0
      dtool/Config.Win32.pp
  4. 3 0
      dtool/LocalSetup.pp
  5. 9 3
      dtool/pptempl/Depends.pp
  6. 5 5
      dtool/src/dconfig/notify.cxx
  7. 2 2
      dtool/src/dconfig/notify.h
  8. 1 0
      dtool/src/dtoolbase/pdeque.h
  9. 5 5
      dtool/src/dtoolbase/plist.h
  10. 2 0
      dtool/src/dtoolbase/pvector.h
  11. 13 13
      dtool/src/dtoolutil/filename.cxx
  12. 11 12
      dtool/src/dtoolutil/pfstreamBuf.cxx
  13. 1 1
      dtool/src/interrogatedb/interrogate_datafile.I
  14. 3 0
      dtool/src/parser-inc/iostream
  15. 1 1
      panda/src/builder/builderFuncs.I
  16. 1 1
      panda/src/builder/builderPrimTempl.I
  17. 3 1
      panda/src/builder/builderProperties.h
  18. 2 2
      panda/src/builder/mesherEdge.I
  19. 8 8
      panda/src/builder/mesherFanMaker.I
  20. 37 37
      panda/src/builder/mesherStrip.I
  21. 26 19
      panda/src/builder/mesherTempl.I
  22. 2 0
      panda/src/chan/animChannelFixed.h
  23. 1 1
      panda/src/chan/animChannelMatrixXfmTable.I
  24. 1 1
      panda/src/chan/animChannelScalarTable.I
  25. 1 1
      panda/src/chan/animControl.cxx
  26. 1 1
      panda/src/chan/auto_bind.cxx
  27. 2 2
      panda/src/char/computedVertices.cxx
  28. 1 1
      panda/src/display/graphicsWindow.cxx
  29. 2 3
      panda/src/downloader/Sources.pp
  30. 3 3
      panda/src/downloader/bioStream.I
  31. 1 4
      panda/src/downloader/bioStreamBuf.cxx
  32. 1 1
      panda/src/downloader/chunkedStream.I
  33. 1 4
      panda/src/downloader/chunkedStreamBuf.cxx
  34. 1 1
      panda/src/downloader/downloadDb.cxx
  35. 0 168
      panda/src/downloader/downloader.I
  36. 0 1096
      panda/src/downloader/downloader.cxx
  37. 0 157
      panda/src/downloader/downloader.h
  38. 0 1
      panda/src/downloader/downloader_composite3.cxx
  39. 1 1
      panda/src/downloader/identityStream.I
  40. 1 4
      panda/src/downloader/identityStreamBuf.cxx
  41. 6 4
      panda/src/downloader/multiplexStreamBuf.cxx
  42. 1 1
      panda/src/egg/eggGroup.I
  43. 1 1
      panda/src/egg/eggMorphList.I
  44. 3 7
      panda/src/egg/eggNamedObject.h
  45. 5 5
      panda/src/egg/eggNode.I
  46. 2 6
      panda/src/egg/eggObject.h
  47. 7 7
      panda/src/egg/parser.yxx
  48. 1 1
      panda/src/egg2pg/computedVerticesMakerEntity.I
  49. 7 2
      panda/src/egg2pg/eggLoader.cxx
  50. 1 1
      panda/src/express/multifile.cxx
  51. 54 0
      panda/src/express/pointerTo.I
  52. 11 2
      panda/src/express/pointerTo.h
  53. 24 2
      panda/src/express/pointerToArray.I
  54. 3 1
      panda/src/express/pointerToArray.h
  55. 1 1
      panda/src/express/profileTimer.h
  56. 1 1
      panda/src/express/subStream.I
  57. 18 17
      panda/src/express/subStreamBuf.cxx
  58. 4 3
      panda/src/express/subStreamBuf.h
  59. 2 1
      panda/src/express/thread.h
  60. 2 2
      panda/src/express/tokenBoard.I
  61. 2 2
      panda/src/express/virtualFile.cxx
  62. 2 2
      panda/src/express/zStream.I
  63. 1 4
      panda/src/express/zStreamBuf.cxx
  64. 1 1
      panda/src/gobj/geom.cxx
  65. 5 2
      panda/src/gobj/geomLine.cxx
  66. 5 2
      panda/src/gobj/geomLinestrip.cxx
  67. 5 2
      panda/src/gobj/geomPoint.cxx
  68. 1 1
      panda/src/gobj/texture.h
  69. 1 1
      panda/src/pgraph/lensNode.cxx
  70. 1 1
      panda/src/pgraph/loader.cxx
  71. 1 1
      panda/src/pgraph/nodePath.h
  72. 2 2
      panda/src/physics/linearNoiseForce.I
  73. 1 0
      panda/src/physics/linearNoiseForce.h
  74. 3 0
      panda/src/putil/Sources.pp
  75. 3 11
      panda/src/putil/lineStreamBuf.I
  76. 17 0
      panda/src/putil/lineStreamBuf.cxx
  77. 1 1
      panda/src/putil/lineStreamBuf.h
  78. 2 2
      panda/src/testbed/pgrid.cxx
  79. 2 2
      panda/src/text/textFont.h
  80. 3 3
      panda/src/tform/mouseWatcher.cxx

+ 4 - 0
dtool/Config.Irix.pp

@@ -74,6 +74,10 @@
 // Do we have a true stringstream class defined in <sstream>?
 #define HAVE_SSTREAM
 
+// Does fstream::open() require a third parameter, specifying the
+// umask?
+#define HAVE_OPEN_MASK 1
+
 // Do we have <new>?
 #define HAVE_NEW
 

+ 7 - 3
dtool/Config.Linux.pp

@@ -7,7 +7,7 @@
 //
 
 // What additional flags should we pass to interrogate?
-#define SYSTEM_IGATE_FLAGS -D__i386__
+#define SYSTEM_IGATE_FLAGS -D__i386__ -D__const=const
 
 // Is the platform big-endian (like an SGI workstation) or
 // little-endian (like a PC)?  Define this to the empty string to
@@ -69,10 +69,14 @@
 // Should we include <iostream> or <iostream.h>?  Define HAVE_IOSTREAM
 // to nonempty if we should use <iostream>, or empty if we should use
 // <iostream.h>.
-#define HAVE_IOSTREAM
+#define HAVE_IOSTREAM 1
 
 // Do we have a true stringstream class defined in <sstream>?
-#define HAVE_SSTREAM
+#define HAVE_SSTREAM 1
+
+// Does fstream::open() require a third parameter, specifying the
+// umask?  Versions of gcc prior to 3.2 had this.
+#define HAVE_OPEN_MASK
 
 // Do we have <new>?
 #define HAVE_NEW 1

+ 4 - 0
dtool/Config.Win32.pp

@@ -74,6 +74,10 @@
 // Do we have a true stringstream class defined in <sstream>?
 #define HAVE_SSTREAM 1
 
+// Does fstream::open() require a third parameter, specifying the
+// umask?
+#define HAVE_OPEN_MASK
+
 // Do we have <new>?
 #define HAVE_NEW 1
 

+ 3 - 0
dtool/LocalSetup.pp

@@ -137,6 +137,9 @@ $[cdefine HAVE_NAMESPACE]
 /* Define if the C++ iostream library supports ios::binary.  */
 $[cdefine HAVE_IOS_BINARY]
 
+/* Define if fstream::open() accepts a third parameter for umask. */
+$[cdefine HAVE_OPEN_MASK]
+
 /* Define if the C++ compiler supports the typename keyword.  */
 $[cdefine HAVE_TYPENAME]
 

+ 9 - 3
dtool/pptempl/Depends.pp

@@ -37,9 +37,15 @@
   // $[compile_sources] from the different directories.
   #define composite_list
   // Tag all the static libraries by defining the "lib_is_static" variable.
-  #forscopes static_lib_target ss_lib_target
-    #define lib_is_static 1
-  #end static_lib_target ss_lib_target
+  #if $[WINDOWS_PLATFORM]
+    #forscopes static_lib_target ss_lib_target
+      #define lib_is_static 1
+    #end static_lib_target ss_lib_target
+  #else
+    #forscopes static_lib_target
+      #define lib_is_static 1
+    #end static_lib_target
+  #endif
 
   #forscopes metalib_target lib_target noinst_lib_target test_lib_target static_lib_target ss_lib_target bin_target noinst_bin_target test_bin_target
     // We can optimize quite a bit by evaluating now several of the key

+ 5 - 5
dtool/src/dconfig/notify.cxx

@@ -109,18 +109,18 @@ get_ostream_ptr() const {
 //               case this does nothing.  But the flag is available in
 //               case any extended types want to make use of it.
 ////////////////////////////////////////////////////////////////////
-long Notify::
+ios::fmtflags Notify::
 get_literal_flag() {
   static bool got_flag = false;
-  static long flag;
+  static ios::fmtflags flag;
 
   if (!got_flag) {
-#ifndef WIN32_VC
+#ifndef HAVE_IOSTREAM
     flag = ios::bitalloc();
 #else
     // We lost bitalloc in the new iostream?  This feature will just be
-    // disabled in Windows for now.  No big deal.
-    flag = 0;
+    // disabled for now.  No big deal.
+    flag = (ios::fmtflags)0;
 #endif
     got_flag = true;
   }

+ 2 - 2
dtool/src/dconfig/notify.h

@@ -19,7 +19,7 @@
 #ifndef NOTIFY_H
 #define NOTIFY_H
 
-#include <dtoolbase.h>
+#include "dtoolbase.h"
 
 #include "notifyCategory.h"
 #include "notifySeverity.h"
@@ -75,7 +75,7 @@ PUBLISHED:
   static Notify *ptr();
 
 public:
-  static long get_literal_flag();
+  static ios::fmtflags get_literal_flag();
 
   bool assert_failure(const char *expression, int line,
                       const char *source_file);

+ 1 - 0
dtool/src/dtoolbase/pdeque.h

@@ -40,6 +40,7 @@
 template<class Type>
 class pdeque : public deque<Type, pallocator<Type> > {
 public:
+  typedef TYPENAME deque<Type, pallocator<Type> >::size_type size_type;
   pdeque() : deque<Type, pallocator<Type> >() { }
   pdeque(const pdeque<Type> &copy) : deque<Type, pallocator<Type> >(copy) { }
   pdeque(size_type n) : deque<Type, pallocator<Type> >(n) { }

+ 5 - 5
dtool/src/dtoolbase/plist.h

@@ -40,16 +40,16 @@
 template<class Type>
 class plist : public list<Type, pallocator<Type> > {
 public:
+  typedef TYPENAME list<Type, pallocator<Type> >::size_type size_type;
   plist() : list<Type, pallocator<Type> >() { }
   plist(const plist<Type> &copy) : list<Type, pallocator<Type> >(copy) { }
   plist(size_type n) : list<Type, pallocator<Type> >(n) { }
   plist(size_type n, const Type &value) : list<Type, pallocator<Type> >(n, value) { }
 
-  // VC++ doesn't seem to inherit these properly.
-  typedef list<Type, pallocator<Type> >::iterator iterator;
-  typedef list<Type, pallocator<Type> >::const_iterator const_iterator;
-  typedef list<Type, pallocator<Type> >::reverse_iterator reverse_iterator;
-  typedef list<Type, pallocator<Type> >::const_reverse_iterator const_reverse_iterator;
+  typedef TYPENAME list<Type, pallocator<Type> >::iterator iterator;
+  typedef TYPENAME list<Type, pallocator<Type> >::const_iterator const_iterator;
+  typedef TYPENAME list<Type, pallocator<Type> >::reverse_iterator reverse_iterator;
+  typedef TYPENAME list<Type, pallocator<Type> >::const_reverse_iterator const_reverse_iterator;
 };
 
 #endif  // NO_STYLE_ALLOCATOR

+ 2 - 0
dtool/src/dtoolbase/pvector.h

@@ -41,6 +41,8 @@
 template<class Type>
 class pvector : public vector<Type, pallocator<Type> > {
 public:
+  typedef TYPENAME vector<Type, pallocator<Type> >::size_type size_type;
+
   pvector() : vector<Type, pallocator<Type> >() { }
   pvector(const pvector<Type> &copy) : vector<Type, pallocator<Type> >(copy) { }
   pvector(size_type n) : vector<Type, pallocator<Type> >(n) { }

+ 13 - 13
dtool/src/dtoolutil/filename.cxx

@@ -1171,7 +1171,7 @@ bool Filename::
 open_read(ifstream &stream) const {
   assert(is_text() || is_binary());
 
-  int open_mode = ios::in;
+  ios::openmode open_mode = ios::in;
 
 #ifdef HAVE_IOS_BINARY
   // For some reason, some systems (like Irix) don't define
@@ -1206,7 +1206,7 @@ bool Filename::
 open_write(ofstream &stream, bool truncate) const {
   assert(is_text() || is_binary());
 
-  int open_mode = ios::out;
+  ios::openmode open_mode = ios::out;
 
   if (truncate) {
     open_mode |= ios::trunc;
@@ -1232,10 +1232,10 @@ open_write(ofstream &stream, bool truncate) const {
 
   stream.clear();
   string os_specific = to_os_specific();
-#ifdef WIN32_VC
-  stream.open(os_specific.c_str(), open_mode);
-#else
+#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());
@@ -1256,7 +1256,7 @@ bool Filename::
 open_append(ofstream &stream) const {
   assert(is_text() || is_binary());
 
-  int open_mode = ios::app;
+  ios::openmode open_mode = ios::app;
 
 #ifdef HAVE_IOS_BINARY
   // For some reason, some systems (like Irix) don't define
@@ -1268,10 +1268,10 @@ open_append(ofstream &stream) const {
 
   stream.clear();
   string os_specific = to_os_specific();
-#ifdef WIN32_VC
-  stream.open(os_specific.c_str(), open_mode);
-#else
+#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());
@@ -1292,7 +1292,7 @@ bool Filename::
 open_read_write(fstream &stream) const {
   assert(is_text() || is_binary());
 
-  int open_mode = ios::in | ios::out;
+  ios::openmode open_mode = ios::in | ios::out;
 
 #ifdef HAVE_IOS_BINARY
   // For some reason, some systems (like Irix) don't define
@@ -1304,10 +1304,10 @@ open_read_write(fstream &stream) const {
 
   stream.clear();
   string os_specific = to_os_specific();
-#ifdef WIN32_VC
-  stream.open(os_specific.c_str(), open_mode);
-#else
+#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());

+ 11 - 12
dtool/src/dtoolutil/pfstreamBuf.cxx

@@ -29,10 +29,9 @@ PipeStreamBuf::PipeStreamBuf(PipeStreamBuf::Direction dir) :
 {
   init_pipe();
 
-#ifndef WIN32_VC
-  // taken from Dr. Ose.
-  // These lines, which are essential on Irix and Linux, seem to be
-  // unnecessary and not understood on Windows.
+#ifndef HAVE_IOSTREAM
+  // These lines, which are essential on older implementations of the
+  // iostream library, are not understood by more recent versions.
   allocate();
   assert((dir == Input) || (dir == Output));
   if (dir == Input) {
@@ -40,7 +39,7 @@ PipeStreamBuf::PipeStreamBuf(PipeStreamBuf::Direction dir) :
   } else {
     setp(base(), ebuf());
   }
-#endif /* WIN32_VC */
+#endif /* HAVE_IOSTREAM */
 }
 
 PipeStreamBuf::
@@ -102,7 +101,7 @@ int PipeStreamBuf::underflow(void) {
   assert(_dir == Input);
   if ((eback() == (char*)0L) || (gptr() == (char*)0L) ||
       (egptr() == (char*)0L)) {
-    // must be in win32
+    // must be new-style iostream library
     char* buf = new char[4096];
     char* ebuf = &(buf[4096]);
     setg(buf, ebuf, ebuf);
@@ -114,22 +113,22 @@ int PipeStreamBuf::underflow(void) {
   if (eof_pipe()) {
     return EOF;
   }
-#ifdef WIN32_VC
+#ifdef HAVE_IOSTREAM
   size_t len = 4096;
-#else /* WIN32_VC */
+#else /* HAVE_IOSTREAM */
   size_t len = ebuf() - base();
-#endif /* WIN32_VC */
+#endif /* HAVE_IOSTREAM */
   char* buf = new char[len];
   size_t n = read_pipe(buf, len);
   int ret = buf[0];
   if (n == 0)
     ret = EOF;
   else {
-#ifdef WIN32_VC
+#ifdef HAVE_IOSTREAM
     memcpy(eback()+(len-n), buf, n);
-#else /* WIN32_VC */
+#else /* HAVE_IOSTREAM */
     memcpy(base()+(len-n), buf, n);
-#endif /* WIN32_VC */
+#endif /* HAVE_IOSTREAM */
     gbump(-((int)n));
   }
   delete buf;

+ 1 - 1
dtool/src/interrogatedb/interrogate_datafile.I

@@ -27,7 +27,7 @@ template<class Element>
 void
 idf_output_vector(ostream &out, const vector<Element> &vec) {
   out << vec.size() << " ";
-  vector<Element>::const_iterator vi;
+  TYPENAME vector<Element>::const_iterator vi;
   for (vi = vec.begin(); vi != vec.end(); ++vi) {
     out << (*vi) << " ";
   }

+ 3 - 0
dtool/src/parser-inc/iostream

@@ -29,6 +29,9 @@
 
 // We need to expose one method in each class to force it to publish.
 // We should fix that sometime.
+class ios {
+  typedef long fmtflags;
+};
 class ostream {
 __published:
   void put(char c);

+ 1 - 1
panda/src/builder/builderFuncs.I

@@ -838,7 +838,7 @@ __mesh_and_build(InputIterator first, InputIterator last,
 
   int count = 0;
   if (!prims.empty()) {
-    Prims::iterator pi, last_pi;
+    TYPENAME Prims::iterator pi, last_pi;
     pi = prims.begin();
     last_pi = pi;
     for (++pi; pi != prims.end(); ++pi) {

+ 1 - 1
panda/src/builder/builderPrimTempl.I

@@ -754,7 +754,7 @@ remove_doubled_verts(int closed) {
   // 'sc' used without having been initialized" warning messages.
   SameCoord<Vertex> sc = SameCoord<Vertex>();
 
-  Verts::iterator new_end = unique(_verts.begin(), _verts.end(), sc);
+  TYPENAME Verts::iterator new_end = unique(_verts.begin(), _verts.end(), sc);
   _verts.erase(new_end, _verts.end());
 
   if (closed) {

+ 3 - 1
panda/src/builder/builderProperties.h

@@ -22,7 +22,9 @@
 
 #include "builderTypes.h"
 
-#ifndef WIN32_VC
+#ifndef HAVE_IOSTREAM
+// We assume if your C++ library defines <iostream.h>, then it also
+// defines <stl_config.h>.
 #include <stl_config.h>
 #endif
 

+ 2 - 2
panda/src/builder/mesherEdge.I

@@ -114,7 +114,7 @@ remove(Strip *strip) {
 template <class PrimType>
 void MesherEdge<PrimType>::
 change_strip(Strip *from, Strip *to) {
-  Strips::iterator si;
+  TYPENAME Strips::iterator si;
 
   for (si = _strips.begin(); si != _strips.end(); ++si) {
     if (*si == from) {
@@ -142,7 +142,7 @@ output(ostream &out) const {
   out << "Edge [" << *_a << " to " << *_b << "], "
       << _strips.size() << " strips:";
 
-  Strips::const_iterator si;
+  TYPENAME Strips::const_iterator si;
   for (si = _strips.begin(); si != _strips.end(); ++si) {
     out << " " << (*si)->_index;
   }

+ 8 - 8
panda/src/builder/mesherFanMaker.I

@@ -134,7 +134,7 @@ compute_angle() const {
   double angle = 0.0;
   Vertexf v0 = _vertex->get_coord_value(*_bucket);
 
-  Edges::const_iterator ei;
+  TYPENAME Edges::const_iterator ei;
   for (ei = _edges.begin(); ei != _edges.end(); ++ei) {
     Normalf v1 = (*ei)->_a->get_coord_value(*_bucket) - v0;
     Normalf v2 = (*ei)->_b->get_coord_value(*_bucket) - v0;
@@ -179,8 +179,8 @@ build(pvector<Prim> &unrolled_tris) {
     // noncoplanar or which do not share identical properties.  Then
     // we can send each piece between the seams to unroll().
 
-    Strips::iterator si, last_si;
-    Edges::iterator ei, last_ei;
+    TYPENAME Strips::iterator si, last_si;
+    TYPENAME Edges::iterator ei, last_ei;
 
     // First, rotate the fan so it begins at a seam.  We do this so we
     // won't be left out with part of one piece at the beginning and
@@ -230,12 +230,12 @@ build(pvector<Prim> &unrolled_tris) {
     new_fan._verts.push_back(_vertex);
 
     new_fan._verts.push_back(_edges.front()->_a);
-    Edges::iterator ei;
+    TYPENAME Edges::iterator ei;
     for (ei = _edges.begin(); ei != _edges.end(); ++ei) {
       new_fan._verts.push_back((*ei)->_b);
     }
 
-    Strips::iterator si;
+    TYPENAME Strips::iterator si;
     for (si = _strips.begin(); si != _strips.end(); ++si) {
       new_fan._prims.splice(new_fan._prims.end(), (*si)->_prims);
       (*si)->remove_all_edges();
@@ -263,8 +263,8 @@ int MesherFanMaker<PrimType>::
 unroll(TYPENAME Strips::iterator strip_begin, TYPENAME Strips::iterator strip_end,
        TYPENAME Edges::iterator edge_begin, TYPENAME Edges::iterator edge_end,
        pvector<Prim> &unrolled_tris) {
-  Edges::iterator ei;
-  Strips::iterator si;
+  TYPENAME Edges::iterator ei;
+  TYPENAME Strips::iterator si;
 
   int num_tris = 0;
   for (ei = edge_begin; ei != edge_end; ++ei) {
@@ -340,7 +340,7 @@ ostream &MesherFanMaker<PrimType>::
 output(ostream &out) const {
   out << *_vertex << ":[";
   if (!_edges.empty()) {
-    Edges::const_iterator ei;
+    TYPENAME Edges::const_iterator ei;
     for (ei = _edges.begin(); ei != _edges.end(); ++ei) {
       out << " " << *(*ei)->_a;
     }

+ 37 - 37
panda/src/builder/mesherStrip.I

@@ -130,7 +130,7 @@ rotate_back() {
 template <class PrimType>
 INLINE TYPENAME MesherStrip<PrimType>::Edge MesherStrip<PrimType>::
 get_head_edge() const {
-  Verts::const_iterator vi = _verts.begin();
+  TYPENAME Verts::const_iterator vi = _verts.begin();
   return Edge(_verts.front(), *++vi);
 }
 
@@ -145,7 +145,7 @@ get_head_edge() const {
 template <class PrimType>
 INLINE TYPENAME MesherStrip<PrimType>::Edge MesherStrip<PrimType>::
 get_tail_edge() const {
-  Verts::const_reverse_iterator vi = _verts.rbegin();
+  TYPENAME Verts::const_reverse_iterator vi = _verts.rbegin();
   return Edge(*++vi, _verts.back());
 }
 
@@ -262,7 +262,7 @@ make_prim(const BuilderBucket &bucket) {
   if (dest_type != BPT_tristrip && dest_type != BPT_trifan) {
     // The easy case: a simple primitive.
     p.set_attrib(_prims.front());
-    Verts::iterator vi;
+    TYPENAME Verts::iterator vi;
     for (vi = _verts.begin(); vi != _verts.end(); ++vi) {
       const Vertex *v = *vi;
       nassertr(v != (Vertex *)NULL, p);
@@ -279,8 +279,8 @@ make_prim(const BuilderBucket &bucket) {
 
     // Now store all the vertices, as well as each individual
     // triangle's attributes.
-    Verts::iterator vi;
-    Prims::iterator pi;
+    TYPENAME Verts::iterator vi;
+    TYPENAME Prims::iterator pi;
     pi = _prims.begin();
     int count = 0;
     for (vi = _verts.begin();
@@ -342,8 +342,8 @@ measure_sheet(const Edge *edge, int new_row, int &num_prims, int &num_rows,
 
   _row_id = this_row_id;
 
-  Edges::iterator ei;
-  Edge::Strips::iterator si;
+  TYPENAME Edges::iterator ei;
+  TYPENAME Edge::Strips::iterator si;
 
   if (_type == BPT_quad) {
     // If this is a quad, it has four neighbors: two in the direction
@@ -395,7 +395,7 @@ measure_sheet(const Edge *edge, int new_row, int &num_prims, int &num_rows,
           // there will only be one besides ourselves, but there may be
           // more.  Pick the best.
 
-          Edge::Strips &strips = (*ei)->_strips;
+          TYPENAME Edge::Strips &strips = (*ei)->_strips;
           MesherStrip *mate = NULL;
           for (si = strips.begin(); si != strips.end(); ++si) {
             if ((*si)->_row_id < first_row_id) {
@@ -428,7 +428,7 @@ measure_sheet(const Edge *edge, int new_row, int &num_prims, int &num_rows,
       if (!(*ei)->matches(*edge)) {
         // Here's the edge.  Same drill as above.
 
-        Edge::Strips &strips = (*ei)->_strips;
+        TYPENAME Edge::Strips &strips = (*ei)->_strips;
         MesherStrip *mate = NULL;
         for (si = strips.begin(); si != strips.end(); ++si) {
           if ((*si)->_row_id < first_row_id) {
@@ -455,8 +455,8 @@ measure_sheet(const Edge *edge, int new_row, int &num_prims, int &num_rows,
 template <class PrimType>
 void MesherStrip<PrimType>::
 cut_sheet(int first_row_id, int do_mate, const BuilderBucket &bucket) {
-  Edges::iterator ei;
-  Edge::Strips::iterator si;
+  TYPENAME Edges::iterator ei;
+  TYPENAME Edge::Strips::iterator si;
 
   // First, start the process going on any neighbors that belong to a
   // later row.  (We must do these first, because we'll change our
@@ -470,7 +470,7 @@ cut_sheet(int first_row_id, int do_mate, const BuilderBucket &bucket) {
   StripPtrs strip_ptrs;
 
   for (ei = _edges.begin(); ei != _edges.end(); ++ei) {
-    Edge::Strips &strips = (*ei)->_strips;
+    TYPENAME Edge::Strips &strips = (*ei)->_strips;
     for (si = strips.begin(); si != strips.end(); ++si) {
       if ((*si)->_row_id > _row_id) {
         // Here's a different row in the sheet!
@@ -482,7 +482,7 @@ cut_sheet(int first_row_id, int do_mate, const BuilderBucket &bucket) {
   // Now walk the temporary list and do some damage.  We pass do_mate
   // = true to each of these neighbors, because as far as we know,
   // they're the first nodes of a particular row.
-  StripPtrs::iterator spi;
+  TYPENAME StripPtrs::iterator spi;
   for (spi = strip_ptrs.begin(); spi != strip_ptrs.end(); ++spi) {
     if ((*spi)->_status == MS_alive) {
       (*spi)->cut_sheet(first_row_id, true, bucket);
@@ -498,7 +498,7 @@ cut_sheet(int first_row_id, int do_mate, const BuilderBucket &bucket) {
 
       ei = _edges.begin();
       while (ei != _edges.end() && not_any) {
-        Edge::Strips &strips = (*ei)->_strips;
+        TYPENAME Edge::Strips &strips = (*ei)->_strips;
         si = strips.begin();
         while (si != strips.end() && not_any) {
           if (*si != this && (*si)->_row_id == _row_id) {
@@ -586,14 +586,14 @@ template <class PrimType>
 bool MesherStrip<PrimType>::
 find_ideal_mate(MesherStrip *&mate, Edge *&common_edge,
               const BuilderBucket &bucket) {
-  Edges::iterator ei;
+  TYPENAME Edges::iterator ei;
 
   mate = NULL;
   common_edge = NULL;
 
   for (ei = _edges.begin(); ei != _edges.end(); ++ei) {
-    Edge::Strips &strips = (*ei)->_strips;
-    Edge::Strips::iterator si;
+    TYPENAME Edge::Strips &strips = (*ei)->_strips;
+    TYPENAME Edge::Strips::iterator si;
     for (si = strips.begin(); si != strips.end(); ++si) {
       if (*si != this) {
         if (mate==NULL || pick_mate(**si, *mate, **ei, *common_edge,
@@ -649,8 +649,8 @@ mate_pieces(Edge *common_edge, MesherStrip &front, MesherStrip &back,
       // Now we just need to find the right place to insert it.  It
       // belongs in the middle of the common edge, i.e. after the first
       // vertex that is on the common edge and before the second vertex.
-      Verts::iterator a = front._verts.begin();
-      Verts::iterator b = a;
+      TYPENAME Verts::iterator a = front._verts.begin();
+      TYPENAME Verts::iterator b = a;
       ++b;
 
       if (common_edge->contains_vertex(*a)) {
@@ -1010,7 +1010,7 @@ template <class PrimType>
 int MesherStrip<PrimType>::
 count_neighbors() const {
   int count = 0;
-  Edges::const_iterator ei;
+  TYPENAME Edges::const_iterator ei;
 
   for (ei = _edges.begin(); ei != _edges.end(); ++ei) {
     count += (*ei)->_strips.size();
@@ -1026,8 +1026,8 @@ count_neighbors() const {
 template <class PrimType>
 ostream &MesherStrip<PrimType>::
 show_neighbors(ostream &out) const {
-  Edges::const_iterator ei;
-  Edge::Strips::const_iterator si;
+  TYPENAME Edges::const_iterator ei;
+  TYPENAME Edge::Strips::const_iterator si;
 
   for (ei = _edges.begin(); ei != _edges.end(); ++ei) {
     for (si = (*ei)->_strips.begin();
@@ -1051,7 +1051,7 @@ find_uncommon_vertex(const Edge *edge) const {
   const Vertex *a = edge->_a;
   const Vertex *b = edge->_b;
 
-  Edges::const_iterator ei;
+  TYPENAME Edges::const_iterator ei;
   for (ei = _edges.begin(); ei != _edges.end(); ++ei) {
     Edge *e = (*ei);
 
@@ -1075,7 +1075,7 @@ find_uncommon_vertex(const Edge *edge) const {
 template <class PrimType>
 const TYPENAME MesherStrip<PrimType>::Edge *MesherStrip<PrimType>::
 find_opposite_edge(const Vertex *vertex) const {
-  Edges::const_iterator ei;
+  TYPENAME Edges::const_iterator ei;
   for (ei = _edges.begin(); ei != _edges.end(); ++ei) {
     Edge *e = (*ei);
     if (!e->contains_vertex(vertex)) {
@@ -1099,7 +1099,7 @@ find_opposite_edge(const Edge *edge) const {
   const Vertex *a = edge->_a;
   const Vertex *b = edge->_b;
 
-  Edges::const_iterator ei;
+  TYPENAME Edges::const_iterator ei;
   for (ei = _edges.begin(); ei != _edges.end(); ++ei) {
     Edge *e = (*ei);
     if (!e->contains_vertex(a) && !e->contains_vertex(b)) {
@@ -1123,7 +1123,7 @@ find_adjacent_edge(const Edge *edge) const {
   const Vertex *a = edge->_a;
   const Vertex *b = edge->_b;
 
-  Edges::const_iterator ei;
+  TYPENAME Edges::const_iterator ei;
   for (ei = _edges.begin(); ei != _edges.end(); ++ei) {
     Edge *e = (*ei);
     if (e->contains_vertex(a) != e->contains_vertex(b)) {
@@ -1148,7 +1148,7 @@ rotate_to_front(const Edge *edge) {
 
   // See if we're already there.
   if (_verts.front() == a || _verts.front() == b) {
-    Verts::iterator vi = _verts.begin();
+    TYPENAME Verts::iterator vi = _verts.begin();
     ++vi;
     if (*vi == a || *vi == b) {
       // Yes!
@@ -1170,7 +1170,7 @@ rotate_to_front(const Edge *edge) {
   }
 
   // Now make sure the edge actually exists.
-  Verts::iterator vi = _verts.begin();
+  TYPENAME Verts::iterator vi = _verts.begin();
   ++vi;
   nassertv(*vi == a || *vi == b);
 }
@@ -1189,7 +1189,7 @@ rotate_to_back(const Edge *edge) {
 
   // See if we're already there.
   if (_verts.back() == a || _verts.back() == b) {
-    Verts::reverse_iterator vi = _verts.rbegin();
+    TYPENAME Verts::reverse_iterator vi = _verts.rbegin();
     ++vi;
     if (*vi == a || *vi == b) {
       // Yes!
@@ -1211,7 +1211,7 @@ rotate_to_back(const Edge *edge) {
   }
 
   // Now make sure the edge actually exists.
-  Verts::reverse_iterator vi = _verts.rbegin();
+  TYPENAME Verts::reverse_iterator vi = _verts.rbegin();
   ++vi;
   nassertv(*vi == a || *vi == b);
 }
@@ -1243,7 +1243,7 @@ invert() {
   if (!can_invert()) {
     return false;
   }
-  Verts::iterator vi, vi2;
+  TYPENAME Verts::iterator vi, vi2;
   vi = _verts.begin();
   while (vi != _verts.end()) {
     vi2 = vi;
@@ -1346,7 +1346,7 @@ would_reverse_tail(BuilderPrimType wantType) const {
 template <class PrimType>
 void MesherStrip<PrimType>::
 convert_to_type(BuilderPrimType wantType) {
-  Verts::iterator vi, vi2;
+  TYPENAME Verts::iterator vi, vi2;
   int even;
 
   if (_type==wantType) {
@@ -1418,7 +1418,7 @@ convert_to_type(BuilderPrimType wantType) {
 template <class PrimType>
 void MesherStrip<PrimType>::
 combine_edges(MesherStrip<PrimType> &other, int removeSides) {
-  Edges::iterator ei;
+  TYPENAME Edges::iterator ei;
   for (ei = other._edges.begin(); ei != other._edges.end(); ++ei) {
     (*ei)->change_strip(&other, this);
   }
@@ -1439,7 +1439,7 @@ combine_edges(MesherStrip<PrimType> &other, int removeSides) {
 
     Edges junk_edges;
 
-    Edges::iterator next_ei;
+    TYPENAME Edges::iterator next_ei;
     ei = _edges.begin();
     while (ei != _edges.end()) {
       next_ei = ei;
@@ -1479,7 +1479,7 @@ remove_all_edges() {
   junk_edges.splice(junk_edges.end(), _edges);
 
   // Now we can safely remove all the to-be-junked edges.
-  Edges::iterator ei;
+  TYPENAME Edges::iterator ei;
   for (ei = junk_edges.begin(); ei != junk_edges.end(); ++ei) {
     (*ei)->remove(this);
   }
@@ -1632,7 +1632,7 @@ output(ostream &out) const {
 
   out << " " << _index << " [";
 
-  Verts::const_iterator vi;
+  TYPENAME Verts::const_iterator vi;
   for (vi = _verts.begin(); vi != _verts.end(); vi++) {
     out << " " << **vi;
   }
@@ -1642,7 +1642,7 @@ output(ostream &out) const {
   show_neighbors(out);
 
   out << " edges";
-  Edges::const_iterator ei;
+  TYPENAME Edges::const_iterator ei;
   for (ei = _edges.begin(); ei != _edges.end(); ei++) {
     out << " " << (void *)(*ei);
   }

+ 26 - 19
panda/src/builder/mesherTempl.I

@@ -53,7 +53,7 @@ add_prim(const Prim &prim, MesherStripOrigin origin) {
 
   // Get the common vertex pointers for the primitive's vertices.
   for (i = 0; i < num_verts; i++) {
-    Verts::iterator n =
+    TYPENAME Verts::iterator n =
       _verts.insert(Verts::value_type(prim.get_vertex(i), EdgePtrs())).first;
     vptrs[i] = &(*n).first;
     eptrs[i] = &(*n).second;
@@ -117,11 +117,11 @@ mesh() {
 
   if (_bucket->_show_quads) {
     // If we're showing quads, we shouldn't do any more meshing.
-    Strips::iterator si;
+    TYPENAME Strips::iterator si;
     for (si = _quads.begin(); si != _quads.end(); ++si) {
       if ((*si)._status == MS_alive) {
         (*si)._status = MS_done;
-    }
+      }
     }
     for (si = _strips.begin(); si != _strips.end(); ++si) {
       if ((*si)._status == MS_alive) {
@@ -347,13 +347,13 @@ show(ostream &out) {
   */
 
   out << _verts.size() << " verts:\n";
-  Verts::const_iterator vi;
+  TYPENAME Verts::const_iterator vi;
 
   for (vi = _verts.begin(); vi != _verts.end(); ++vi) {
     const Vertex &v = (*vi).first;
     const EdgePtrs &edges = (*vi).second;
     out << v << " shares " << count_vert_edges(edges) << " edges:\n";
-    EdgePtrs::const_iterator ei;
+    TYPENAME EdgePtrs::const_iterator ei;
     for (ei = edges.begin(); ei != edges.end(); ++ei) {
       if (!(*ei)->_strips.empty() || !(*ei)->_opposite->_strips.empty()) {
         out << "  " << **ei << "\n";
@@ -361,14 +361,21 @@ show(ostream &out) {
     }
   }
 
+  TYPENAME Strips::const_iterator si;
   out << _tris.size() << " tris:\n";
-  copy(_tris.begin(), _tris.end(), ostream_iterator<Strip>(out, "\n"));
+  for (si = _tris.begin(); si != _tris.end(); ++si) {
+    out << (*si) << "\n";
+  }
 
   out << _quads.size() << " quads:\n";
-  copy(_quads.begin(), _quads.end(), ostream_iterator<Strip>(out, "\n"));
+  for (si = _quads.begin(); si != _quads.end(); ++si) {
+    out << (*si) << "\n";
+  }
 
   out << _strips.size() << " strips:\n";
-  copy(_strips.begin(), _strips.end(), ostream_iterator<Strip>(out, "\n"));
+  for (si = _strips.begin(); si != _strips.end(); ++si) {
+    out << (*si) << "\n";
+  }
 }
 
 
@@ -376,7 +383,7 @@ template <class PrimType>
 int MesherTempl<PrimType>::
 count_vert_edges(const EdgePtrs &edges) const {
   int count = 0;
-  EdgePtrs::const_iterator ei;
+  TYPENAME EdgePtrs::const_iterator ei;
   for (ei = edges.begin(); ei != edges.end(); ++ei) {
     count += (!(*ei)->_strips.empty() || !(*ei)->_opposite->_strips.empty());
   }
@@ -426,7 +433,7 @@ build_sheets() {
   while (!pre_sheeted.empty()) {
     // Pick the first quad on the list.
 
-    Strips::iterator best = pre_sheeted.begin();
+    TYPENAME Strips::iterator best = pre_sheeted.begin();
 
     // If the row_id is negative, we've already built a sheet out of
     // this quad.  Leave it alone.  We also need to leave it be if it
@@ -500,7 +507,7 @@ find_fans() {
   // Consider all vertices.  Any vertex with over a certain number of
   // edges connected to it is eligible to become a fan.
 
-  Verts::iterator vi;
+  TYPENAME Verts::iterator vi;
 
   for (vi = _verts.begin(); vi != _verts.end(); ++vi) {
     EdgePtrs &edges = (*vi).second;
@@ -519,8 +526,8 @@ find_fans() {
 
       FanMakers fans;
 
-      EdgePtrs::iterator ei;
-      Edge::Strips::iterator si;
+      TYPENAME EdgePtrs::iterator ei;
+      TYPENAME Edge::Strips::iterator si;
       for (ei = edges.begin(); ei != edges.end(); ++ei) {
         for (si = (*ei)->_strips.begin();
              si != (*ei)->_strips.end();
@@ -537,7 +544,7 @@ find_fans() {
       fans.erase(unique(fans.begin(), fans.end()),
                  fans.end());
 
-      FanMakers::iterator fi, fi2;
+      TYPENAME FanMakers::iterator fi, fi2;
 
       // Now pull out connected edges.
       int joined_any;
@@ -568,7 +575,7 @@ find_fans() {
   // until we're done traversing all the vertices and primitives we
   // had in the first place (since adding them will affect the edge
   // lists).
-  pvector<Prim>::iterator ti;
+  TYPENAME pvector<Prim>::iterator ti;
   for (ti = unrolled_tris.begin(); ti != unrolled_tris.end(); ++ti) {
     add_prim(*ti);
   }
@@ -607,7 +614,7 @@ make_quads() {
   Strip *tri, *mate, *mate2;
   Edge *common_edge, *common_edge2;
 
-  Strips::iterator si;
+  TYPENAME Strips::iterator si;
   for (si = _tris.begin(); si != _tris.end(); ++si) {
     tri = &(*si);
 
@@ -629,7 +636,7 @@ make_quads() {
 
   // Now that we've found all the tris that are sure about each other,
   // mate them.
-  SoulMates::iterator mi;
+  TYPENAME SoulMates::iterator mi;
   for (mi = soulmates.begin(); mi != soulmates.end(); ++mi) {
     tri = (*mi).first.first;
     mate = (*mi).first.second;
@@ -645,7 +652,7 @@ make_quads() {
   }
 
   // Now move all the strips off the tri list that no longer belong.
-  Strips::iterator next;
+  TYPENAME Strips::iterator next;
   si = _tris.begin();
   while (si != _tris.end()) {
     next = si;
@@ -666,7 +673,7 @@ meshList(Strips &strips) {
   while (!strips.empty()) {
     // Pick the first strip on the list.
 
-    Strips::iterator best = strips.begin();
+    TYPENAME Strips::iterator best = strips.begin();
 
     if ((*best)._status == MS_alive) {
       (*best).mate(*_bucket);

+ 2 - 0
panda/src/chan/animChannelFixed.h

@@ -36,6 +36,8 @@
 template<class SwitchType>
 class AnimChannelFixed : public AnimChannel<SwitchType> {
 public:
+  typedef TYPENAME AnimChannel<SwitchType>::ValueType ValueType;
+
   INLINE AnimChannelFixed(AnimGroup *parent, const string &name, const ValueType &value);
   INLINE AnimChannelFixed(const string &name, const ValueType &value);
 

+ 1 - 1
panda/src/chan/animChannelMatrixXfmTable.I

@@ -40,7 +40,7 @@ has_table(char table_id) const {
   if (table_index < 0) {
     return false;
   }
-  return !(_tables[table_index] == NULL);
+  return !(_tables[table_index] == (const float *)NULL);
 }
 
 ////////////////////////////////////////////////////////////////////

+ 1 - 1
panda/src/chan/animChannelScalarTable.I

@@ -24,7 +24,7 @@
 ////////////////////////////////////////////////////////////////////
 INLINE bool AnimChannelScalarTable::
 has_table() const {
-  return !(_table == NULL);
+  return _table != (const float *)NULL;
 }
 
 

+ 1 - 1
panda/src/chan/animControl.cxx

@@ -258,7 +258,7 @@ pose(int frame) {
   nassertv(num_frames > 0);
 
   // Modulo the number of frames.
-  frame = frame - cfloor(frame / num_frames) * num_frames;
+  frame = (int)(frame - cfloor(frame / num_frames) * num_frames);
   nassertv(frame >= 0 && frame < num_frames);
   _as_of_time = ClockObject::get_global_clock()->get_frame_time();
   _playing = false;

+ 1 - 1
panda/src/chan/auto_bind.cxx

@@ -75,7 +75,7 @@ bind_anims(const PartNodes &parts, const AnimNodes &anims,
       }
 
       if (chan_cat.is_info()) {
-        if (control == NULL) {
+        if (control == (AnimControl *)NULL) {
           chan_cat.info()
             << "Bind failed.\n";
         } else {

+ 2 - 2
panda/src/char/computedVertices.cxx

@@ -58,7 +58,7 @@ template<class ValueType, class MorphType>
 static void
 compute_morphs(ValueType *table, const pvector<MorphType> &morph_list,
                Character *character) {
-  pvector<MorphType>::const_iterator mli;
+  TYPENAME pvector<MorphType>::const_iterator mli;
   for (mli = morph_list.begin(); mli != morph_list.end(); ++mli) {
     const MorphType &morph = (*mli);
     const CharacterSlider *slider;
@@ -71,7 +71,7 @@ compute_morphs(ValueType *table, const pvector<MorphType> &morph_list,
       typedef TYPENAME MorphType::MorphValue MorphValue;
       TYPENAME Morphs::const_iterator mi;
       for (mi = morph._morphs.begin(); mi != morph._morphs.end(); ++mi) {
-        typedef typename MorphValue::VecType VecType;
+        typedef TYPENAME MorphValue::VecType VecType;
         ushort index = (*mi)._index;
         const VecType &v = (*mi)._vector;
         

+ 1 - 1
panda/src/display/graphicsWindow.cxx

@@ -261,7 +261,7 @@ get_channel(int index) {
     GraphicsPipe *pipe = _pipe;
     if (pipe != (GraphicsPipe *)NULL) {
       chan = _pipe->get_hw_channel(this, index);
-      if (chan == NULL) {
+      if (chan == (GraphicsChannel *)NULL) {
         display_cat.error()
           << "GraphicsWindow::get_channel() - got a NULL channel" << endl;
       } else {

+ 2 - 3
panda/src/downloader/Sources.pp

@@ -29,7 +29,7 @@
     multiplexStreamBuf.I multiplexStreamBuf.h \
     socketStream.h socketStream.I \
     urlSpec.I urlSpec.h \
-    $[if $[HAVE_NET], downloadDb.I downloadDb.h downloader.I downloader.h] \
+    $[if $[HAVE_NET], downloadDb.I downloadDb.h] \
     $[if $[HAVE_ZLIB], decompressor.h download_utils.h] \
     $[if $[HAVE_CRYPTO], patcher.cxx patcher.h patcher.I]
     
@@ -51,7 +51,7 @@
     multiplexStream.cxx multiplexStreamBuf.cxx \
     socketStream.cxx \
     urlSpec.cxx \
-    $[if $[HAVE_NET], downloadDb.cxx downloader.cxx] \
+    $[if $[HAVE_NET], downloadDb.cxx] \
     $[if $[HAVE_ZLIB], decompressor.cxx download_utils.cxx]
 
   #define INSTALL_HEADERS \
@@ -63,7 +63,6 @@
     config_downloader.h \
     decompressor.h \
     download_utils.h downloadDb.h downloadDb.I \
-    downloader.h downloader.I \
     extractor.h \
     httpAuthorization.I httpAuthorization.h \
     httpBasicAuthorization.I httpBasicAuthorization.h \

+ 3 - 3
panda/src/downloader/bioStream.I

@@ -43,7 +43,7 @@ IBioStream(BioPtr *source) : ISocketStream(&_buf) {
 ////////////////////////////////////////////////////////////////////
 INLINE IBioStream &IBioStream::
 open(BioPtr *source) {
-  clear(0);
+  clear((ios::iostate)0);
   _buf.open(source);
   return *this;
 }
@@ -86,7 +86,7 @@ OBioStream(BioPtr *source) : OSocketStream(&_buf) {
 ////////////////////////////////////////////////////////////////////
 INLINE OBioStream &OBioStream::
 open(BioPtr *source) {
-  clear(0);
+  clear((ios::iostate)0);
   _buf.open(source);
   return *this;
 }
@@ -129,7 +129,7 @@ BioStream(BioPtr *source) : SocketStream(&_buf) {
 ////////////////////////////////////////////////////////////////////
 INLINE BioStream &BioStream::
 open(BioPtr *source) {
-  clear(0);
+  clear((ios::iostate)0);
   _buf.open(source);
   return *this;
 }

+ 1 - 4
panda/src/downloader/bioStreamBuf.cxx

@@ -39,10 +39,7 @@ BioStreamBuf::
 BioStreamBuf() {
   _is_closed = false;
 
-#ifdef WIN32_VC
-  // In spite of the claims of the MSDN Library to the contrary,
-  // Windows doesn't seem to provide an allocate() function, so we'll
-  // do it by hand.
+#ifdef HAVE_IOSTREAM
   char *buf = new char[8192];
   char *ebuf = buf + 8192;
   char *mbuf = buf + 4096;

+ 1 - 1
panda/src/downloader/chunkedStream.I

@@ -43,7 +43,7 @@ IChunkedStream(BioStreamPtr *source, HTTPChannel *doc) : ISocketStream(&_buf) {
 ////////////////////////////////////////////////////////////////////
 INLINE IChunkedStream &IChunkedStream::
 open(BioStreamPtr *source, HTTPChannel *doc) {
-  clear(0);
+  clear((ios::iostate)0);
   _buf.open_read(source, doc);
   return *this;
 }

+ 1 - 4
panda/src/downloader/chunkedStreamBuf.cxx

@@ -37,10 +37,7 @@ ChunkedStreamBuf() {
   _chunk_remaining = 0;
   _done = true;
 
-#ifdef WIN32_VC
-  // In spite of the claims of the MSDN Library to the contrary,
-  // Windows doesn't seem to provide an allocate() function, so we'll
-  // do it by hand.
+#ifdef HAVE_IOSTREAM
   char *buf = new char[4096];
   char *ebuf = buf + 4096;
   setg(buf, ebuf, ebuf);

+ 1 - 1
panda/src/downloader/downloadDb.cxx

@@ -813,7 +813,7 @@ read(istream &read_stream, bool want_server_info) {
   uchar *header_buf = new uchar[_header_length];
   // Read the header
   read_stream.read((char *)header_buf, _header_length);
-  if (read_stream.gcount() != (size_t)_header_length) {
+  if (read_stream.gcount() != _header_length) {
     downloader_cat.error() << "DownloadDb::read() - Empty file" << endl;
     return false;
   }

+ 0 - 168
panda/src/downloader/downloader.I

@@ -1,168 +0,0 @@
-// Filename: downloader.I
-// Created by:  mike (09Jan97)
-//
-////////////////////////////////////////////////////////////////////
-//
-// PANDA 3D SOFTWARE
-// Copyright (c) 2001, Disney Enterprises, Inc.  All rights reserved
-//
-// All use of this software is subject to the terms of the Panda 3d
-// Software license.  You should have received a copy of this license
-// along with this source code; you will also find a current copy of
-// the license at http://www.panda3d.org/license.txt .
-//
-// To contact the maintainers of this program write to
-// [email protected] .
-//
-////////////////////////////////////////////////////////////////////
-
-#include "config_downloader.h"
-
-
-////////////////////////////////////////////////////////////////////
-//     Function: Downloader::get_file_size
-//       Access: Published
-//  Description: Returns the size of the file currently being
-//               downloaded, in bytes, if it is known.  Returns 0 if
-//               the file size is not known.
-//
-//               After a call to initiate(), this will return 0; at
-//               some later point, when the first response from the
-//               server is read, it may return the actual size of the
-//               file if the server told us.  It is possible the
-//               server will not tell us the size of the file, in
-//               which case this will always return 0.
-////////////////////////////////////////////////////////////////////
-INLINE int Downloader::
-get_file_size() const {
-  return _file_size;
-}
-
-////////////////////////////////////////////////////////////////////
-//     Function: Downloader::set_frequency
-//       Access: Public
-//  Description:
-////////////////////////////////////////////////////////////////////
-INLINE void Downloader::
-set_frequency(float frequency) {
-  nassertv(frequency > 0.0);
-  if (_frequency != frequency) {
-    _frequency = frequency;
-    _recompute_buffer = true;
-  }
-}
-
-////////////////////////////////////////////////////////////////////
-//     Function: Downloader::get_frequency
-//       Access: Public
-//  Description:
-////////////////////////////////////////////////////////////////////
-INLINE float Downloader::
-get_frequency(void) const {
-  return _frequency;
-}
-
-////////////////////////////////////////////////////////////////////
-//     Function: Downloader::set_byte_rate
-//       Access: Public
-//  Description: Note: modem speeds are reported in bits, so you
-//               need to convert!
-////////////////////////////////////////////////////////////////////
-INLINE void Downloader::
-set_byte_rate(float bytes) {
-  nassertv(bytes > 0.0);
-  if (_byte_rate != bytes) {
-    _byte_rate = bytes;
-    _recompute_buffer = true;
-  }
-}
-
-////////////////////////////////////////////////////////////////////
-//     Function: Downloader::get_byte_rate
-//       Access: Public
-//  Description: Returns byte rate in bytes.
-////////////////////////////////////////////////////////////////////
-INLINE float Downloader::
-get_byte_rate(void) const {
-  return _byte_rate;
-}
-
-////////////////////////////////////////////////////////////////////
-//     Function: Downloader::set_disk_write_frequency
-//       Access: Public
-//  Description:
-////////////////////////////////////////////////////////////////////
-INLINE void Downloader::
-set_disk_write_frequency(int frequency) {
-  nassertv(frequency > 0);
-  if (_disk_write_frequency != frequency) {
-    _disk_write_frequency = frequency;
-    _recompute_buffer = true;
-  }
-}
-
-////////////////////////////////////////////////////////////////////
-//     Function: Downloader::get_disk_write_frequency
-//       Access: Public
-//  Description:
-////////////////////////////////////////////////////////////////////
-INLINE int Downloader::
-get_disk_write_frequency(void) const {
-  return _disk_write_frequency;
-}
-
-////////////////////////////////////////////////////////////////////
-//     Function: Downloader::get_bytes_written
-//       Access: Public
-//  Description:
-////////////////////////////////////////////////////////////////////
-INLINE int Downloader::
-get_bytes_written(void) const {
-  if (_ever_initiated == false) {
-    downloader_cat.warning()
-      << "Downloader::get_bytes_written() - Download has not been "
-      << "initiated" << endl;
-    return 0;
-  }
-  if (_current_status != NULL)
-    return _current_status->_total_bytes_written;
-  else
-    return _total_bytes_written;
-}
-
-////////////////////////////////////////////////////////////////////
-//     Function: Downloader::get_bytes_requested
-//       Access: Public
-//  Description:
-////////////////////////////////////////////////////////////////////
-INLINE int Downloader::
-get_bytes_requested(void) const {
-  if (_ever_initiated == false) {
-    downloader_cat.warning()
-      << "Downloader::get_bytes_requested() - Download has not been "
-      << "initiated" << endl;
-    return 0;
-  }
-  if (_current_status != NULL)
-    return _current_status->_total_bytes_requested;
-  else
-    return _total_bytes_requested;
-}
-
-////////////////////////////////////////////////////////////////////
-//     Function: Downloader::get_bytes_per_second
-//       Access: Public
-//  Description:
-////////////////////////////////////////////////////////////////////
-INLINE float Downloader::
-get_bytes_per_second(void) const {
-  if (_ever_initiated == false) {
-    downloader_cat.warning()
-      << "Downloader::get_bytes_per_second() - Download has not been "
-      << "initiated" << endl;
-    return 0.0;
-  }
-  nassertr(_tlast - _tfirst > 0.0, 0.0);
-  nassertr(_current_status != NULL, 0.0);
-  return (float)((double)_current_status->_total_bytes / (_tlast - _tfirst));
-}

+ 0 - 1096
panda/src/downloader/downloader.cxx

@@ -1,1096 +0,0 @@
-// Filename: downloader.cxx
-// Created by:  mike (09Jan97)
-//
-////////////////////////////////////////////////////////////////////
-//
-// PANDA 3D SOFTWARE
-// Copyright (c) 2001, Disney Enterprises, Inc.  All rights reserved
-//
-// All use of this software is subject to the terms of the Panda 3d
-// Software license.  You should have received a copy of this license
-// along with this source code; you will also find a current copy of
-// the license at http://www.panda3d.org/license.txt .
-//
-// To contact the maintainers of this program write to
-// [email protected] .
-//
-////////////////////////////////////////////////////////////////////
-
-
-#include "downloader.h"
-#include "config_downloader.h"
-#include "urlSpec.h"
-#include "error_utils.h"
-#include "filename.h"
-
-#include <errno.h>
-#include <math.h>
-
-#if !defined(WIN32_VC)
-  #include <sys/time.h>
-  #include <netinet/in.h>
-  #include <arpa/inet.h>
-  #include <netdb.h>
-  #define SOCKET_ERROR -1
-#endif
-
-////////////////////////////////////////////////////////////////////
-// Defines
-////////////////////////////////////////////////////////////////////
-const int MAX_RECEIVE_BYTES = 16384;
-
-////////////////////////////////////////////////////////////////////
-//     Function: Downloader::Constructor
-//       Access: Published
-//  Description:
-////////////////////////////////////////////////////////////////////
-Downloader::
-Downloader(void) {
-  _frequency = downloader_frequency;
-  _byte_rate = (float) downloader_byte_rate;
-  _disk_write_frequency = downloader_disk_write_frequency;
-  nassertv(_frequency > 0 && _byte_rate > 0 && _disk_write_frequency > 0);
-  _receive_size = (ulong)(_byte_rate * _frequency);
-  _disk_buffer_size = _disk_write_frequency * _receive_size;
-  _buffer = new Buffer(_disk_buffer_size);
-
-  _connected = false;
-  _use_proxy = false;
-  // We need to flush after every write in case we're interrupted
-  _dest_stream.setf(ios::unitbuf, 0);
-  _current_status = NULL;
-  _recompute_buffer = false;
-
-  _tfirst = 0.0;
-  _tlast = 0.0;
-  _got_any_data = false;
-  _initiated = false;
-  _ever_initiated = false;
-  _TCP_stack_initialized = false;
-  _total_bytes_written = 0;
-  _total_bytes_requested = 0;
-  _total_bytes_requested = 0;
-
-  _file_size = 0;
-}
-
-////////////////////////////////////////////////////////////////////
-//     Function: Downloader::Destructor
-//       Access: Public
-//  Description:
-////////////////////////////////////////////////////////////////////
-Downloader::
-~Downloader() {
-  if (_connected)
-    disconnect_from_server();
-  _buffer.clear();
-  if (_initiated == true)
-    cleanup();
-}
-
-////////////////////////////////////////////////////////////////////
-//     Function: Downloader::connect_to_server_by_proxy
-//       Access: Public
-//  Description:
-////////////////////////////////////////////////////////////////////
-int Downloader::
-connect_to_server_by_proxy(const URLSpec &proxy, const string &server_name) {
-  if (connect_to_server(proxy.get_server(), proxy.get_port()) != EU_success) {
-    downloader_cat.error()
-      << "Downloader::connect_to_server_by_proxy() - could not connect to: "
-      << proxy << endl;
-    return EU_error_abort;
-  }
-  
-  _proxy_string = "http://";
-  _proxy_string += server_name;
-  _use_proxy = true;
-
-  return EU_success;
-}
-
-////////////////////////////////////////////////////////////////////
-//     Function: Downloader::connect_to_server
-//       Access: Public
-//  Description:
-////////////////////////////////////////////////////////////////////
-int Downloader::
-connect_to_server(const string &name, uint port) {
-
-#if defined(WIN32)
-  if (_TCP_stack_initialized == false) {
-    WSAData mydata;
-    int answer1 = WSAStartup(0x0101, &mydata);
-    if(answer1 != 0) {
-      downloader_cat.error()
-        << "Downloader::connect_to_server() - WSAStartup() - error: "
-        << handle_socket_error() << endl;
-      return EU_error_abort;
-    }
-    _TCP_stack_initialized = true;
-  }
-#endif
-
-  if (downloader_cat.is_debug())
-    downloader_cat.debug()
-      << "Downloader connecting to server: " << name << " on port: "
-      << port << endl;
-
-  _server_name = name;
-
-  _sin.sin_family = PF_INET;
-  _sin.sin_port = htons(port);
-  ulong addr = (ulong)inet_addr(name.c_str());
-  struct hostent *hp = NULL;
-
-  if (addr == INADDR_NONE) {
-    hp = gethostbyname(name.c_str());
-    if (hp != NULL)
-      (void)memcpy(&_sin.sin_addr, hp->h_addr, (uint)hp->h_length);
-    else {
-      downloader_cat.error()
-        << "Downloader::connect_to_server() - gethostbyname() failed on: "
-        << name.c_str() << " with error: "
-        << handle_socket_error() << endl;
-      return get_network_error();
-    }
-  } else
-    (void)memcpy(&_sin.sin_addr, &addr, sizeof(addr));
-
-  return connect_to_server();
-}
-
-////////////////////////////////////////////////////////////////////
-//     Function: Downloader::connect_to_server
-//       Access: Private
-//  Description:
-////////////////////////////////////////////////////////////////////
-int Downloader::
-connect_to_server(void) {
-  if (_connected == true)
-    return EU_success;
-
-  _socket = 0xffffffff;
-  _socket = socket(PF_INET, SOCK_STREAM, 0);
-  if (_socket == (int)0xffffffff) {
-    downloader_cat.error()
-      << "Downloader::connect_to_server() - socket failed: "
-      << handle_socket_error() << endl;
-    return get_network_error();
-  }
-
-  if (connect(_socket, (struct sockaddr *)&_sin, sizeof(_sin)) ==
-                                                        SOCKET_ERROR) {
-    downloader_cat.error()
-      << "Downloader::connect_to_server() - connect() failed: "
-      << handle_socket_error() << endl;
-    disconnect_from_server();
-    return get_network_error();
-  }
-
-  _connected = true;
-  return EU_success;
-}
-
-///////////////////////////////////////////////////////////////////
-//     Function: Downloader::disconnect_from_server
-//       Access: Public
-//  Description:
-////////////////////////////////////////////////////////////////////
-void Downloader::
-disconnect_from_server(void) {
-  if (downloader_cat.is_debug())
-    downloader_cat.debug()
-      << "Downloader disconnecting from server..." << endl;
-#if defined(WIN32)
-  (void)closesocket(_socket);
-#else
-  (void)close(_socket);
-#endif
-  _connected = false;
-}
-
-////////////////////////////////////////////////////////////////////
-//     Function: Downloader::safe_send
-//       Access: Private
-//  Description:
-////////////////////////////////////////////////////////////////////
-int Downloader::
-safe_send(int socket, const char *data, int length, long timeout) {
-  if (length == 0) {
-    downloader_cat.error()
-      << "Downloader::safe_send() - requested 0 length send!" << endl;
-    return EU_error_abort;
-  }
-  int bytes = 0;
-  struct timeval tv;
-  tv.tv_sec = timeout;
-  tv.tv_usec = 0;
-  fd_set wset;
-  FD_ZERO(&wset);
-  while (bytes < length) {
-    FD_SET(socket, &wset);
-    int sret = select(socket + 1, NULL, &wset, NULL, &tv);
-    if (sret == 0) {
-      downloader_cat.error()
-        << "Downloader::safe_send() - select timed out after: "
-        << timeout << " seconds" << endl;
-      return EU_error_network_timeout;
-    } else if (sret == -1) {
-      downloader_cat.error()
-        << "Downloader::safe_send() - error: " << handle_socket_error()
-        << endl;
-      return get_network_error();
-    }
-    int ret = send(socket, data, length, 0);
-    if (ret > 0)
-      bytes += ret;
-    else {
-      downloader_cat.error()
-        << "Downloader::safe_send() - error: " << handle_socket_error()
-        << endl;
-      return get_network_error();
-    }
-  }
-  return EU_success;
-}
-
-////////////////////////////////////////////////////////////////////
-//     Function: Downloader::fast_receive
-//       Access: Private
-//  Description:
-////////////////////////////////////////////////////////////////////
-int Downloader::
-fast_receive(int socket, DownloadStatus *status, int rec_size) {
-  nassertr(status != NULL, EU_error_abort);
-  if (rec_size <= 0) {
-    downloader_cat.error()
-      << "Downloader::fast_receive() - Invalid receive size: " << rec_size
-      << endl;
-    return EU_error_abort;
-  }
-
-  // Poll the socket with select() to see if there is any data
-  struct timeval tv;
-  tv.tv_sec = 0;
-  tv.tv_usec = 0;
-  fd_set rset;
-  FD_ZERO(&rset);
-  FD_SET(socket, &rset);
-  int sret = select(socket, &rset, NULL, NULL, &tv);
-  if (sret == 0) {
-    return EU_network_no_data;
-  } else if (sret == -1) {
-    downloader_cat.error()
-      << "Downloader::fast_receive() - select() error: "
-      << handle_socket_error() << endl;
-    return get_network_error();
-  }
-  int ret = recv(socket, status->_next_in, rec_size, 0);
-  if (ret == 0) {
-    return EU_eof;
-  } else if (ret == -1) {
-    downloader_cat.error()
-      << "Downloader::fast_receive() - recv() error: "
-      << handle_socket_error() << endl;
-    return get_network_error();
-  }
-  if (downloader_cat.is_spam())
-    downloader_cat.spam()
-      << "Downloader::fast_receive() - recv() requested: " << rec_size
-      << " got: " << ret << " bytes" << endl;
-  status->_next_in += ret;
-  status->_bytes_in_buffer += ret;
-  status->_total_bytes += ret;
-  return EU_success;
-}
-
-////////////////////////////////////////////////////////////////////
-//     Function: Downloader::initiate
-//       Access: Published
-//  Description: Initiate the download of a complete file from the server.
-////////////////////////////////////////////////////////////////////
-int Downloader::
-initiate(const string &file_name, Filename file_dest) {
-  return initiate(file_name, file_dest, 0, 0, 0, false);
-}
-
-////////////////////////////////////////////////////////////////////
-//     Function: Downloader::initiate
-//       Access: Published
-//  Description: Initiate the download of a file from a server.
-////////////////////////////////////////////////////////////////////
-int Downloader::
-initiate(const string &file_name, Filename file_dest,
-        int first_byte, int last_byte, int total_bytes,
-        bool partial_content) {
-
-  if (_initiated == true) {
-    downloader_cat.error()
-      << "Downloader::initiate() - Download has already been initiated"
-      << endl;
-    return EU_error_abort;
-  }
-
-  // The file size is zero until we hear otherwise from the server
-  _file_size = 0;
-
-  // Connect to the server
-  int connect_ret = connect_to_server();
-  if (connect_ret < 0)
-    return connect_ret;
-
-  // Attempt to open the destination file
-  file_dest.set_binary();
-  _dest_stream.setf(ios::unitbuf, 0);
-  bool result;
-  if (partial_content == true && first_byte > 0)
-    result = file_dest.open_append(_dest_stream);
-  else
-    result = file_dest.open_write(_dest_stream);
-  if (result == false) {
-    downloader_cat.error()
-      << "Downloader::initiate() - Error opening file: " << file_dest
-      << " for writing: " << strerror(errno) << endl;
-    return get_write_error();
-  }
-
-  // Send an HTTP request for the file to the server
-  string request = "GET ";
-  if (_use_proxy == true)
-    request += _proxy_string;
-  request += file_name;
-  request += " HTTP/1.1\012Host: ";
-  request += _server_name;
-  request += "\012Connection: close";
-  if (partial_content == true) {
-    if (downloader_cat.is_debug())
-      downloader_cat.debug()
-        << "Downloader::initiate() - Requesting byte range: " << first_byte
-        << "-" << last_byte << endl;
-    request += "\012Range: bytes=";
-    stringstream start_stream;
-    start_stream << first_byte << "-" << last_byte;
-    request += start_stream.str();
-  }
-  request += "\012\012";
-  int outlen = request.size();
-  if (downloader_cat.is_debug())
-    downloader_cat.debug()
-      << "Downloader::initiate() - Sending request:\n" << request << endl;
-  int send_ret = safe_send(_socket, request.c_str(), outlen,
-                        (long)downloader_timeout);
-  if (send_ret < 0)
-    return send_ret;
-
-  // Create a download status to maintain download progress information
-  _current_status = new DownloadStatus(_buffer->_buffer,
-                                first_byte, last_byte, total_bytes,
-                                partial_content);
-
-  _tfirst = 0.0;
-  _tlast = 0.0;
-  _got_any_data = false;
-  _initiated = true;
-  _ever_initiated = true;
-  _download_to_ram = false;
-  return EU_success;
-}
-
-////////////////////////////////////////////////////////////////////
-//     Function: Downloader::initiate
-//       Access: Published
-//  Description: Initiate the download of a file from a server.
-////////////////////////////////////////////////////////////////////
-int Downloader::
-initiate(const string &file_name) {
-  if (_initiated == true) {
-    downloader_cat.error()
-      << "Downloader::initiate() - Download has already been initiated"
-      << endl;
-    return EU_error_abort;
-  }
-
-  // The file size is zero until we hear otherwise from the server
-  _file_size = 0;
-
-  // Connect to the server
-  int connect_ret = connect_to_server();
-  if (connect_ret < 0)
-    return connect_ret;
-
-  // Send an HTTP request for the file to the server
-  string request = "GET ";
-  if (_use_proxy == true)
-    request += _proxy_string;
-  request += file_name;
-  request += " HTTP/1.1\012Host: ";
-  request += _server_name;
-  request += "\012Connection: close";
-  request += "\012\012";
-  int outlen = request.size();
-  if (downloader_cat.is_debug())
-    downloader_cat.debug()
-      << "Downloader::initiate() - Sending request:\n" << request << endl;
-  int send_ret = safe_send(_socket, request.c_str(), outlen,
-                        (long)downloader_timeout);
-  if (send_ret < 0)
-    return send_ret;
-
-  // Create a download status to maintain download progress information
-  _current_status = new DownloadStatus(_buffer->_buffer, 0, 0, 0, false);
-
-  _tfirst = 0.0;
-  _tlast = 0.0;
-  _got_any_data = false;
-  _initiated = true;
-  _ever_initiated = true;
-  _download_to_ram = true;
-  _dest_string_stream = new ostringstream();
-  return EU_success;
-}
-
-////////////////////////////////////////////////////////////////////
-//     Function: Downloader::cleanup
-//       Access: Published
-//  Description:
-////////////////////////////////////////////////////////////////////
-void Downloader::
-cleanup(void) {
-  if (_initiated == false) {
-    downloader_cat.error()
-      << "Downloader::cleanup() - Download has not been initiated"
-      << endl;
-    return;
-  }
-
-  // The "Connection: close" line tells the server to close the
-  // connection when the download is complete
-  disconnect_from_server();
-  _dest_stream.close();
-  _total_bytes_written = _current_status->_total_bytes_written;
-  _total_bytes_requested = _current_status->_total_bytes_requested;
-  delete _current_status;
-  // We must set this to NULL otherwise there is a bad pointer floating around
-  _current_status = NULL;
-  _initiated = false;
-}
-
-////////////////////////////////////////////////////////////////////
-//     Function: Downloader::run
-//       Access: Published
-//  Description:
-////////////////////////////////////////////////////////////////////
-int Downloader::
-run(void) {
-  if (_initiated == false) {
-    downloader_cat.error()
-      << "Downloader::run() - Download has not been initiated"
-      << endl;
-    return EU_error_abort;
-  }
-
-  nassertr(_current_status != NULL, EU_error_abort);
-
-  int connect_ret = connect_to_server();
-  if (connect_ret < 0)
-    return connect_ret;
-
-  if (_download_to_ram == true)
-    return run_to_ram();
-
-  int ret = EU_ok;
-  int write_ret;
-  double t0 = _clock.get_real_time();
-  if (_tfirst == 0.0) {
-    _tfirst = t0;
-  }
-  if (t0 - _tlast < _frequency)
-    return EU_ok;
-
-  _tlast = _clock.get_real_time();
-
-  // Recompute the buffer size if necessary
-  if (_recompute_buffer == true) {
-    if (downloader_cat.is_spam())
-      downloader_cat.spam()
-        << "Downloader::run() - Recomputing the buffer" << endl;
-
-    // Flush the current buffer if it holds any data
-    if (_current_status->_bytes_in_buffer > 0) {
-      write_ret = write_to_disk(_current_status);
-      if (write_ret < 0)
-        return write_ret;
-
-      ret = EU_write;
-    }
-
-    // Allocate a new buffer
-    _buffer.clear();
-    _receive_size = (ulong)(_frequency * _byte_rate);
-    _disk_buffer_size = _receive_size * _disk_write_frequency;
-    _buffer = new Buffer(_disk_buffer_size);
-    _current_status->_buffer = _buffer->_buffer;
-    _current_status->reset();
-    // Reset the flag
-    _recompute_buffer = false;
-    // Reset the statistics
-    _tfirst = t0;
-    _current_status->_total_bytes = 0;
-
-  } else if (_current_status->_bytes_in_buffer + _receive_size > ((unsigned int)_disk_buffer_size)) {
-
-    // Flush the current buffer if the next request would overflow it
-    if (downloader_cat.is_spam())
-      downloader_cat.spam()
-        << "Downloader::run() - Flushing buffer" << endl;
-    write_ret = write_to_disk(_current_status);
-    if (write_ret < 0)
-      return write_ret;
-    ret = EU_write;
-  }
-
-  // Attempt to receive the bytes from the socket
-  int fret = 0;
-  // Handle the case of a fast connection
-  if (_receive_size > (ulong)MAX_RECEIVE_BYTES) {
-    int repeat = (int)(_receive_size / MAX_RECEIVE_BYTES);
-    int remain = (int)fmod((double)_receive_size, (double)MAX_RECEIVE_BYTES);
-    if (downloader_cat.is_spam())
-      downloader_cat.spam()
-        << "Downloader::run() - fast connection - repeat: " << repeat
-        << " remain: " << remain << endl;
-    // Make multiple requests at once but do not exceed MAX_RECEIVE_BYTES
-    // for any single request
-    for (int i = 0; i <= repeat; i++) {
-      if (i < repeat)
-        fret = fast_receive(_socket, _current_status, MAX_RECEIVE_BYTES);
-      else if (remain > 0)
-        fret = fast_receive(_socket, _current_status, remain);
-      if (fret == EU_eof || fret < 0) {
-        break;
-      } else if (fret == EU_success) {
-        _got_any_data = true;
-      }
-    }
-  } else { // Handle the normal speed connection case
-    if (downloader_cat.is_spam())
-      downloader_cat.spam()
-        << "Downloader::run() - normal connection" << endl;
-    fret = fast_receive(_socket, _current_status, _receive_size);
-  }
-
-  _current_status->_total_bytes_requested += _receive_size;
-
-  // Check for end of file
-  if (fret == EU_eof) {
-    if (_got_any_data == true) {
-      if (_current_status->_bytes_in_buffer > 0) {
-        write_ret = write_to_disk(_current_status);
-        if (write_ret < 0)
-          return write_ret;
-      }
-      if (downloader_cat.is_spam())
-        downloader_cat.spam()
-          << "Downloader::run() - Got eof" << endl;
-      cleanup();
-      return EU_success;
-    } else {
-      if (downloader_cat.is_spam())
-        downloader_cat.spam()
-          << "Downloader::run() - Got 0 bytes" << endl;
-      return ret;
-    }
-  } else if (fret == EU_network_no_data) {
-    if (downloader_cat.is_spam())
-      downloader_cat.spam()
-        << "Downloader::run() - No data" << endl;
-      return ret;
-  } else if (fret < 0) {
-    return fret;
-  }
-
-  _got_any_data = true;
-  return ret;
-}
-
-////////////////////////////////////////////////////////////////////
-//     Function: Downloader::run_to_ram
-//       Access: Private
-//  Description:
-////////////////////////////////////////////////////////////////////
-int Downloader::
-run_to_ram(void) {
-  int ret = EU_ok;
-  int write_ret;
-
-  double t0 = _clock.get_real_time();
-  if (_tfirst == 0.0) {
-    _tfirst = t0;
-  }
-  if (t0 - _tlast < _frequency)
-    return EU_ok;
-
-  _tlast = _clock.get_real_time();
-
-  // Recompute the buffer size if necessary
-  if (_recompute_buffer == true) {
-    if (downloader_cat.is_spam())
-      downloader_cat.spam()
-        << "Downloader::run_to_ram() - Recomputing the buffer" << endl;
-
-    // Flush the current buffer if it holds any data
-    if (_current_status->_bytes_in_buffer > 0) {
-      write_ret = write_to_ram(_current_status);
-      if (write_ret < 0)
-        return write_ret;
-      ret = EU_write_ram;
-    }
-
-    // Allocate a new buffer
-    _buffer.clear();
-    _receive_size = (ulong)(_frequency * _byte_rate);
-    _disk_buffer_size = _receive_size * _disk_write_frequency;
-    _buffer = new Buffer(_disk_buffer_size);
-    _current_status->_buffer = _buffer->_buffer;
-    _current_status->reset();
-    // Reset the flag
-    _recompute_buffer = false;
-    // Reset the statistics
-    _tfirst = t0;
-    _current_status->_total_bytes = 0;
-
-  } else if (_current_status->_bytes_in_buffer + _receive_size >
-                                                ((unsigned int)_disk_buffer_size)) {
-
-    // Flush the current buffer if the next request would overflow it
-    if (downloader_cat.is_spam())
-      downloader_cat.spam()
-        << "Downloader::run_to_ram() - Flushing buffer" << endl;
-    write_ret = write_to_ram(_current_status);
-    if (write_ret < 0)
-      return write_ret;
-    ret = EU_write_ram;
-  }
-
-  // Attempt to receive the bytes from the socket
-  int fret = 0;
-  // Handle the case of a fast connection
-  if (_receive_size > (ulong)MAX_RECEIVE_BYTES) {
-    int repeat = (int)(_receive_size / MAX_RECEIVE_BYTES);
-    int remain = (int)fmod((double)_receive_size, (double)MAX_RECEIVE_BYTES);
-    if (downloader_cat.is_spam())
-      downloader_cat.spam()
-        << "Downloader::run_to_ram() - fast connection - repeat: " << repeat
-        << " remain: " << remain << endl;
-    // Make multiple requests at once but do not exceed MAX_RECEIVE_BYTES
-    // for any single request
-    for (int i = 0; i <= repeat; i++) {
-      if (i < repeat)
-        fret = fast_receive(_socket, _current_status, MAX_RECEIVE_BYTES);
-      else if (remain > 0)
-        fret = fast_receive(_socket, _current_status, remain);
-      if (fret == EU_eof || fret < 0) {
-        break;
-      } else if (fret == EU_success) {
-        _got_any_data = true;
-      }
-    }
-  } else { // Handle the normal speed connection case
-    if (downloader_cat.is_spam())
-      downloader_cat.spam()
-        << "Downloader::run_to_ram() - normal connection" << endl;
-    fret = fast_receive(_socket, _current_status, _receive_size);
-  }
-
-  _current_status->_total_bytes_requested += _receive_size;
-
-  // Check for end of file
-  if (fret == EU_eof) {
-    if (_got_any_data == true) {
-      if (_current_status->_bytes_in_buffer > 0) {
-        write_ret = write_to_ram(_current_status);
-        if (write_ret < 0)
-          return write_ret;
-      }
-      if (downloader_cat.is_spam())
-        downloader_cat.spam()
-          << "Downloader::run_to_ram() - Got eof" << endl;
-      cleanup();
-      return EU_success;
-    } else {
-      if (downloader_cat.is_spam())
-        downloader_cat.spam()
-          << "Downloader::run_to_ram() - Got 0 bytes" << endl;
-      return ret;
-    }
-  } else if (fret == EU_network_no_data) {
-    if (downloader_cat.is_spam())
-      downloader_cat.spam()
-        << "Downloader::run_to_ram() - No data" << endl;
-      return ret;
-  } else if (fret < 0) {
-    return fret;
-  }
-
-  _got_any_data = true;
-  return ret;
-}
-
-////////////////////////////////////////////////////////////////////
-//     Function: Downloader::parse_http_response
-//       Access: Private
-//  Description: Check the HTTP response from the server
-////////////////////////////////////////////////////////////////////
-int Downloader::
-parse_http_response(const string &resp) {
-  size_t ws = resp.find(" ", 0);
-  string httpstr = resp.substr(0, ws);
-#if 0
-  if (!(httpstr == "HTTP/1.1")) {
-    downloader_cat.error()
-      << "Downloader::parse_http_response() - not HTTP/1.1 - got: "
-      << httpstr << endl;
-    return EU_error_abort;
-  }
-#endif
-  size_t ws2 = resp.find(" ", ws);
-  string numstr = resp.substr(ws, ws2);
-  nassertr(numstr.length() > 0, false);
-  int num = atoi(numstr.c_str());
-  switch (num) {
-    case 200:
-    case 206:
-      return EU_success;
-    case 202:
-      // Accepted - server may not honor request, though
-      if (downloader_cat.is_debug())
-        downloader_cat.debug()
-          << "Downloader::parse_http_response() - got a 202 Accepted - "
-          << "server does not guarantee to honor this request" << endl;
-      return EU_success;
-    case 201:
-    case 203:
-    case 204:
-    case 205:
-      break;
-    case 302:
-      if (downloader_cat.is_debug())
-        downloader_cat.debug()
-          << "Downloader::parse_http_response() - got a 302 redirect"
-          << endl;
-      return EU_error_abort;
-      break;
-    case 407:
-      return EU_error_http_proxy_authentication;
-    case 408:
-      return EU_error_http_server_timeout;
-    case 503:
-      return EU_error_http_service_unavailable;
-    case 504:
-      return EU_error_http_gateway_timeout;
-    default:
-      break;
-  }
-
-  downloader_cat.error()
-    << "Downloader::parse_http_response() - Invalid response: "
-    << resp << endl;
-  return EU_error_abort;
-}
-
-////////////////////////////////////////////////////////////////////
-//     Function: Downloader::parse_header
-//       Access: Private
-//  Description: Looks for a valid header.  If it finds one, it
-//               calculates the header length and strips it from
-//               the download status structure.  Function returns false
-//               on an error condition, otherwise true.
-////////////////////////////////////////////////////////////////////
-int Downloader::
-parse_header(DownloadStatus *status) {
-  nassertr(status != NULL, EU_error_abort);
-
-  if (status->_header_is_complete == true)
-    return EU_success;
-
-  if (status->_bytes_in_buffer == 0) {
-    downloader_cat.error()
-      << "Downloader::parse_header() - Empty buffer!" << endl;
-    return EU_error_abort;
-  }
-
-  string bufstr((char *)status->_start, status->_bytes_in_buffer);
-  size_t p  = 0;
-  bool redirect = false;
-  bool authenticate = false;
-  while (p < bufstr.length()) {
-    // Server sends out CR LF (\r\n) as newline delimiter
-    size_t nl = bufstr.find("\015\012", p);
-    if (nl == string::npos) {
-      downloader_cat.error()
-        << "Downloader::parse_header() - No newlines in buffer of "
-        << "length: " << status->_bytes_in_buffer << endl;
-      return EU_error_abort;
-    } else if (p == 0 && nl == p) {
-      downloader_cat.error()
-        << "Downloader::parse_header() - Buffer begins with newline!"
-        << endl;
-        return EU_error_abort;
-    }
-
-    string component = bufstr.substr(p, nl - p);
-
-    // The first line of the response should say whether
-    // got an error or not
-    if (status->_first_line_complete == false) {
-      status->_first_line_complete = true;
-      int parse_ret = parse_http_response(component);
-      if (parse_ret == EU_success) {
-        if (downloader_cat.is_spam())
-          downloader_cat.spam()
-            << "Downloader::parse_header() - Header is valid: "
-            << component << endl;
-        status->_header_is_valid = true;
-      } else if (parse_ret == EU_error_http_proxy_authentication) {
-        authenticate = true;
-        status->_header_is_valid = true;
-      } else if (parse_ret == EU_http_redirect) {
-        redirect = true;
-        status->_header_is_valid = true;
-      } else {
-        return parse_ret;
-      }
-    }
-
-    // Look for content length and location
-    size_t cpos = component.find(":");
-    string tline = component.substr(0, cpos);
-    if (tline == "Content-Length") {
-      tline = component.substr(cpos + 2, string::npos);
-      int server_download_bytes = atoi(tline.c_str());
-      _file_size = server_download_bytes;
-
-      if (status->_partial_content) {
-        // Ensure that our expected content length matches what the
-        // server gives us.
-        int client_download_bytes = status->_last_byte - status->_first_byte;
-        if (status->_first_byte == 0)
-          client_download_bytes += 1;
-        if (client_download_bytes != server_download_bytes) {
-          downloader_cat.error()
-            << "Downloader::parse_header() - server size = "
-            << server_download_bytes << ", client size = "
-            << client_download_bytes << " ("
-            << status->_last_byte << "-" << status->_first_byte << ")" << endl;
-          return EU_error_abort;
-        }
-      }
-
-    } else if (tline == "Transfer-Encoding") {
-      // This code isn't designed to handle transfer encodings other
-      // than identity.  It will certainly fail if we ever get this.
-      string encoding = component.substr(cpos + 2);
-      if (encoding == "identity") {
-        // No problem.
-
-      } else {
-        downloader_cat.error()
-          << "Non-identity transfer encoding specified by server!\n";
-        downloader_cat.error()
-          << component << "\n";
-        return EU_error_abort;
-      }
-
-    } else if (authenticate && tline == "Proxy-Authenticate") {
-      // We don't presently support authentication-demanding proxies.
-      downloader_cat.error()
-        << component << "\n";
-      return EU_error_http_proxy_authentication;
-
-    } else if (redirect == true && tline == "Location") {
-      tline = component.substr(cpos + 1, string::npos);
-      downloader_cat.error()
-        << "Got redirect to " << tline << endl;
-      return EU_error_abort;
-    }
-
-    // Two consecutive (CR LF)s indicates end of HTTP header
-    if (nl == p) {
-      // Make sure we didn't get a redirect
-      if (redirect == true) {
-        downloader_cat.error()
-          << "Downloader::parse_header() - Got a 302 redirect but no "
-          << "Location directive" << endl;
-        return EU_error_abort;
-      }
-      if (authenticate) {
-        return EU_error_http_proxy_authentication;
-      }
-      if (downloader_cat.is_spam())
-        downloader_cat.spam()
-          << "Downloader::parse_header() - Header is complete" << endl;
-      status->_header_is_complete = true;
-
-      // Strip the header out of the status buffer
-      int header_length = nl + 2;
-      status->_start += header_length;
-      status->_bytes_in_buffer -= header_length;
-
-      if (downloader_cat.is_spam())
-        downloader_cat.spam()
-          << "Downloader::parse_header() - Stripping out header of size: "
-          << header_length << endl;
-
-      return EU_success;
-    }
-
-    p = nl + 2;
-  }
-
-  if (status->_header_is_complete == false) {
-    if (downloader_cat.is_debug())
-      downloader_cat.debug()
-        << "Downloader::parse_header() - Reached end of buffer without "
-        << "successfully parsing the header - buffer size: "
-        << status->_bytes_in_buffer << endl;
-    return EU_error_abort;
-  }
-
-  return EU_success;
-}
-
-////////////////////////////////////////////////////////////////////
-//     Function: Downloader::write_to_disk
-//       Access: Private
-//  Description: Writes a download to disk.  If there is a header,
-//               the pointer and size are adjusted so the header
-//               is excluded.  Function returns false on error
-//               condition.
-////////////////////////////////////////////////////////////////////
-int Downloader::
-write_to_disk(DownloadStatus *status) {
-  nassertr(status != NULL, EU_error_abort);
-
-  // Ensure the header has been parsed successfully first
-  int parse_ret = parse_header(status);
-  if (parse_ret < 0)
-    return parse_ret;
-
-  if (status->_header_is_complete == false) {
-    downloader_cat.error()
-      << "Downloader::write_to_disk() - Incomplete HTTP header - "
-      << "(or header was larger than download buffer) - "
-      << "try increasing download-buffer-size" << endl;
-    return EU_error_abort;
-  }
-
-  // Write what we have so far to disk
-  if (status->_bytes_in_buffer > 0) {
-    if (downloader_cat.is_spam())
-      downloader_cat.spam()
-        << "Downloader::write_to_disk() - Writing "
-        << status->_bytes_in_buffer << " to disk" << endl;
-
-    _dest_stream.write(status->_start, status->_bytes_in_buffer);
-    _dest_stream.flush();
-    status->_total_bytes_written += status->_bytes_in_buffer;
-  }
-
-  status->reset();
-
-  return EU_success;
-}
-
-////////////////////////////////////////////////////////////////////
-//     Function: Downloader::write_to_ram
-//       Access: Private
-//  Description: Writes a download to memory.  If there is a header,
-//               the pointer and size are adjusted so the header
-//               is excluded.  Function returns false on error
-//               condition.
-////////////////////////////////////////////////////////////////////
-int Downloader::
-write_to_ram(DownloadStatus *status) {
-  nassertr(status != NULL, EU_error_abort);
-
-  // Ensure the header has been parsed successfully first
-  int parse_ret = parse_header(status);
-  if (parse_ret < 0)
-    return parse_ret;
-
-  if (status->_header_is_complete == false) {
-    downloader_cat.error()
-      << "Downloader::write_to_ram() - Incomplete HTTP header - "
-      << "(or header was larger than download buffer) - "
-      << "try increasing download-buffer-size" << endl;
-    return EU_error_abort;
-  }
-
-  // Write what we have so far to memory
-  if (status->_bytes_in_buffer > 0) {
-    if (downloader_cat.is_spam())
-      downloader_cat.spam()
-        << "Downloader::write_to_ram() - Writing "
-        << status->_bytes_in_buffer << " to memory" << endl;
-
-    _dest_string_stream->write(status->_start, status->_bytes_in_buffer);
-    status->_total_bytes_written += status->_bytes_in_buffer;
-  }
-
-  status->reset();
-
-  return EU_success;
-}
-
-////////////////////////////////////////////////////////////////////
-//     Function: Downloader::get_ramfile
-//       Access: Published
-//  Description:
-////////////////////////////////////////////////////////////////////
-bool Downloader::
-get_ramfile(Ramfile &rfile) {
-  rfile._data = _dest_string_stream->str();
-  delete _dest_string_stream;
-  _dest_string_stream = NULL;
-  return true;
-}
-
-////////////////////////////////////////////////////////////////////
-//     Function: Downloader::DownloadStatus::constructor
-//       Access: Private
-//  Description:
-////////////////////////////////////////////////////////////////////
-Downloader::DownloadStatus::
-DownloadStatus(char *buffer, int first_byte, int last_byte,
-                                int total_bytes, bool partial_content) {
-  _first_line_complete = false;
-  _header_is_complete = false;
-  _header_is_valid = false;
-  _buffer = buffer;
-  _first_byte = first_byte;
-  _last_byte = last_byte;
-  _total_bytes = total_bytes;
-  // Initialize the total bytes written to include all
-  // the bytes from previous partial downloads. This will
-  // ensure that when somebody calls get_bytes_written they
-  // will get the total size of the file, not just the number
-  // of bytes for this partial download
-  _total_bytes_written = first_byte;
-  _total_bytes_requested = first_byte;
-  _partial_content = partial_content;
-  reset();
-}
-
-////////////////////////////////////////////////////////////////////
-//     Function: Downloader::DownloadStatus::reset
-//       Access: Public
-//  Description: Resets the status buffer for more downloading after
-//               a write.
-////////////////////////////////////////////////////////////////////
-void Downloader::DownloadStatus::
-reset(void) {
-  _start = _buffer;
-  _next_in = _start;
-  _bytes_in_buffer = 0;
-}

+ 0 - 157
panda/src/downloader/downloader.h

@@ -1,157 +0,0 @@
-// Filename: downloader.h
-// Created by:  mike (09Jan97)
-//
-////////////////////////////////////////////////////////////////////
-//
-// PANDA 3D SOFTWARE
-// Copyright (c) 2001, Disney Enterprises, Inc.  All rights reserved
-//
-// All use of this software is subject to the terms of the Panda 3d
-// Software license.  You should have received a copy of this license
-// along with this source code; you will also find a current copy of
-// the license at http://www.panda3d.org/license.txt .
-//
-// To contact the maintainers of this program write to
-// [email protected] .
-//
-////////////////////////////////////////////////////////////////////
-#ifndef DOWNLOADER_H
-#define DOWNLOADER_H
-//
-////////////////////////////////////////////////////////////////////
-// Includes
-////////////////////////////////////////////////////////////////////
-#include <pandabase.h>
-#include <notify.h>
-#include <filename.h>
-#include <buffer.h>
-#include <pointerTo.h>
-#include <clockObject.h>
-
-#if defined(WIN32_VC)
-  #include <winsock.h>
-#else
-  #include <netinet/in.h>  // Irix seems to require this one for resolv.h.
-  #include <sys/types.h>
-  #include <sys/socket.h>
-  #include <resolv.h>
-#endif
-
-class URLSpec;
-
-////////////////////////////////////////////////////////////////////
-//       Class : Downloader
-// Description : This object is used to manage downloading of data
-//               from an HTTP server as a background task within a
-//               single-threaded network application.  The class can
-//               download a small piece at a time when run() is called
-//               from time to time; it is designed to both limit time
-//               spent in the run() call as well as limiting network
-//               bandwidth utilized by the download, so that CPU
-//               cycles and bandwidth are still available to the
-//               application for other purposes.
-////////////////////////////////////////////////////////////////////
-class EXPCL_PANDAEXPRESS Downloader {
-PUBLISHED:
-  Downloader(void);
-  virtual ~Downloader(void);
-
-  int connect_to_server_by_proxy(const URLSpec &proxy, const string &server_name);
-  int connect_to_server(const string &name, uint port=80);
-  void disconnect_from_server(void);
-
-  int initiate(const string &file_name, Filename file_dest);
-  int initiate(const string &file_name, Filename file_dest,
-                int first_byte, int last_byte, int total_bytes,
-                bool partial_content = true);
-  int initiate(const string &file_name);
-  INLINE int get_file_size() const;
-
-  int run(void);
-
-  bool get_ramfile(Ramfile &rfile);
-
-  INLINE void set_frequency(float frequency);
-  INLINE float get_frequency(void) const;
-  INLINE void set_byte_rate(float bytes);
-  INLINE float get_byte_rate(void) const;
-  INLINE void set_disk_write_frequency(int frequency);
-  INLINE int get_disk_write_frequency(void) const;
-  INLINE int get_bytes_written(void) const;
-  INLINE int get_bytes_requested(void) const;
-  INLINE float get_bytes_per_second(void) const;
-
-  void cleanup(void);
-
-
-private:
-  class DownloadStatus {
-  public:
-    DownloadStatus(char *buffer, int first_byte, int last_byte,
-                        int total_bytes, bool partial_content);
-    void reset(void);
-
-  public:
-    bool _first_line_complete;
-    bool _header_is_complete;
-    bool _header_is_valid;
-    char *_start;
-    char *_next_in;
-    int _bytes_in_buffer;
-    int _total_bytes_written;
-    int _total_bytes_requested;
-    int _first_byte;
-    int _last_byte;
-    int _total_bytes;
-    bool _partial_content;
-    char *_buffer;
-  };
-
-  INLINE void recompute_buffer(void);
-
-  int connect_to_server(void);
-  int safe_send(int socket, const char *data, int length, long timeout);
-  int fast_receive(int socket, DownloadStatus *status, int rec_size);
-  int parse_http_response(const string &resp);
-  int parse_header(DownloadStatus *status);
-  int write_to_disk(DownloadStatus *status);
-  int run_to_ram(void);
-  int write_to_ram(DownloadStatus *status);
-
-private:
-  bool _connected;
-  int _socket;
-  string _server_name;
-  bool _use_proxy;
-  string _proxy_string;
-  struct sockaddr_in _sin;
-  bool _TCP_stack_initialized;
-
-  bool _initiated;
-  bool _ever_initiated;
-  PT(Buffer) _buffer;
-  int _disk_write_frequency;
-  float _frequency;
-  float _byte_rate;
-  ulong _receive_size;
-  int _disk_buffer_size;
-  ofstream _dest_stream;
-  ostringstream *_dest_string_stream;
-  bool _recompute_buffer;
-
-  DownloadStatus *_current_status;
-  bool _got_any_data;
-  int _total_bytes_written;
-  int _total_bytes_requested;
-  bool _download_to_ram;
-
-  int _file_size;
-
-  double _tlast;
-  double _tfirst;
-  ClockObject _clock;
-};
-
-#include "downloader.I"
-
-#endif

+ 0 - 1
panda/src/downloader/downloader_composite3.cxx

@@ -1,3 +1,2 @@
-#include "downloader.cxx"
 #include "downloadDb.cxx"
 

+ 1 - 1
panda/src/downloader/identityStream.I

@@ -47,7 +47,7 @@ IIdentityStream(BioStreamPtr *source, HTTPChannel *doc,
 INLINE IIdentityStream &IIdentityStream::
 open(BioStreamPtr *source, HTTPChannel *doc, 
      bool has_content_length, size_t content_length) {
-  clear(0);
+  clear((ios::iostate)0);
   _buf.open_read(source, doc, has_content_length, content_length);
   return *this;
 }

+ 1 - 4
panda/src/downloader/identityStreamBuf.cxx

@@ -36,10 +36,7 @@ IdentityStreamBuf() {
   _has_content_length = true;
   _bytes_remaining = 0;
 
-#ifdef WIN32_VC
-  // In spite of the claims of the MSDN Library to the contrary,
-  // Windows doesn't seem to provide an allocate() function, so we'll
-  // do it by hand.
+#ifdef HAVE_IOSTREAM
   char *buf = new char[4096];
   char *ebuf = buf + 4096;
   setg(buf, ebuf, ebuf);

+ 6 - 4
panda/src/downloader/multiplexStreamBuf.cxx

@@ -95,9 +95,8 @@ write_string(const string &str) {
 ////////////////////////////////////////////////////////////////////
 MultiplexStreamBuf::
 MultiplexStreamBuf() {
-#ifndef WIN32_VC
-  // These lines, which are essential on Irix and Linux, seem to be
-  // unnecessary and not understood on Windows.
+#ifndef HAVE_IOSTREAM
+  // Older iostream implementations required this.
   allocate();
   setp(base(), ebuf());
 #endif
@@ -229,7 +228,10 @@ sync() {
 void MultiplexStreamBuf::
 write_chars(const char *start, int length, bool flush) {
   size_t orig = _line_buffer.length();
-  string latest(start, length);
+  string latest;
+  if (length != 0) {
+    latest = string(start, length);
+  }
   string line;
 
   if (flush) {

+ 1 - 1
panda/src/egg/eggGroup.I

@@ -595,7 +595,7 @@ clear_lod() {
 ////////////////////////////////////////////////////////////////////
 INLINE bool EggGroup::
 has_lod() const {
-  return (!(_lod == NULL));
+  return (_lod != (EggSwitchCondition *)NULL);
 }
 
 ////////////////////////////////////////////////////////////////////

+ 1 - 1
panda/src/egg/eggMorphList.I

@@ -174,7 +174,7 @@ template<class MorphType>
 pair<TYPENAME EggMorphList<MorphType>::iterator, bool> EggMorphList<MorphType>::
 insert(const MorphType &value) {
   pair<iterator, bool> result;
-  Morphs::iterator mi;
+  TYPENAME Morphs::iterator mi;
   for (mi = _morphs.begin(); mi != _morphs.end(); ++mi) {
     if ((*mi) == value) {
       // This value is already present.

+ 3 - 7
panda/src/egg/eggNamedObject.h

@@ -19,15 +19,11 @@
 #ifndef EGGNAMEDOBJECT_H
 #define EGGNAMEDOBJECT_H
 
-#include <pandabase.h>
+#include "pandabase.h"
 
 #include "eggObject.h"
-#include <namable.h>
-#include <referenceCount.h>
-
-#ifndef WIN32_VC
-class ostream;
-#endif
+#include "namable.h"
+#include "referenceCount.h"
 
 ////////////////////////////////////////////////////////////////////
 //       Class : EggNamedObject

+ 5 - 5
panda/src/egg/eggNode.I

@@ -137,7 +137,7 @@ is_local_coord() const {
 ////////////////////////////////////////////////////////////////////
 INLINE const LMatrix4d &EggNode::
 get_vertex_frame() const {
-  if (_vertex_frame == NULL) {
+  if (_vertex_frame == (LMatrix4d *)NULL) {
     return LMatrix4d::ident_mat();
   } else {
     return *_vertex_frame;
@@ -154,7 +154,7 @@ get_vertex_frame() const {
 ////////////////////////////////////////////////////////////////////
 INLINE const LMatrix4d &EggNode::
 get_node_frame() const {
-  if (_node_frame == NULL) {
+  if (_node_frame == (LMatrix4d *)NULL) {
     return LMatrix4d::ident_mat();
   } else {
     return *_node_frame;
@@ -169,7 +169,7 @@ get_node_frame() const {
 ////////////////////////////////////////////////////////////////////
 INLINE const LMatrix4d &EggNode::
 get_vertex_frame_inv() const {
-  if (_vertex_frame_inv == NULL) {
+  if (_vertex_frame_inv == (LMatrix4d *)NULL) {
     return LMatrix4d::ident_mat();
   } else {
     return *_vertex_frame_inv;
@@ -185,7 +185,7 @@ get_vertex_frame_inv() const {
 ////////////////////////////////////////////////////////////////////
 INLINE const LMatrix4d &EggNode::
 get_node_frame_inv() const {
-  if (_node_frame_inv == NULL) {
+  if (_node_frame_inv == (LMatrix4d *)NULL) {
     return LMatrix4d::ident_mat();
   } else {
     return *_node_frame_inv;
@@ -205,7 +205,7 @@ get_node_frame_inv() const {
 ////////////////////////////////////////////////////////////////////
 INLINE const LMatrix4d &EggNode::
 get_vertex_to_node() const {
-  if (_vertex_to_node == NULL) {
+  if (_vertex_to_node == (LMatrix4d *)NULL) {
     return LMatrix4d::ident_mat();
   } else {
     return *_vertex_to_node;

+ 2 - 6
panda/src/egg/eggObject.h

@@ -19,13 +19,9 @@
 #ifndef EGGOBJECT_H
 #define EGGOBJECT_H
 
-#include <pandabase.h>
+#include "pandabase.h"
 
-#include <typedReferenceCount.h>
-
-#ifndef WIN32_VC
-class ostream;
-#endif
+#include "typedReferenceCount.h"
 
 ////////////////////////////////////////////////////////////////////
 //       Class : EggObject

+ 7 - 7
panda/src/egg/parser.yxx

@@ -351,7 +351,7 @@ texture_body:
       texture->set_magfilter(f);
     }
   } else if (cmp_nocase_uh(name, "anisotropic_degree") == 0) {
-    texture->set_anisotropic_degree(value);
+    texture->set_anisotropic_degree((int)value);
 
   } else if (cmp_nocase_uh(name, "envtype") == 0) {
     EggTexture::EnvType e = EggTexture::string_env_type(strval);
@@ -901,11 +901,11 @@ group_body:
   } else if (cmp_nocase_uh(name, "bin") == 0) {
     group->set_bin(strval);
   } else if (cmp_nocase_uh(name, "collide_mask") == 0) {
-    group->set_collide_mask(value);
+    group->set_collide_mask((int)value);
   } else if (cmp_nocase_uh(name, "from_collide_mask") == 0) {
-    group->set_from_collide_mask(value);
+    group->set_from_collide_mask((int)value);
   } else if (cmp_nocase_uh(name, "into_collide_mask") == 0) {
-    group->set_into_collide_mask(value);
+    group->set_into_collide_mask((int)value);
   } else {
     eggyywarning("Unknown group scalar " + name);
   }
@@ -1492,9 +1492,9 @@ nurbs_surface_body:
   } else if (cmp_nocase_uh(name, "bin") == 0) {
     primitive->set_bin(strval);
   } else if (cmp_nocase_uh(name, "u_subdiv") == 0) {
-    primitive->set_u_subdiv(value);
+    primitive->set_u_subdiv((int)value);
   } else if (cmp_nocase_uh(name, "v_subdiv") == 0) {
-    primitive->set_v_subdiv(value);
+    primitive->set_v_subdiv((int)value);
   } else {
     eggyywarning("Unknown scalar " + name);
   }
@@ -1556,7 +1556,7 @@ nurbs_curve_body:
   } else if (cmp_nocase_uh(name, "bin") == 0) {
     primitive->set_bin(strval);
   } else if (cmp_nocase_uh(name, "subdiv") == 0) {
-    primitive->set_subdiv(value);
+    primitive->set_subdiv((int)value);
   } else if (cmp_nocase_uh(name, "type") == 0) {
     EggCurve::CurveType a = EggCurve::string_curve_type(strval);
     if (a == EggCurve::CT_none) {

+ 1 - 1
panda/src/egg2pg/computedVerticesMakerEntity.I

@@ -66,7 +66,7 @@ add_value(const ValueType &value, const MorphType &morphs,
           PTA(ValueType) &table) {
   // First, see if we have such an entity already.
   ComputedVerticesMakerEntity<ValueType, MorphType> entity(value, morphs);
-  MapType::const_iterator mi = _map.find(entity);
+  TYPENAME MapType::const_iterator mi = _map.find(entity);
   if (mi != _map.end()) {
     // We do!  Return its index number.
     return (*mi).second;

+ 7 - 2
panda/src/egg2pg/eggLoader.cxx

@@ -1281,8 +1281,13 @@ make_node(EggGroup *egg_group, PandaNode *parent) {
       if (!expanded.insert(objecttype).second) {
         egg2pg_cat.error()
           << "Cycle in ObjectType expansions:\n";
-        copy(expanded_history.begin(), expanded_history.end(),
-             ostream_iterator<string>(egg2pg_cat.error(false), " -> "));
+	pvector<string>::const_iterator pi;
+	for (pi = expanded_history.begin();
+	     pi != expanded_history.end();
+	     ++pi) {
+	  egg2pg_cat.error(false) 
+	    << (*pi) << " -> ";
+	}
         egg2pg_cat.error(false) << objecttype << "\n";
         _error = true;
         break;

+ 1 - 1
panda/src/express/multifile.cxx

@@ -1089,7 +1089,7 @@ read_index() {
 
   char this_header[_header_size];
   _read->read(this_header, _header_size);
-  if (_read->fail() || _read->gcount() != _header_size) {
+  if (_read->fail() || _read->gcount() != (unsigned)_header_size) {
     express_cat.info()
       << "Unable to read Multifile header " << _multifile_name << ".\n";
     close();

+ 54 - 0
panda/src/express/pointerTo.I

@@ -163,6 +163,60 @@ INLINE bool PointerToBase<T>::
 operator >= (const To *other) const {
   return _ptr >= other;
 }
+////////////////////////////////////////////////////////////////////
+//     Function: PointerToBase::Equivalence operator
+//       Access: Public
+//  Description:
+////////////////////////////////////////////////////////////////////
+template<class T>
+INLINE bool PointerToBase<T>::
+operator == (To *other) const {
+  return _ptr == other;
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: PointerToBase::Nonequivalence operator
+//       Access: Public
+//  Description:
+////////////////////////////////////////////////////////////////////
+template<class T>
+INLINE bool PointerToBase<T>::
+operator != (To *other) const {
+  return _ptr != other;
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: PointerToBase::Greater-than operator
+//       Access: Public
+//  Description:
+////////////////////////////////////////////////////////////////////
+template<class T>
+INLINE bool PointerToBase<T>::
+operator > (To *other) const {
+  return _ptr > other;
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: PointerToBase::Less-than-or-equal operator
+//       Access: Public
+//  Description:
+////////////////////////////////////////////////////////////////////
+template<class T>
+INLINE bool PointerToBase<T>::
+operator <= (To *other) const {
+  return _ptr <= other;
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: PointerToBase::Greater-than-or-equal operator
+//       Access: Public
+//  Description:
+////////////////////////////////////////////////////////////////////
+template<class T>
+INLINE bool PointerToBase<T>::
+operator >= (To *other) const {
+  return _ptr >= other;
+}
 
 ////////////////////////////////////////////////////////////////////
 //     Function: PointerToBase::Equivalence operator

+ 11 - 2
panda/src/express/pointerTo.h

@@ -113,6 +113,11 @@ public:
   INLINE bool operator > (const To *other) const;
   INLINE bool operator <= (const To *other) const;
   INLINE bool operator >= (const To *other) const;
+  INLINE bool operator == (To *other) const;
+  INLINE bool operator != (To *other) const;
+  INLINE bool operator > (To *other) const;
+  INLINE bool operator <= (To *other) const;
+  INLINE bool operator >= (To *other) const;
 
   INLINE bool operator == (const PointerToBase<To> &other) const;
   INLINE bool operator != (const PointerToBase<To> &other) const;
@@ -145,6 +150,8 @@ INLINE ostream &operator <<(ostream &out, const PointerToBase<T> &pointer) {
 ////////////////////////////////////////////////////////////////////
 template <class T>
 class PointerTo : public PointerToBase<T> {
+public:
+  typedef TYPENAME PointerToBase<T>::To To;
 PUBLISHED:
   INLINE PointerTo(To *ptr = (To *)NULL);
   INLINE PointerTo(const PointerTo<T> &copy);
@@ -152,7 +159,7 @@ PUBLISHED:
 public:
   INLINE To &operator *() const;
   INLINE To *operator -> () const;
-  INLINE operator PointerToBase<T>::To *() const;
+  INLINE operator TYPENAME PointerToBase<T>::To *() const;
 
 PUBLISHED:
   // When downcasting to a derived class from a PointerTo<BaseClass>,
@@ -199,6 +206,8 @@ PUBLISHED:
 ////////////////////////////////////////////////////////////////////
 template <class T>
 class ConstPointerTo : public PointerToBase<T> {
+public:
+  typedef TYPENAME PointerToBase<T>::To To;
 PUBLISHED:
   INLINE ConstPointerTo(const To *ptr = (const To *)NULL);
   INLINE ConstPointerTo(const PointerTo<T> &copy);
@@ -207,7 +216,7 @@ PUBLISHED:
 public:
   INLINE const To &operator *() const;
   INLINE const To *operator -> () const;
-  INLINE operator const PointerToBase<T>::To *() const;
+  INLINE operator const TYPENAME PointerToBase<T>::To *() const;
 
 PUBLISHED:
   INLINE const To *p() const;

+ 24 - 2
panda/src/express/pointerToArray.I

@@ -288,7 +288,7 @@ erase(iterator first, iterator last) const {
 //  Description:
 ////////////////////////////////////////////////////////////////////
 template<class Element>
-INLINE PointerToArray<Element>::reference PointerToArray<Element>::
+INLINE TYPENAME PointerToArray<Element>::reference PointerToArray<Element>::
 operator [](size_type n) const {
   nassertd(_ptr != NULL) {
     ((PointerToArray<Element> *)this)->reassign(new RefCountObj<pvector<Element> >);
@@ -299,6 +299,17 @@ operator [](size_type n) const {
   nassertr(n < _ptr->size(), _ptr->operator[](0));
   return _ptr->operator[](n);
 }
+
+////////////////////////////////////////////////////////////////////
+//     Function: PointerToArray::Indexing operator
+//       Access: Published
+//  Description:
+////////////////////////////////////////////////////////////////////
+template<class Element>
+INLINE TYPENAME PointerToArray<Element>::reference PointerToArray<Element>::
+operator [](int n) const {
+  return operator[]((size_type)n);
+}
 #endif
 
 ////////////////////////////////////////////////////////////////////
@@ -614,7 +625,7 @@ capacity() const {
 ////////////////////////////////////////////////////////////////////
 template<class Element>
 INLINE TYPENAME ConstPointerToArray<Element>::reference ConstPointerToArray<Element>::
-operator[](size_type n) const {
+operator [](size_type n) const {
   nassertd(_ptr != NULL) {
     ((ConstPointerToArray<Element> *)this)->reassign(new RefCountObj<pvector<Element> >);
   }
@@ -624,6 +635,17 @@ operator[](size_type n) const {
   nassertr(n < _ptr->size(), _ptr->operator[](0));
   return _ptr->operator[](n);
 }
+
+////////////////////////////////////////////////////////////////////
+//     Function: ConstPointerToArray::Indexing operator
+//       Access: Published
+//  Description:
+////////////////////////////////////////////////////////////////////
+template<class Element>
+INLINE TYPENAME ConstPointerToArray<Element>::reference ConstPointerToArray<Element>::
+operator [](int n) const {
+  return operator[]((size_type)n);
+}
 #endif
 
 ////////////////////////////////////////////////////////////////////

+ 3 - 1
panda/src/express/pointerToArray.h

@@ -150,6 +150,7 @@ public:
 PUBLISHED:
 #if !defined(WIN32_VC)
   INLINE reference operator [](size_type n) const;
+  INLINE reference operator [](int n) const;
 #endif
   INLINE void push_back(const Element &x);
   INLINE void pop_back();
@@ -232,7 +233,8 @@ public:
   // Functions specific to vectors.
   INLINE size_type capacity() const;
 #ifndef WIN32_VC
-  INLINE reference operator[](size_type n) const;
+  INLINE reference operator [](size_type n) const;
+  INLINE reference operator [](int n) const;
 #endif
   INLINE reference front() const;
   INLINE reference back() const;

+ 1 - 1
panda/src/express/profileTimer.h

@@ -100,7 +100,7 @@ protected:
 
   double getTime();
 
-  friend ProfileTimer::AutoTimer;
+  friend class ProfileTimer::AutoTimer;
 };
 
 #include "profileTimer.I"

+ 1 - 1
panda/src/express/subStream.I

@@ -51,7 +51,7 @@ ISubStream(istream *source, streampos start, streampos end) : istream(&_buf) {
 ////////////////////////////////////////////////////////////////////
 INLINE ISubStream &ISubStream::
 open(istream *source, streampos start, streampos end) {
-  clear(0);
+  clear((ios::iostate)0);
   _buf.open(source, start, end);
   return *this;
 }

+ 18 - 17
panda/src/express/subStreamBuf.cxx

@@ -84,10 +84,8 @@ SubStreamBuf() {
 
   init_lock();
 
-#ifdef WIN32_VC
-  // In spite of the claims of the MSDN Library to the contrary,
-  // Windows doesn't seem to provide an allocate() function, so we'll
-  // do it by hand.
+#ifdef HAVE_IOSTREAM
+  // The new-style iostream library doesn't seem to support allocate().
   char *buf = new char[4096];
   char *ebuf = buf + 4096;
   setg(buf, ebuf, ebuf);
@@ -144,7 +142,12 @@ close() {
 //  Description: Implements seeking within the stream.
 ////////////////////////////////////////////////////////////////////
 streampos SubStreamBuf::
-seekoff(streamoff off, ios::seek_dir dir, int mode) {
+#ifdef HAVE_IOSTREAM
+seekoff(streamoff off, ios::seekdir dir, ios::openmode mode)
+#else
+seekoff(streamoff off, ios::seek_dir dir, int mode)
+#endif
+{
   // Invariant: _cur points to the file location of the buffer at
   // egptr().
 
@@ -154,7 +157,10 @@ seekoff(streamoff off, ios::seek_dir dir, int mode) {
   streampos new_pos = cur_pos;
 
   // Now adjust the data pointer appropriately.
-  switch (dir) {
+
+  // Casting this to int to prevent GCC 3.2 compiler warnings.  Very
+  // suspicious, need to investigate further.
+  switch ((int)dir) {
   case ios::beg:
     new_pos = _start + off;
     break;
@@ -210,20 +216,15 @@ seekoff(streamoff off, ios::seek_dir dir, int mode) {
 //               function as well.
 ////////////////////////////////////////////////////////////////////
 streampos SubStreamBuf::
-seekpos(streampos pos, int mode) {
+#ifdef HAVE_IOSTREAM
+seekpos(streampos pos, ios::openmode mode) 
+#else
+seekpos(streampos pos, int mode) 
+#endif
+{
   return seekoff(pos, ios::beg, mode);
 }
 
-#ifdef WIN32_VC
-// Windows seems to be a little confused about the proper definition
-// of seekoff().  We have to define both variants in order to get
-// reliable seeking.
-streampos SubStreamBuf::
-seekoff(streamoff off, ios::seekdir dir, ios::openmode mode) {
-  return seekoff(off, (ios::seek_dir)dir, (int)mode);
-}
-#endif
-
 ////////////////////////////////////////////////////////////////////
 //     Function: SubStreamBuf::overflow
 //       Access: Protected, Virtual

+ 4 - 3
panda/src/express/subStreamBuf.h

@@ -33,11 +33,12 @@ public:
   void open(istream *source, streampos start, streampos end);
   void close();
 
+#ifdef HAVE_IOSTREAM
+  virtual streampos seekoff(streamoff off, ios::seekdir dir, ios::openmode mode);
+  virtual streampos seekpos(streampos pos, ios::openmode mode);
+#else
   virtual streampos seekoff(streamoff off, ios::seek_dir dir, int mode);
   virtual streampos seekpos(streampos pos, int mode);
-
-#ifdef WIN32_VC
-  virtual streampos seekoff(streamoff off, ios::seekdir dir, ios::openmode mode);
 #endif
 
 protected:

+ 2 - 1
panda/src/express/thread.h

@@ -67,7 +67,8 @@ private:
   bool _started;
   string _name;
   ThreadImpl _impl;
-  friend ThreadImpl;
+  friend class ThreadDummyImpl;
+  friend class ThreadNsprImpl;
 
 
 public:

+ 2 - 2
panda/src/express/tokenBoard.I

@@ -35,7 +35,7 @@ is_done_token(int id) {
   }
 
   // Now we can search really_done for our desired id.
-  plist< PT(TokenType) >::iterator found;
+  TYPENAME plist< PT(TokenType) >::iterator found;
   found = find_if(_really_done.begin(), _really_done.end(),
                   TokenMatch<TokenType>(id));
 
@@ -64,7 +64,7 @@ get_done_token(int id) {
   }
 
   // Now we can search really_done for our desired id.
-  plist< PT(TokenType) >::iterator found;
+  TYPENAME plist< PT(TokenType) >::iterator found;
   found = find_if(_really_done.begin(), _really_done.end(),
                   TokenMatch<TokenType>(id));
 

+ 2 - 2
panda/src/express/virtualFile.cxx

@@ -118,7 +118,7 @@ output(ostream &out) const {
 void VirtualFile::
 ls(ostream &out) const {
   CPT(VirtualFileList) contents = scan_directory();
-  if (contents == NULL) {
+  if (contents == (VirtualFileList *)NULL) {
     if (!is_directory()) {
       out << get_filename() << "\n";
     } else {
@@ -216,7 +216,7 @@ scan_local_directory(VirtualFileList *, const ov_set<string> &) const {
 void VirtualFile::
 r_ls_all(ostream &out, const Filename &root) const {
   CPT(VirtualFileList) contents = scan_directory();
-  if (contents == NULL) {
+  if (contents == (VirtualFileList *)NULL) {
     return;
   }
 

+ 2 - 2
panda/src/express/zStream.I

@@ -43,7 +43,7 @@ IDecompressStream(istream *source, bool owns_source) : istream(&_buf) {
 ////////////////////////////////////////////////////////////////////
 INLINE IDecompressStream &IDecompressStream::
 open(istream *source, bool owns_source) {
-  clear(0);
+  clear((ios::iostate)0);
   _buf.open_read(source, owns_source);
   return *this;
 }
@@ -89,7 +89,7 @@ OCompressStream(ostream *dest, bool owns_dest, int compression_level) :
 ////////////////////////////////////////////////////////////////////
 INLINE OCompressStream &OCompressStream::
 open(ostream *dest, bool owns_dest, int compression_level) {
-  clear(0);
+  clear((ios::iostate)0);
   _buf.open_write(dest, owns_dest, compression_level);
   return *this;
 }

+ 1 - 4
panda/src/express/zStreamBuf.cxx

@@ -37,10 +37,7 @@ ZStreamBuf() {
   _dest = (ostream *)NULL;
   _owns_dest = false;
 
-#ifdef WIN32_VC
-  // In spite of the claims of the MSDN Library to the contrary,
-  // Windows doesn't seem to provide an allocate() function, so we'll
-  // do it by hand.
+#ifdef HAVE_IOSTREAM
   char *buf = new char[4096];
   char *ebuf = buf + 4096;
   setg(buf, ebuf, ebuf);

+ 1 - 1
panda/src/gobj/geom.cxx

@@ -843,7 +843,7 @@ write_verbose(ostream &out, int indent_level) const {
     << get_type() << " contains "
     << get_num_prims() << " primitives:\n";
 
-  if ((i_coords == NULL) && (g_coords == NULL)) {
+  if ((i_coords == (ushort *)NULL) && (g_coords == (Vertexf *)NULL)) {
     indent(out, indent_level)
       << "No coords\n";
   } else if (i_coords!=(ushort*)0L) {

+ 5 - 2
panda/src/gobj/geomLine.cxx

@@ -62,7 +62,10 @@ void GeomLine::
 write_datagram(BamWriter *manager, Datagram &me)
 {
   Geom::write_datagram(manager, me);
-  me.add_uint32(_width);
+  // Changed from uint32 to float32 on 1/16/02; didn't bother to
+  // update the bam version on the assumption that no actual bam files
+  // contain GeomLine objects.
+  me.add_float32(_width);
 }
 
 ////////////////////////////////////////////////////////////////////
@@ -94,7 +97,7 @@ make_GeomLine(const FactoryParams &params) {
 void GeomLine::
 fillin(DatagramIterator& scan, BamReader* manager) {
   Geom::fillin(scan, manager);
-  _width = scan.get_uint32();
+  _width = scan.get_float32();
 }
 
 ////////////////////////////////////////////////////////////////////

+ 5 - 2
panda/src/gobj/geomLinestrip.cxx

@@ -74,7 +74,10 @@ explode() const {
 void GeomLinestrip::
 write_datagram(BamWriter *manager, Datagram &me) {
   Geom::write_datagram(manager, me);
-  me.add_uint32(_width);
+  // Changed from uint32 to float32 on 1/16/02; didn't bother to
+  // update the bam version on the assumption that no actual bam files
+  // contain GeomLinestrip objects.
+  me.add_float32(_width);
 }
 
 ////////////////////////////////////////////////////////////////////
@@ -106,7 +109,7 @@ make_GeomLinestrip(const FactoryParams &params) {
 void GeomLinestrip::
 fillin(DatagramIterator& scan, BamReader* manager) {
   Geom::fillin(scan, manager);
-  _width = scan.get_uint32();
+  _width = scan.get_float32();
 }
 
 ////////////////////////////////////////////////////////////////////

+ 5 - 2
panda/src/gobj/geomPoint.cxx

@@ -70,7 +70,10 @@ draw_immediate(GraphicsStateGuardianBase *gsg, GeomContext *gc) {
 void GeomPoint::
 write_datagram(BamWriter *manager, Datagram &me) {
   Geom::write_datagram(manager, me);
-  me.add_uint32(_size);
+  // Changed from uint32 to float32 on 1/16/02; didn't bother to
+  // update the bam version on the assumption that no actual bam files
+  // contain GeomPoint objects.
+  me.add_float32(_size);
 }
 
 ////////////////////////////////////////////////////////////////////
@@ -102,7 +105,7 @@ make_GeomPoint(const FactoryParams &params) {
 void GeomPoint::
 fillin(DatagramIterator& scan, BamReader* manager) {
   Geom::fillin(scan, manager);
-  _size = scan.get_uint32();
+  _size = scan.get_float32();
 }
 
 ////////////////////////////////////////////////////////////////////

+ 1 - 1
panda/src/gobj/texture.h

@@ -199,7 +199,7 @@ private:
 
   static TypeHandle _type_handle;
 
-  friend TextureContext;
+  friend class TextureContext;
 };
 
 #include "texture.I"

+ 1 - 1
panda/src/pgraph/lensNode.cxx

@@ -84,7 +84,7 @@ make_copy() const {
 bool LensNode::
 is_in_view(const LPoint3f &pos) {
   PT(BoundingVolume) bv = _lens->make_bounds();
-  if (bv == NULL) {
+  if (bv == (BoundingVolume *)NULL) {
     return false;
   }
   GeometricBoundingVolume *gbv = DCAST(GeometricBoundingVolume, bv);

+ 1 - 1
panda/src/pgraph/loader.cxx

@@ -337,7 +337,7 @@ process_request() {
     PT(LoaderToken) tok = _token_board->_waiting.front();
     _token_board->_waiting.pop_front();
     tok->_node = load_file(tok->_path);
-    if (tok->_node == NULL) {
+    if (tok->_node == (PandaNode *)NULL) {
       loader_cat.error()
         << "Loader::callback() - couldn't find file: "
         << tok->_path << "\n";

+ 1 - 1
panda/src/pgraph/nodePath.h

@@ -570,7 +570,7 @@ private:
   static TypeHandle _type_handle;
 
   friend class NodePathCollection;
-  friend WorkingNodePath;
+  friend class WorkingNodePath;
 };
 
 INLINE ostream &operator << (ostream &out, const NodePath &node_path);

+ 2 - 2
panda/src/physics/linearNoiseForce.I

@@ -33,7 +33,7 @@ prn_lookup(int index) const {
 ////////////////////////////////////////////////////////////////////
 INLINE unsigned char LinearNoiseForce::
 get_prn_entry(const LPoint3f& point) const {
-  return prn_lookup(point[0] + prn_lookup(point[1] + prn_lookup(point[2])));
+  return prn_lookup((int)(point[0] + prn_lookup((int)(point[1] + prn_lookup((int)point[2])))));
 }
 
 ////////////////////////////////////////////////////////////////////
@@ -43,7 +43,7 @@ get_prn_entry(const LPoint3f& point) const {
 ////////////////////////////////////////////////////////////////////
 INLINE unsigned char LinearNoiseForce::
 get_prn_entry(const float x, const float y, const float z) const {
-  return prn_lookup(x + prn_lookup(y + prn_lookup(z)));
+  return prn_lookup((int)(x + prn_lookup((int)(y + prn_lookup((int)z)))));
 }
 
 ////////////////////////////////////////////////////////////////////

+ 1 - 0
panda/src/physics/linearNoiseForce.h

@@ -19,6 +19,7 @@
 #ifndef LINEARNOISEFORCE_H
 #define LINEARNOISEFORCE_H
 
+#include "pandabase.h"
 #include "linearRandomForce.h"
 
 ////////////////////////////////////////////////////////////////////

+ 3 - 0
panda/src/putil/Sources.pp

@@ -170,4 +170,7 @@
   #define SOURCES \
     test_linestream.cxx
 
+  #define LOCAL_LIBS $[LOCAL_LIBS] putil
+  #define OTHER_LIBS $[OTHER_LIBS] pystub
+
 #end test_bin_target

+ 3 - 11
panda/src/putil/lineStreamBuf.I

@@ -17,16 +17,6 @@
 ////////////////////////////////////////////////////////////////////
 
 
-////////////////////////////////////////////////////////////////////
-//     Function: LineStreamBuf::Constructor
-//       Access: Public
-//  Description:
-////////////////////////////////////////////////////////////////////
-INLINE LineStreamBuf::
-LineStreamBuf() {
-  _has_newline = false;
-}
-
 ////////////////////////////////////////////////////////////////////
 //     Function: LineStreamBuf::is_text_available
 //       Access: Public
@@ -56,5 +46,7 @@ has_newline() const {
 ////////////////////////////////////////////////////////////////////
 INLINE void LineStreamBuf::
 write_chars(const char *start, int length) {
-  _data += string(start, length);
+  if (length > 0) {
+    _data += string(start, length);
+  }
 }

+ 17 - 0
panda/src/putil/lineStreamBuf.cxx

@@ -23,6 +23,23 @@
 typedef int streamsize;
 #endif
 
+////////////////////////////////////////////////////////////////////
+//     Function: LineStreamBuf::Constructor
+//       Access: Public
+//  Description:
+////////////////////////////////////////////////////////////////////
+LineStreamBuf::
+LineStreamBuf() {
+  _has_newline = false;
+
+  // The LineStreamBuf doesn't actually need a buffer--it's happy
+  // writing characters one at a time, since they're just getting
+  // stuffed into a string.  (Although the code is written portably
+  // enough to use a buffer correctly, if we had one.)
+  setg(0, 0, 0);
+  setp(0, 0);
+}
+
 ////////////////////////////////////////////////////////////////////
 //     Function: LineStreamBuf::Destructor
 //       Access: Public, Virtual

+ 1 - 1
panda/src/putil/lineStreamBuf.h

@@ -32,7 +32,7 @@
 ////////////////////////////////////////////////////////////////////
 class EXPCL_PANDA LineStreamBuf : public streambuf {
 public:
-  INLINE LineStreamBuf();
+  LineStreamBuf();
   virtual ~LineStreamBuf();
 
   INLINE bool is_text_available() const;

+ 2 - 2
panda/src/testbed/pgrid.cxx

@@ -67,7 +67,7 @@ typedef enum {None,Rotation,LinearMotion} GriddedMotionType;
 #define GRIDCELLSIZE 5.0
 static int gridwidth;  // cells/side
 
-#define MIN_WANDERAREA_DIMENSION 120.0
+#define MIN_WANDERAREA_DIMENSION 120.0f
 
 static float grid_pos_offset;  // origin of grid
 static float wander_area_pos_offset;
@@ -249,7 +249,7 @@ load_gridded_models(WindowFramework *window,
   }
   
   grid_pos_offset = -gridwidth*GRIDCELLSIZE/2.0;
-  wander_area_pos_offset = -max(fabs(grid_pos_offset),MIN_WANDERAREA_DIMENSION/2.0);
+  wander_area_pos_offset = -max(fabs(grid_pos_offset), MIN_WANDERAREA_DIMENSION/2.0f);
 
   // Now walk through the list again, copying models into the scene
   // graph as we go.

+ 2 - 2
panda/src/text/textFont.h

@@ -29,8 +29,8 @@
 class Node;
 class TextGlyph;
 
-#ifdef __GNUC__
-// For some reason, gcc's <string> doesn't define this.
+#if defined(__GNUC__) && !defined(HAVE_IOSTREAM)
+// For some reason, early versions of gcc's <string> didn't define this.
 typedef basic_string<wchar_t> wstring;
 #endif
 

+ 3 - 3
panda/src/tform/mouseWatcher.cxx

@@ -496,9 +496,9 @@ intersect_regions(MouseWatcher::VRegions &result,
 void MouseWatcher::
 remove_region_from(MouseWatcher::VRegions &regions,
                    MouseWatcherRegion *region) {
-  VRegions::iterator ri = 
-    lower_bound(regions.begin(), regions.end(), region);
-  if (ri != regions.end() && (*ri) == region) {
+  PT(MouseWatcherRegion) ptr = region;
+  VRegions::iterator ri = lower_bound(regions.begin(), regions.end(), ptr);
+  if (ri != regions.end() && (*ri) == ptr) {
     // The region is in the vector.  Remove it.
     regions.erase(ri);
   }