build for gcc3.2

This commit is contained in:
David Rose 2003-01-17 16:42:36 +00:00
parent f277976827
commit 411a263fe8
80 changed files with 381 additions and 1668 deletions

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -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
// panda3d@yahoogroups.com .
//
////////////////////////////////////////////////////////////////////
#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));
}

File diff suppressed because it is too large Load Diff

View File

@ -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
// panda3d@yahoogroups.com .
//
////////////////////////////////////////////////////////////////////
#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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -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();
}
////////////////////////////////////////////////////////////////////

View File

@ -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();
}
////////////////////////////////////////////////////////////////////

View File

@ -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();
}
////////////////////////////////////////////////////////////////////

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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