mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-01 09:23:03 -04:00
Fix issues with OS X 10.9 compilation, fix issues uncovered by clang
This commit is contained in:
parent
ab8ebe6e30
commit
31a71c990d
@ -263,7 +263,7 @@ output(ostream &out) const {
|
||||
}
|
||||
|
||||
if ((*ei)._parm_number >= 0) {
|
||||
if (stringify) {
|
||||
if ((*ei)._stringify) {
|
||||
out << "#";
|
||||
}
|
||||
if ((*ei)._parm_number == _variadic_param) {
|
||||
@ -345,7 +345,7 @@ save_expansion(const string &exp, const vector_string ¶meter_names) {
|
||||
// Here's the start of an identifier. Find the end of it.
|
||||
size_t q = p;
|
||||
p++;
|
||||
while (p < exp.size() && isalnum(exp[p]) || exp[p] == '_') {
|
||||
while (p < exp.size() && (isalnum(exp[p]) || exp[p] == '_')) {
|
||||
p++;
|
||||
}
|
||||
|
||||
|
@ -123,6 +123,8 @@ typedef ios::seekdir ios_seekdir;
|
||||
#if defined(__has_extension) // Clang magic.
|
||||
#if __has_extension(cxx_constexpr)
|
||||
#define CONSTEXPR constexpr
|
||||
#else
|
||||
#define CONSTEXPR INLINE
|
||||
#endif
|
||||
#elif defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 7)) && (__cplusplus >= 201103L)
|
||||
#define CONSTEXPR constexpr
|
||||
|
@ -138,7 +138,7 @@ PUBLISHED:
|
||||
void inc_memory_usage(MemoryClass memory_class, int size);
|
||||
void dec_memory_usage(MemoryClass memory_class, int size);
|
||||
#else
|
||||
CONSTEXPR int get_memory_usage(MemoryClass) const { return 0; }
|
||||
static CONSTEXPR int get_memory_usage(MemoryClass) { return 0; }
|
||||
INLINE void inc_memory_usage(MemoryClass, int) { }
|
||||
INLINE void dec_memory_usage(MemoryClass, int) { }
|
||||
#endif // DO_MEMORY_USAGE
|
||||
|
@ -3055,7 +3055,7 @@ atomic_compare_and_exchange_contents(string &orig_contents,
|
||||
return false;
|
||||
}
|
||||
|
||||
size_t bytes_read = read(fd, buf, buf_size);
|
||||
ssize_t bytes_read = read(fd, buf, buf_size);
|
||||
while (bytes_read > 0) {
|
||||
orig_contents += string(buf, bytes_read);
|
||||
bytes_read = read(fd, buf, buf_size);
|
||||
@ -3176,7 +3176,7 @@ atomic_read_contents(string &contents) const {
|
||||
return false;
|
||||
}
|
||||
|
||||
size_t bytes_read = read(fd, buf, buf_size);
|
||||
ssize_t bytes_read = read(fd, buf, buf_size);
|
||||
while (bytes_read > 0) {
|
||||
contents += string(buf, bytes_read);
|
||||
bytes_read = read(fd, buf, buf_size);
|
||||
|
@ -366,7 +366,7 @@ matches_set(string::const_iterator &pi, string::const_iterator pend,
|
||||
char end = (*pi);
|
||||
++pi;
|
||||
|
||||
if (ch >= start && ch <= end ||
|
||||
if ((ch >= start && ch <= end) ||
|
||||
(!_case_sensitive &&
|
||||
((tolower(ch) >= start && tolower(ch) <= end) ||
|
||||
(toupper(ch) >= start && toupper(ch) <= end)))) {
|
||||
|
@ -2451,6 +2451,9 @@ write_function_for_top(ostream &out, InterfaceMaker::Object *obj, InterfaceMaker
|
||||
case AT_single_arg:
|
||||
fname += ", PyObject *arg";
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
fname += ")";
|
||||
|
||||
@ -3498,6 +3501,9 @@ write_function_instance(ostream &out, InterfaceMaker::Object *obj,
|
||||
++open_scopes;
|
||||
indent_level += 2;
|
||||
}
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1644,6 +1644,9 @@ get_template_parameter_type(CPPType *source_type, int i) {
|
||||
|
||||
case CPPDeclaration::ST_reference:
|
||||
return get_template_parameter_type(source_type->as_reference_type()->_pointing_at, i);
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
CPPStructType *type = source_type->as_struct_type();
|
||||
|
@ -3835,15 +3835,16 @@ if (PkgSkip("OPENSSL")==0 and not RTDIST and not RUNTIME and PkgSkip("DEPLOYTOOL
|
||||
TargetAdd('build_patch.exe', input=COMMON_PANDA_LIBS_PYSTUB)
|
||||
TargetAdd('build_patch.exe', opts=OPTS)
|
||||
|
||||
TargetAdd('check_adler_check_adler.obj', opts=OPTS, input='check_adler.cxx')
|
||||
TargetAdd('check_adler.exe', input=['check_adler_check_adler.obj'])
|
||||
TargetAdd('check_adler.exe', input=COMMON_PANDA_LIBS_PYSTUB)
|
||||
TargetAdd('check_adler.exe', opts=OPTS)
|
||||
if not PkgSkip("ZLIB"):
|
||||
TargetAdd('check_adler_check_adler.obj', opts=OPTS, input='check_adler.cxx')
|
||||
TargetAdd('check_adler.exe', input=['check_adler_check_adler.obj'])
|
||||
TargetAdd('check_adler.exe', input=COMMON_PANDA_LIBS_PYSTUB)
|
||||
TargetAdd('check_adler.exe', opts=OPTS)
|
||||
|
||||
TargetAdd('check_crc_check_crc.obj', opts=OPTS, input='check_crc.cxx')
|
||||
TargetAdd('check_crc.exe', input=['check_crc_check_crc.obj'])
|
||||
TargetAdd('check_crc.exe', input=COMMON_PANDA_LIBS_PYSTUB)
|
||||
TargetAdd('check_crc.exe', opts=OPTS)
|
||||
TargetAdd('check_crc_check_crc.obj', opts=OPTS, input='check_crc.cxx')
|
||||
TargetAdd('check_crc.exe', input=['check_crc_check_crc.obj'])
|
||||
TargetAdd('check_crc.exe', input=COMMON_PANDA_LIBS_PYSTUB)
|
||||
TargetAdd('check_crc.exe', opts=OPTS)
|
||||
|
||||
TargetAdd('check_md5_check_md5.obj', opts=OPTS, input='check_md5.cxx')
|
||||
TargetAdd('check_md5.exe', input=['check_md5_check_md5.obj'])
|
||||
|
@ -1536,20 +1536,18 @@ def SmartPkgEnable(pkg, pkgconfig = None, libs = None, incs = None, defs = None,
|
||||
return
|
||||
|
||||
elif (GetHost() == "darwin" and framework != None):
|
||||
if (os.path.isdir("/Library/Frameworks/%s.framework" % framework) or
|
||||
os.path.isdir("/System/Library/Frameworks/%s.framework" % framework) or
|
||||
os.path.isdir("/Developer/Library/Frameworks/%s.framework" % framework) or
|
||||
os.path.isdir("/Users/%s/System/Library/Frameworks/%s.framework" % (getpass.getuser(), framework))):
|
||||
prefix = SDK["MACOSX"]
|
||||
if (os.path.isdir(prefix + "/Library/Frameworks/%s.framework" % framework) or
|
||||
os.path.isdir(prefix + "/System/Library/Frameworks/%s.framework" % framework) or
|
||||
os.path.isdir(prefix + "/Developer/Library/Frameworks/%s.framework" % framework) or
|
||||
os.path.isdir(prefix + "/Users/%s/System/Library/Frameworks/%s.framework" % (getpass.getuser(), framework))):
|
||||
LibName(target_pkg, "-framework " + framework)
|
||||
for d, v in defs.values():
|
||||
DefSymbol(target_pkg, d, v)
|
||||
elif (pkg in PkgListGet()):
|
||||
print("%sWARNING:%s Could not locate framework %s, excluding from build" % (GetColor("red"), GetColor(), framework))
|
||||
PkgDisable(pkg)
|
||||
else:
|
||||
print("%sERROR:%s Could not locate framework %s, aborting build" % (GetColor("red"), GetColor(), framework))
|
||||
exit()
|
||||
return
|
||||
return
|
||||
|
||||
elif VERBOSE:
|
||||
print(ColorText("cyan", "Couldn't find the framework %s" % (framework)))
|
||||
|
||||
elif (LocateBinary(tool) != None and (tool != "pkg-config" or pkgconfig != None)):
|
||||
if (isinstance(pkgconfig, str) or tool != "pkg-config"):
|
||||
@ -2280,10 +2278,15 @@ def SetupBuildEnvironment(compiler):
|
||||
# Invoke gcc to determine the system library directories.
|
||||
global SYS_LIB_DIRS
|
||||
|
||||
# gcc doesn't add this one, but we do want it:
|
||||
local_lib = SDK.get("SYSROOT", "") + "/usr/local/lib"
|
||||
if os.path.isdir(local_lib):
|
||||
SYS_LIB_DIRS.append(local_lib)
|
||||
if sys.platform == "darwin":
|
||||
# We need to add this one explicitly.
|
||||
SYS_LIB_DIRS.append(SDK["MACOSX"] + "/usr/lib")
|
||||
|
||||
elif not SDK["MACOSX"]:
|
||||
# gcc doesn't add this one, but we do want it:
|
||||
local_lib = SDK.get("SYSROOT", "") + "/usr/local/lib"
|
||||
if os.path.isdir(local_lib):
|
||||
SYS_LIB_DIRS.append(local_lib)
|
||||
|
||||
cmd = GetCXX() + " -print-search-dirs"
|
||||
|
||||
|
@ -473,7 +473,7 @@ test_intersection_from_sphere(const CollisionEntry &entry) const {
|
||||
|
||||
LVector3 normal = (has_effective_normal() && sphere->get_respect_effective_normal()) ? get_effective_normal() : get_normal();
|
||||
#ifndef NDEBUG
|
||||
if (!IS_THRESHOLD_EQUAL(normal.length_squared(), 1.0f, 0.001), NULL) {
|
||||
if (!IS_THRESHOLD_EQUAL(normal.length_squared(), 1.0f, 0.001)) {
|
||||
collide_cat.info()
|
||||
<< "polygon within " << entry.get_into_node_path()
|
||||
<< " has normal " << normal << " of length " << normal.length()
|
||||
|
@ -574,7 +574,7 @@ translate_key(int &keycode, int os_code, unsigned int flags) const {
|
||||
keycode = os_code & 0xff;
|
||||
}
|
||||
|
||||
#endif __APPLE__
|
||||
#endif // __APPLE__
|
||||
|
||||
return nk;
|
||||
}
|
||||
|
@ -198,7 +198,7 @@ underflow() {
|
||||
#ifdef IS_OSX
|
||||
// occassionally we get -1 on read_open on the mac
|
||||
// the os_error is 35 which means "Resource temporarily unavailable".
|
||||
if ( (_read_open == -1) && (os_error == 35)) {
|
||||
if (!_read_open && os_error == 35) {
|
||||
downloader_cat.warning() << "forcing retry to true again and _read_open to true\n";
|
||||
BIO_set_retry_read(*_source);
|
||||
_read_open = true;
|
||||
|
@ -79,6 +79,8 @@ write_datagram(Datagram &dg) const {
|
||||
case T_resume_down:
|
||||
case T_up:
|
||||
case T_repeat:
|
||||
case T_raw_down:
|
||||
case T_raw_up:
|
||||
// We write the button name. This is not particularly compact, but
|
||||
// presumably we don't get thousands of button events per frame, and
|
||||
// it is robust as the button index may change between sessions but
|
||||
@ -118,6 +120,8 @@ read_datagram(DatagramIterator &scan) {
|
||||
case T_resume_down:
|
||||
case T_up:
|
||||
case T_repeat:
|
||||
case T_raw_down:
|
||||
case T_raw_up:
|
||||
_button = ButtonRegistry::ptr()->get_button(scan.get_string());
|
||||
break;
|
||||
|
||||
|
@ -262,19 +262,20 @@ issue_parameters(int altered) {
|
||||
switch(_ptr._info._class) {
|
||||
case Shader::SAC_scalar: cgSetParameter1fv(p,(float*)ptr_data->_ptr); continue;
|
||||
case Shader::SAC_vector:
|
||||
switch(_ptr._info._type) {
|
||||
switch (_ptr._info._type) {
|
||||
case Shader::SAT_vec1: cgSetParameter1fv(p,(float*)ptr_data->_ptr); continue;
|
||||
case Shader::SAT_vec2: cgSetParameter2fv(p,(float*)ptr_data->_ptr); continue;
|
||||
case Shader::SAT_vec3: cgSetParameter3fv(p,(float*)ptr_data->_ptr); continue;
|
||||
case Shader::SAT_vec4: cgSetParameter4fv(p,(float*)ptr_data->_ptr); continue;
|
||||
default: nassertd(false) continue;
|
||||
}
|
||||
case Shader::SAC_matrix: cgGLSetMatrixParameterfc(p,(float*)ptr_data->_ptr); continue;
|
||||
case Shader::SAC_array: {
|
||||
switch(_ptr._info._subclass) {
|
||||
switch (_ptr._info._subclass) {
|
||||
case Shader::SAC_scalar:
|
||||
cgGLSetParameterArray1f(p,0,_ptr._dim[0],(float*)ptr_data->_ptr); continue;
|
||||
case Shader::SAC_vector:
|
||||
switch(_ptr._dim[2]) {
|
||||
switch (_ptr._dim[2]) {
|
||||
case 1: cgGLSetParameterArray1f(p,0,_ptr._dim[0],(float*)ptr_data->_ptr); continue;
|
||||
case 2: cgGLSetParameterArray2f(p,0,_ptr._dim[0],(float*)ptr_data->_ptr); continue;
|
||||
case 3: cgGLSetParameterArray3f(p,0,_ptr._dim[0],(float*)ptr_data->_ptr); continue;
|
||||
@ -294,6 +295,7 @@ issue_parameters(int altered) {
|
||||
case Shader::SAT_vec2: cgSetParameter2dv(p,(double*)ptr_data->_ptr); continue;
|
||||
case Shader::SAT_vec3: cgSetParameter3dv(p,(double*)ptr_data->_ptr); continue;
|
||||
case Shader::SAT_vec4: cgSetParameter4dv(p,(double*)ptr_data->_ptr); continue;
|
||||
default: nassertd(false) continue;
|
||||
}
|
||||
case Shader::SAC_matrix: cgGLSetMatrixParameterdc(p,(double*)ptr_data->_ptr); continue;
|
||||
case Shader::SAC_array: {
|
||||
|
@ -1003,6 +1003,9 @@ bind_slot_multisample(bool rb_resize, Texture **attach, RenderTexturePlane slot,
|
||||
case Texture::F_depth_component32:
|
||||
format = GL_DEPTH_COMPONENT32;
|
||||
break;
|
||||
default:
|
||||
format = GL_DEPTH_COMPONENT;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (_requested_coverage_samples) {
|
||||
@ -1046,7 +1049,10 @@ bind_slot_multisample(bool rb_resize, Texture **attach, RenderTexturePlane slot,
|
||||
case RTP_aux_float_3:
|
||||
gl_format = GL_RGBA32F_ARB;
|
||||
break;
|
||||
};
|
||||
default:
|
||||
gl_format = GL_RGBA;
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
glgsg->_glBindRenderbuffer(GL_RENDERBUFFER_EXT, _rbm[slot]);
|
||||
if (_requested_coverage_samples) {
|
||||
|
@ -4892,6 +4892,9 @@ issue_timer_query(int pstats_index) {
|
||||
_pending_timer_queries.push_back(DCAST(TimerQueryContext, query));
|
||||
|
||||
return DCAST(TimerQueryContext, query);
|
||||
|
||||
#else
|
||||
return NULL;
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -6838,6 +6841,10 @@ get_numeric_type(Geom::NumericType numeric_type) {
|
||||
case Geom::NT_float64:
|
||||
return GL_DOUBLE;
|
||||
#endif
|
||||
|
||||
case Geom::NT_stdfloat:
|
||||
// Shouldn't happen, display error.
|
||||
break;
|
||||
}
|
||||
|
||||
GLCAT.error()
|
||||
@ -7123,6 +7130,7 @@ get_external_image_format(Texture *tex) const {
|
||||
case Texture::F_blue:
|
||||
case Texture::F_r16:
|
||||
case Texture::F_r32:
|
||||
case Texture::F_r32i:
|
||||
return GL_COMPRESSED_RED;
|
||||
|
||||
case Texture::F_rg16:
|
||||
@ -7336,7 +7344,11 @@ get_internal_image_format(Texture *tex) const {
|
||||
switch (format) {
|
||||
case Texture::F_color_index:
|
||||
case Texture::F_depth_component:
|
||||
case Texture::F_depth_component16:
|
||||
case Texture::F_depth_component24:
|
||||
case Texture::F_depth_component32:
|
||||
case Texture::F_depth_stencil:
|
||||
case Texture::F_r32i:
|
||||
// Unsupported; fall through to below.
|
||||
break;
|
||||
|
||||
@ -7428,8 +7440,6 @@ get_internal_image_format(Texture *tex) const {
|
||||
return GL_COMPRESSED_RGBA_FXT1_3DFX;
|
||||
}
|
||||
return GL_COMPRESSED_LUMINANCE_ALPHA;
|
||||
}
|
||||
break;
|
||||
|
||||
case Texture::F_srgb:
|
||||
if (get_supports_compressed_texture_format(Texture::CM_dxt1) && !is_3d) {
|
||||
@ -7448,6 +7458,8 @@ get_internal_image_format(Texture *tex) const {
|
||||
|
||||
case Texture::F_sluminance_alpha:
|
||||
return GL_COMPRESSED_SLUMINANCE_ALPHA;
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
|
||||
case Texture::CM_dxt1:
|
||||
@ -7802,6 +7814,9 @@ get_texture_apply_mode_type(TextureStage::Mode am) {
|
||||
case TextureStage::M_blend_color_scale: return GL_BLEND;
|
||||
case TextureStage::M_modulate_glow: return GL_MODULATE;
|
||||
case TextureStage::M_modulate_gloss: return GL_MODULATE;
|
||||
default:
|
||||
// Other modes shouldn't get here. Fall through and error.
|
||||
break;
|
||||
}
|
||||
|
||||
GLCAT.error()
|
||||
|
@ -928,6 +928,7 @@ issue_parameters(int altered) {
|
||||
}
|
||||
case Shader::SPT_double:
|
||||
GLCAT.error() << "Passing double-precision shader inputs to GLSL shaders is not currently supported\n";
|
||||
default:
|
||||
continue;
|
||||
}
|
||||
}
|
||||
@ -1441,6 +1442,8 @@ glsl_compile_shader(Shader::ShaderType type) {
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
break;
|
||||
}
|
||||
if (!handle) {
|
||||
GLCAT.error()
|
||||
|
@ -37,7 +37,7 @@ public:
|
||||
GLuint64 get_handle();
|
||||
|
||||
#ifdef OPENGLES
|
||||
CONSTEXPR bool needs_barrier(GLbitfield barrier) { return false; };
|
||||
static CONSTEXPR bool needs_barrier(GLbitfield barrier) { return false; };
|
||||
#else
|
||||
bool needs_barrier(GLbitfield barrier);
|
||||
void mark_incoherent(bool wrote);
|
||||
|
@ -273,10 +273,10 @@ generate_block(unsigned short mx,
|
||||
double GeoMipTerrain::
|
||||
get_elevation(double x, double y) {
|
||||
y = (_ysize - 1) - y;
|
||||
if (x < 0.0) x = 0.0;
|
||||
if (y < 0.0) y = 0.0;
|
||||
unsigned int xlo = (unsigned int) x;
|
||||
unsigned int ylo = (unsigned int) y;
|
||||
if (xlo < 0) xlo = 0;
|
||||
if (ylo < 0) ylo = 0;
|
||||
if (xlo > _xsize - 2)
|
||||
xlo = _xsize - 2;
|
||||
if (ylo > _ysize - 2)
|
||||
|
@ -192,8 +192,8 @@ r_collect(PandaNode *node, const RenderState *state,
|
||||
CPT(RenderState) next_state = state->compose(node->get_state());
|
||||
CPT(VertexTransform) next_transform = transform;
|
||||
if (!node->get_transform()->is_identity() ||
|
||||
node->is_of_type(ModelNode::get_class_type()) &&
|
||||
DCAST(ModelNode, node)->get_preserve_transform() != ModelNode::PT_none) {
|
||||
(node->is_of_type(ModelNode::get_class_type()) &&
|
||||
DCAST(ModelNode, node)->get_preserve_transform() != ModelNode::PT_none)) {
|
||||
// This node has a transform we need to keep.
|
||||
PT(NodeVertexTransform) new_transform = new NodeVertexTransform(node, transform);
|
||||
_internal_transforms.push_back(new_transform);
|
||||
|
@ -854,17 +854,21 @@ merge_trapezoids(int segnum, int tfirst, int tlast, int side) {
|
||||
|
||||
/* Change the upper neighbours of the lower trapezoids */
|
||||
|
||||
if ((tr[t].d0 = tr[tnext].d0) > 0)
|
||||
if (tr[tr[t].d0].u0 == tnext)
|
||||
if ((tr[t].d0 = tr[tnext].d0) > 0) {
|
||||
if (tr[tr[t].d0].u0 == tnext) {
|
||||
tr[tr[t].d0].u0 = t;
|
||||
else if (tr[tr[t].d0].u1 == tnext)
|
||||
} else if (tr[tr[t].d0].u1 == tnext) {
|
||||
tr[tr[t].d0].u1 = t;
|
||||
}
|
||||
}
|
||||
|
||||
if ((tr[t].d1 = tr[tnext].d1) > 0)
|
||||
if (tr[tr[t].d1].u0 == tnext)
|
||||
if ((tr[t].d1 = tr[tnext].d1) > 0) {
|
||||
if (tr[tr[t].d1].u0 == tnext) {
|
||||
tr[tr[t].d1].u0 = t;
|
||||
else if (tr[tr[t].d1].u1 == tnext)
|
||||
} else if (tr[tr[t].d1].u1 == tnext) {
|
||||
tr[tr[t].d1].u1 = t;
|
||||
}
|
||||
}
|
||||
|
||||
tr[t].lo = tr[tnext].lo;
|
||||
tr[tnext].state = ST_INVALID; /* invalidate the lower */
|
||||
|
@ -34,21 +34,28 @@ private:
|
||||
struct AddressQueue : private pvector<Socket_Address> // this is used to do a round robin for addres to connect to ..
|
||||
{
|
||||
size_t _active_index;
|
||||
bool GetNext(Socket_Address &out)
|
||||
{
|
||||
|
||||
INLINE AddressQueue() : _active_index(0) {}
|
||||
|
||||
bool GetNext(Socket_Address &out) {
|
||||
size_t the_size = size();
|
||||
if(the_size == 0)
|
||||
if (the_size == 0) {
|
||||
return false;
|
||||
|
||||
if(_active_index >= the_size || _active_index < 0)
|
||||
}
|
||||
|
||||
if (_active_index >= the_size) {
|
||||
_active_index = 0;
|
||||
}
|
||||
|
||||
out = (*this)[_active_index++];
|
||||
return true;
|
||||
}
|
||||
|
||||
void clear() { pvector<Socket_Address>::clear(); };
|
||||
void push_back(Socket_Address &address)
|
||||
{
|
||||
INLINE void clear() {
|
||||
pvector<Socket_Address>::clear();
|
||||
}
|
||||
|
||||
void push_back(Socket_Address &address) {
|
||||
iterator ii;
|
||||
for(ii = begin(); ii != end(); ii++)
|
||||
if(*ii == address)
|
||||
@ -58,8 +65,9 @@ private:
|
||||
|
||||
size_t size() { return pvector<Socket_Address>::size(); };
|
||||
};
|
||||
|
||||
protected:
|
||||
// c++ upcals for
|
||||
// c++ upcalls for
|
||||
virtual void PostConnect(void) { };
|
||||
virtual void NewWriteBuffer(void) { };
|
||||
///////////////////////////////////////////
|
||||
|
@ -396,12 +396,13 @@ save_file(const Filename &filename, const LoaderOptions &options,
|
||||
<< "Cannot save " << this_filename
|
||||
<< " without filename extension.\n";
|
||||
}
|
||||
return NULL;
|
||||
return false;
|
||||
}
|
||||
|
||||
LoaderFileTypeRegistry *reg = LoaderFileTypeRegistry::get_global_ptr();
|
||||
LoaderFileType *requested_type =
|
||||
reg->get_type_from_extension(extension);
|
||||
|
||||
if (requested_type == (LoaderFileType *)NULL) {
|
||||
if (report_errors) {
|
||||
loader_cat.error()
|
||||
@ -411,21 +412,23 @@ save_file(const Filename &filename, const LoaderOptions &options,
|
||||
<< "Currently known scene file types are:\n";
|
||||
reg->write(loader_cat.error(false), 2);
|
||||
}
|
||||
return NULL;
|
||||
return false;
|
||||
|
||||
} else if (!requested_type->supports_save()) {
|
||||
if (report_errors) {
|
||||
loader_cat.error()
|
||||
<< requested_type->get_name() << " file type (."
|
||||
<< extension << ") does not support saving.\n";
|
||||
}
|
||||
return NULL;
|
||||
return false;
|
||||
|
||||
} else if (pz_file && !requested_type->supports_compressed()) {
|
||||
if (report_errors) {
|
||||
loader_cat.error()
|
||||
<< requested_type->get_name() << " file type (."
|
||||
<< extension << ") does not support in-line compression.\n";
|
||||
}
|
||||
return NULL;
|
||||
return false;
|
||||
}
|
||||
|
||||
VirtualFileSystem *vfs = VirtualFileSystem::get_global_ptr();
|
||||
|
@ -138,5 +138,5 @@ save_file(const Filename &path, const LoaderOptions &options,
|
||||
PandaNode *node) const {
|
||||
loader_cat.error()
|
||||
<< get_type() << " cannot save PandaNode objects.\n";
|
||||
return NULL;
|
||||
return false;
|
||||
}
|
||||
|
@ -77,6 +77,6 @@ is_ready() const {
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE bool ModelSaveRequest::
|
||||
get_success() const {
|
||||
nassertr(_is_ready, NULL);
|
||||
nassertr(_is_ready, false);
|
||||
return _success;
|
||||
}
|
||||
|
@ -1811,6 +1811,9 @@ compute_planar_bounds(const LPoint2f ¢er, PN_float32 point_dist, PN_float32
|
||||
LPoint3(max_x, min_y, min_z), LPoint3(min_x, min_y, min_z),
|
||||
LPoint3(max_x, min_y, max_z), LPoint3(min_x, min_y, max_z));
|
||||
break;
|
||||
|
||||
default:
|
||||
nassertr(false, NULL);
|
||||
}
|
||||
|
||||
// Rotate the bounding volume back into the original space of the
|
||||
|
@ -556,7 +556,7 @@ pgm_writepgminit(ostream * const fileP,
|
||||
|
||||
(*fileP)
|
||||
<< (char)PGM_MAGIC1
|
||||
<< (char)(plainFormat || maxval >= 1<<16 ? PGM_MAGIC2 : RPGM_MAGIC2)
|
||||
<< (char)(plainFormat /*|| maxval >= 1<<16*/ ? PGM_MAGIC2 : RPGM_MAGIC2)
|
||||
<< '\n'
|
||||
<< cols << ' ' << rows << '\n' << maxval << '\n';
|
||||
}
|
||||
@ -577,7 +577,7 @@ ppm_writeppminit(ostream* const fileP,
|
||||
|
||||
(*fileP)
|
||||
<< (char)PPM_MAGIC1
|
||||
<< (char)(plainFormat || maxval >= 1<<16 ? PPM_MAGIC2 : RPPM_MAGIC2)
|
||||
<< (char)(plainFormat /*|| maxval >= 1<<16*/ ? PPM_MAGIC2 : RPPM_MAGIC2)
|
||||
<< '\n'
|
||||
<< cols << ' ' << rows << '\n' << maxval << '\n';
|
||||
}
|
||||
@ -806,7 +806,7 @@ pgm_writepgmrow(ostream* const fileP,
|
||||
gray const maxval,
|
||||
int const forceplain) {
|
||||
|
||||
if (forceplain || pm_plain_output || maxval >= 1<<16)
|
||||
if (forceplain || pm_plain_output /*|| maxval >= 1<<16*/)
|
||||
pgm_writepgmrowplain(fileP, grayrow, cols, maxval);
|
||||
else
|
||||
pgm_writepgmrowraw(fileP, grayrow, cols, maxval);
|
||||
@ -893,7 +893,7 @@ ppm_writeppmrow(ostream * const fileP,
|
||||
pixval const maxval,
|
||||
int const forceplain) {
|
||||
|
||||
if (forceplain || pm_plain_output || maxval >= 1<<16)
|
||||
if (forceplain || pm_plain_output /*|| maxval >= 1<<16*/)
|
||||
ppm_writeppmrowplain(fileP, pixelrow, cols, maxval);
|
||||
else
|
||||
ppm_writeppmrowraw(fileP, pixelrow, cols, maxval);
|
||||
|
@ -1042,7 +1042,9 @@ draw_triangles(const GeomPrimitivePipelineReader *reader, bool force) {
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
tinydisplay_cat.error()
|
||||
<< "Invalid index type " << reader->get_index_type() << "!\n";
|
||||
return false;
|
||||
}
|
||||
|
||||
} else {
|
||||
@ -1161,6 +1163,11 @@ draw_tristrips(const GeomPrimitivePipelineReader *reader, bool force) {
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
tinydisplay_cat.error()
|
||||
<< "Invalid index type " << reader->get_index_type() << "!\n";
|
||||
return false;
|
||||
}
|
||||
|
||||
start = ends[i] + 2;
|
||||
@ -1258,7 +1265,9 @@ draw_lines(const GeomPrimitivePipelineReader *reader, bool force) {
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
tinydisplay_cat.error()
|
||||
<< "Invalid index type " << reader->get_index_type() << "!\n";
|
||||
return false;
|
||||
}
|
||||
|
||||
} else {
|
||||
@ -1332,7 +1341,9 @@ draw_points(const GeomPrimitivePipelineReader *reader, bool force) {
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
tinydisplay_cat.error()
|
||||
<< "Invalid index type " << reader->get_index_type() << "!\n";
|
||||
return false;
|
||||
}
|
||||
|
||||
} else {
|
||||
@ -2591,6 +2602,12 @@ upload_texture(TinyTextureContext *gtc, bool force) {
|
||||
case Texture::F_luminance_alpha:
|
||||
copy_la_image(dest, xsize, ysize, gtc, level);
|
||||
break;
|
||||
|
||||
default:
|
||||
tinydisplay_cat.error()
|
||||
<< "Unsupported texture format "
|
||||
<< tex->get_format() << "!\n";
|
||||
return false;
|
||||
}
|
||||
|
||||
bytecount += xsize * ysize * 4;
|
||||
|
@ -676,7 +676,8 @@ string_mfndata_type(MFnData::Type type) {
|
||||
return "kSubdSurface";
|
||||
|
||||
case MFnData::kLast:
|
||||
return "kLast";
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return "**invalid**";
|
||||
|
@ -175,7 +175,7 @@ MStatus create_enum_attribute(MObject &node, MString fullName, MString briefName
|
||||
0, &stat );
|
||||
if ( MS::kSuccess != stat ) {
|
||||
mayaloader_cat.error()
|
||||
<< "Could not create new enum attribute " << fullName << "\n";
|
||||
<< "Could not create new enum attribute " << fullName.asChar() << "\n";
|
||||
return stat;
|
||||
}
|
||||
for (unsigned i = 0; i < fieldNames.length(); i++){
|
||||
@ -185,7 +185,7 @@ MStatus create_enum_attribute(MObject &node, MString fullName, MString briefName
|
||||
stat = fnAttr.setDefault(fieldIndex);
|
||||
if ( MS::kSuccess != stat ) {
|
||||
mayaloader_cat.error()
|
||||
<< "Could not set value for enum attribute " << fullName << "\n";
|
||||
<< "Could not set value for enum attribute " << fullName.asChar() << "\n";
|
||||
return stat;
|
||||
}
|
||||
|
||||
@ -195,10 +195,10 @@ MStatus create_enum_attribute(MObject &node, MString fullName, MString briefName
|
||||
fnAttr.setStorable( true );
|
||||
|
||||
// Now add the new attribute to this dependency node
|
||||
stat = fnDN.addAttribute(newAttr,MFnDependencyNode::kLocalDynamicAttr);
|
||||
stat = fnDN.addAttribute(newAttr, MFnDependencyNode::kLocalDynamicAttr);
|
||||
if ( MS::kSuccess != stat ) {
|
||||
mayaloader_cat.error()
|
||||
<< "Could not add new enum attribute " << fullName << "\n";
|
||||
<< "Could not add new enum attribute " << fullName.asChar() << "\n";
|
||||
return stat;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user