diff --git a/direct/src/dcparser/dcClass.cxx b/direct/src/dcparser/dcClass.cxx index 4c428db595..374ed47d3c 100644 --- a/direct/src/dcparser/dcClass.cxx +++ b/direct/src/dcparser/dcClass.cxx @@ -1240,7 +1240,7 @@ shadow_inherited_field(const string &name) { } // If we get here, the named field wasn't in the list. Huh. - nassertv(false); + nassert_raise("named field not in list"); } /** diff --git a/dtool/src/prc/notifyCategory.cxx b/dtool/src/prc/notifyCategory.cxx index 11a3c52587..3d856ceb08 100644 --- a/dtool/src/prc/notifyCategory.cxx +++ b/dtool/src/prc/notifyCategory.cxx @@ -110,7 +110,7 @@ out(NotifySeverity severity, bool prefix) const { nout << *this << "(" << severity << "): "; } if (assert_abort) { - nassertr(false, nout); + nassert_raise("unprotected debug statement"); } return nout; diff --git a/panda/src/chan/animChannelMatrixXfmTable.cxx b/panda/src/chan/animChannelMatrixXfmTable.cxx index c6c27b8b7a..5370a9833e 100644 --- a/panda/src/chan/animChannelMatrixXfmTable.cxx +++ b/panda/src/chan/animChannelMatrixXfmTable.cxx @@ -239,7 +239,7 @@ set_table(char table_id, const CPTA_stdfloat &table) { if (table.size() > 1 && (int)table.size() < num_frames) { // The new table has an invalid number of frames--it doesn't match the // bundle's requirement. - nassertv(false); + nassert_raise("mismatched number of frames"); return; } diff --git a/panda/src/chan/animChannelScalarTable.cxx b/panda/src/chan/animChannelScalarTable.cxx index 54953164e7..ae95b3d1ea 100644 --- a/panda/src/chan/animChannelScalarTable.cxx +++ b/panda/src/chan/animChannelScalarTable.cxx @@ -104,7 +104,7 @@ set_table(const CPTA_stdfloat &table) { if (table.size() > 1 && (int)table.size() < num_frames) { // The new table has an invalid number of frames--it doesn't match the // bundle's requirement. - nassertv(false); + nassert_raise("mismatched number of frames"); return; } diff --git a/panda/src/display/graphicsStateGuardian.cxx b/panda/src/display/graphicsStateGuardian.cxx index 93c732e5d7..1b0caeabd0 100644 --- a/panda/src/display/graphicsStateGuardian.cxx +++ b/panda/src/display/graphicsStateGuardian.cxx @@ -743,7 +743,7 @@ issue_timer_query(int pstats_index) { */ void GraphicsStateGuardian:: dispatch_compute(int num_groups_x, int num_groups_y, int num_groups_z) { - nassertv(false /* Compute shaders not supported by GSG */); + nassert_raise("Compute shaders not supported by GSG"); } /** diff --git a/panda/src/egg/eggGroup.cxx b/panda/src/egg/eggGroup.cxx index a5ff1dee06..6bc6f152f0 100644 --- a/panda/src/egg/eggGroup.cxx +++ b/panda/src/egg/eggGroup.cxx @@ -192,7 +192,8 @@ write(ostream &out, int indent_level) const { default: // invalid group type - nassertv(false); + nassert_raise("invalid EggGroup type"); + return; } if (is_of_type(EggBin::get_class_type())) { diff --git a/panda/src/egg/eggVertexPool.cxx b/panda/src/egg/eggVertexPool.cxx index 6f2768599e..65d5f747bf 100644 --- a/panda/src/egg/eggVertexPool.cxx +++ b/panda/src/egg/eggVertexPool.cxx @@ -445,7 +445,8 @@ add_vertex(EggVertex *vertex, int index) { } // Oops, you duplicated a vertex index. - nassertr(false, nullptr); + nassert_raise("duplicate vertex index"); + return nullptr; } _unique_vertices.insert(vertex); diff --git a/panda/src/egg/eggXfmAnimData.cxx b/panda/src/egg/eggXfmAnimData.cxx index 73a7128036..0216ea1bdd 100644 --- a/panda/src/egg/eggXfmAnimData.cxx +++ b/panda/src/egg/eggXfmAnimData.cxx @@ -142,7 +142,8 @@ get_value(int row, LMatrix4d &mat) const { default: // The contents string contained an invalid letter. - nassertv(false); + nassert_raise("invalid letter in contents string"); + return; } } diff --git a/panda/src/egg/eggXfmSAnim.cxx b/panda/src/egg/eggXfmSAnim.cxx index 43a784b33f..4158d46491 100644 --- a/panda/src/egg/eggXfmSAnim.cxx +++ b/panda/src/egg/eggXfmSAnim.cxx @@ -368,7 +368,8 @@ get_value(int row, LMatrix4d &mat) const { default: // One of the child tables had an invalid name. - nassertv(false); + nassert_raise("invalid name in child table"); + return; } } } diff --git a/panda/src/event/asyncFuture.cxx b/panda/src/event/asyncFuture.cxx index 16540954ed..4805650260 100644 --- a/panda/src/event/asyncFuture.cxx +++ b/panda/src/event/asyncFuture.cxx @@ -298,7 +298,7 @@ wake_task(AsyncTask *task) { return; default: - nassertv(false); + nassert_raise("unexpected task state"); return; } } diff --git a/panda/src/event/pointerEvent.cxx b/panda/src/event/pointerEvent.cxx index 7ee7d3621c..752210cf86 100644 --- a/panda/src/event/pointerEvent.cxx +++ b/panda/src/event/pointerEvent.cxx @@ -29,7 +29,7 @@ output(std::ostream &out) const { */ void PointerEvent:: write_datagram(Datagram &dg) const { - nassertv(false && "This function not implemented yet."); + nassert_raise("This function not implemented yet."); } /** @@ -37,5 +37,5 @@ write_datagram(Datagram &dg) const { */ void PointerEvent:: read_datagram(DatagramIterator &scan) { - nassertv(false && "This function not implemented yet."); + nassert_raise("This function not implemented yet."); } diff --git a/panda/src/glstuff/glGeomContext_src.cxx b/panda/src/glstuff/glGeomContext_src.cxx index 2640c1d855..f798dedb36 100644 --- a/panda/src/glstuff/glGeomContext_src.cxx +++ b/panda/src/glstuff/glGeomContext_src.cxx @@ -32,7 +32,7 @@ get_display_list(GLuint &index, const CLP(GeomMunger) *munger, UpdateSeq modified) { #if defined(OPENGLES) || !defined(SUPPORT_FIXED_FUNCTION) // Display lists not supported by OpenGL ES. - nassertr(false, false); + nassert_raise("OpenGL ES does not support display lists"); return false; #else diff --git a/panda/src/glstuff/glGraphicsStateGuardian_src.cxx b/panda/src/glstuff/glGraphicsStateGuardian_src.cxx index 9118366a93..14fec5d146 100644 --- a/panda/src/glstuff/glGraphicsStateGuardian_src.cxx +++ b/panda/src/glstuff/glGraphicsStateGuardian_src.cxx @@ -14144,8 +14144,8 @@ extract_texture_image(PTA_uchar &image, size_t &page_size, Texture::ComponentType type, Texture::CompressionMode compression, int n) { #ifdef OPENGLES // Extracting texture data unsupported in OpenGL ES. - nassertr(false, false); - return false; + nassert_raise("OpenGL ES does not support extracting texture data"); + return false; #else // Make sure the GL driver does not align textures, otherwise we get corrupt diff --git a/panda/src/gobj/geom.cxx b/panda/src/gobj/geom.cxx index 03409b4220..8bede7327b 100644 --- a/panda/src/gobj/geom.cxx +++ b/panda/src/gobj/geom.cxx @@ -1504,7 +1504,7 @@ clear_prepared(PreparedGraphicsObjects *prepared_objects) { } else { // If this assertion fails, clear_prepared() was given a prepared_objects // that the geom didn't know about. - nassertv(false); + nassert_raise("unknown PreparedGraphicsObjects"); } } diff --git a/panda/src/gobj/geomCacheManager.cxx b/panda/src/gobj/geomCacheManager.cxx index 4eb06a25b4..4911a981c6 100644 --- a/panda/src/gobj/geomCacheManager.cxx +++ b/panda/src/gobj/geomCacheManager.cxx @@ -47,7 +47,7 @@ GeomCacheManager() : GeomCacheManager:: ~GeomCacheManager() { // Shouldn't be deleting this global object. - nassertv(false); + nassert_raise("attempt to delete GeomCacheManager"); } /** diff --git a/panda/src/gobj/geomPrimitive.cxx b/panda/src/gobj/geomPrimitive.cxx index da3c10dffd..011d66b132 100644 --- a/panda/src/gobj/geomPrimitive.cxx +++ b/panda/src/gobj/geomPrimitive.cxx @@ -221,7 +221,7 @@ add_vertex(int vertex) { ((uint32_t *)ptr)[num_rows] = vertex; break; default: - nassertv(false); + nassert_raise("unsupported index type"); break; } } @@ -1510,7 +1510,7 @@ clear_prepared(PreparedGraphicsObjects *prepared_objects) { } else { // If this assertion fails, clear_prepared() was given a prepared_objects // which the data array didn't know about. - nassertv(false); + nassert_raise("unknown PreparedGraphicsObjects"); } } @@ -2230,7 +2230,7 @@ get_vertex(int i) const { return ((uint32_t *)ptr)[i]; break; default: - nassertr(false, -1); + nassert_raise("unsupported index type"); return -1; } @@ -2296,7 +2296,7 @@ get_referenced_vertices(BitArray &bits) const { } break; default: - nassertv(false); + nassert_raise("unsupported index type"); break; } } else { diff --git a/panda/src/gobj/geomTrifans.cxx b/panda/src/gobj/geomTrifans.cxx index a99481e92e..5a6c518867 100644 --- a/panda/src/gobj/geomTrifans.cxx +++ b/panda/src/gobj/geomTrifans.cxx @@ -139,7 +139,7 @@ CPT(GeomVertexArrayData) GeomTrifans:: rotate_impl() const { // Actually, we can't rotate fans without chaging the winding order. It's // an error to define a flat shade model for a GeomTrifan. - nassertr(false, nullptr); + nassert_raise("GeomTrifans cannot have flat shading model"); return nullptr; } diff --git a/panda/src/gobj/geomVertexArrayData.cxx b/panda/src/gobj/geomVertexArrayData.cxx index 998ca1ad14..f6d04beac5 100644 --- a/panda/src/gobj/geomVertexArrayData.cxx +++ b/panda/src/gobj/geomVertexArrayData.cxx @@ -351,7 +351,7 @@ clear_prepared(PreparedGraphicsObjects *prepared_objects) { } else { // If this assertion fails, clear_prepared() was given a prepared_objects // which the data array didn't know about. - nassertv(false); + nassert_raise("unknown PreparedGraphicsObjects"); } } diff --git a/panda/src/gobj/geomVertexData.cxx b/panda/src/gobj/geomVertexData.cxx index d97197e25c..45522427c2 100644 --- a/panda/src/gobj/geomVertexData.cxx +++ b/panda/src/gobj/geomVertexData.cxx @@ -1121,7 +1121,8 @@ do_set_color(GeomVertexData *vdata, const LColor &color) { const GeomVertexColumn *column; int array_index; if (!format->get_array_info(InternalName::get_color(), array_index, column)) { - nassertv(false); + nassert_raise("no color column"); + return; } size_t stride = format->get_array(array_index)->get_stride(); diff --git a/panda/src/gobj/shader.cxx b/panda/src/gobj/shader.cxx index 4b635b00e7..4a1092eb9c 100644 --- a/panda/src/gobj/shader.cxx +++ b/panda/src/gobj/shader.cxx @@ -3705,7 +3705,7 @@ clear_prepared(PreparedGraphicsObjects *prepared_objects) { } else { // If this assertion fails, clear_prepared() was given a prepared_objects // which the texture didn't know about. - nassertv(false); + nassert_raise("unknown PreparedGraphicsObjects"); } } diff --git a/panda/src/gobj/texture.cxx b/panda/src/gobj/texture.cxx index c0cd14db0a..1ba5b891e3 100644 --- a/panda/src/gobj/texture.cxx +++ b/panda/src/gobj/texture.cxx @@ -4897,8 +4897,8 @@ do_read_ktx(CData *cdata, istream &in, const string &filename, bool header_only) } break; default: - nassertr(false, false); - break; + nassert_raise("unexpected channel count"); + return false; } } @@ -6591,8 +6591,9 @@ do_reconsider_image_properties(CData *cdata, int x_size, int y_size, int num_com default: // Eh? - nassertr(false, false); + nassert_raise("unexpected channel count"); cdata->_format = F_rgb; + return false; } } @@ -7989,7 +7990,8 @@ convert_from_pfm(PTA_uchar &image, size_t page_size, int z, break; default: - nassertv(false); + nassert_raise("unexpected channel count"); + return; } nassertv((unsigned char *)p == &image[idx] + page_size); @@ -8199,7 +8201,8 @@ convert_to_pfm(PfmFile &pfm, int x_size, int y_size, break; default: - nassertr(false, false); + nassert_raise("unexpected channel count"); + return false; } nassertr((unsigned char *)p == &image[idx] + page_size, false); diff --git a/panda/src/gsgbase/graphicsStateGuardianBase.cxx b/panda/src/gsgbase/graphicsStateGuardianBase.cxx index 5ac46dd4af..d8da758ee8 100644 --- a/panda/src/gsgbase/graphicsStateGuardianBase.cxx +++ b/panda/src/gsgbase/graphicsStateGuardianBase.cxx @@ -54,7 +54,7 @@ set_default_gsg(GraphicsStateGuardianBase *default_gsg) { LightMutexHolder holder(gsg_list->_lock); if (find(gsg_list->_gsgs.begin(), gsg_list->_gsgs.end(), default_gsg) == gsg_list->_gsgs.end()) { // The specified GSG doesn't exist or it has already destructed. - nassertv(false); + nassert_raise("GSG not found or already destructed"); return; } diff --git a/panda/src/nativenet/socket_address.I b/panda/src/nativenet/socket_address.I index 87213df01d..3fbc5c82d0 100644 --- a/panda/src/nativenet/socket_address.I +++ b/panda/src/nativenet/socket_address.I @@ -43,7 +43,7 @@ Socket_Address(const struct sockaddr &inaddr) { _addr6 = (const sockaddr_in6 &)inaddr; } else { - nassertv(false); + nassert_raise("unsupported address family"); clear(); } } @@ -106,7 +106,7 @@ operator == (const Socket_Address &in) const { } // Unsupported address family. - nassertr(false, false); + nassert_raise("unsupported address family"); return false; } @@ -224,7 +224,7 @@ operator < (const Socket_Address &in) const { } // Unsupported address family. - nassertr(false, false); + nassert_raise("unsupported address family"); return false; } diff --git a/panda/src/nativenet/socket_address.cxx b/panda/src/nativenet/socket_address.cxx index 3d7882aeed..3b8c19d3dd 100644 --- a/panda/src/nativenet/socket_address.cxx +++ b/panda/src/nativenet/socket_address.cxx @@ -98,7 +98,7 @@ get_ip() const { getnameinfo(&_addr, sizeof(sockaddr_in6), buf, sizeof(buf), nullptr, 0, NI_NUMERICHOST); } else { - nassertr(false, std::string()); + nassert_raise("unsupported address family"); } return std::string(buf); @@ -124,7 +124,7 @@ get_ip_port() const { sprintf(buf + strlen(buf), "]:%hu", get_port()); } else { - nassertr(false, std::string()); + nassert_raise("unsupported address family"); } return std::string(buf); diff --git a/panda/src/net/connection.cxx b/panda/src/net/connection.cxx index 27f5c8bb24..e98f53cc79 100644 --- a/panda/src/net/connection.cxx +++ b/panda/src/net/connection.cxx @@ -478,7 +478,8 @@ check_send_error(bool okflag) { if (!okflag) { static ConfigVariableBool abort_send_error("abort-send-error", false); if (abort_send_error) { - nassertr(false, false); + nassert_raise("send error"); + return false; } // Assume any error means the connection has been reset; tell our manager diff --git a/panda/src/net/datagramTCPHeader.cxx b/panda/src/net/datagramTCPHeader.cxx index 44db216b3d..3cdbcc9fc0 100644 --- a/panda/src/net/datagramTCPHeader.cxx +++ b/panda/src/net/datagramTCPHeader.cxx @@ -46,7 +46,8 @@ DatagramTCPHeader(const NetDatagram &datagram, int header_size) { break; default: - nassertv(false); + nassert_raise("invalid header size"); + return; } nassertv((int)_header.get_length() == header_size); diff --git a/panda/src/parametrics/parametricCurveCollection.cxx b/panda/src/parametrics/parametricCurveCollection.cxx index 96ce9bd503..7d7581732c 100644 --- a/panda/src/parametrics/parametricCurveCollection.cxx +++ b/panda/src/parametrics/parametricCurveCollection.cxx @@ -276,7 +276,7 @@ get_timewarp_curve(int n) const { n--; } } - nassertr(false, nullptr); + nassert_raise("index out of range"); return nullptr; } diff --git a/panda/src/pgraph/clipPlaneAttrib.cxx b/panda/src/pgraph/clipPlaneAttrib.cxx index de3f1183c9..c17a17b272 100644 --- a/panda/src/pgraph/clipPlaneAttrib.cxx +++ b/panda/src/pgraph/clipPlaneAttrib.cxx @@ -72,7 +72,7 @@ make(ClipPlaneAttrib::Operation op, PlaneNode *plane) { return attrib; } - nassertr(false, make()); + nassert_raise("invalid operation"); return make(); } @@ -110,7 +110,7 @@ make(ClipPlaneAttrib::Operation op, PlaneNode *plane1, PlaneNode *plane2) { return attrib; } - nassertr(false, make()); + nassert_raise("invalid operation"); return make(); } @@ -152,7 +152,7 @@ make(ClipPlaneAttrib::Operation op, PlaneNode *plane1, PlaneNode *plane2, return attrib; } - nassertr(false, make()); + nassert_raise("invalid operation"); return make(); } @@ -197,7 +197,7 @@ make(ClipPlaneAttrib::Operation op, PlaneNode *plane1, PlaneNode *plane2, return attrib; } - nassertr(false, make()); + nassert_raise("invalid operation"); return make(); } diff --git a/panda/src/pgraph/cullBinManager.cxx b/panda/src/pgraph/cullBinManager.cxx index 5826905c89..cfacd85a03 100644 --- a/panda/src/pgraph/cullBinManager.cxx +++ b/panda/src/pgraph/cullBinManager.cxx @@ -199,7 +199,7 @@ make_new_bin(int bin_index, GraphicsStateGuardianBase *gsg, } // Hmm, unknown (or unregistered) bin type. - nassertr(false, nullptr); + nassert_raise("unknown bin type"); return nullptr; } diff --git a/panda/src/pgraph/lightAttrib.cxx b/panda/src/pgraph/lightAttrib.cxx index 1d6fce8cf7..bdd1553a5e 100644 --- a/panda/src/pgraph/lightAttrib.cxx +++ b/panda/src/pgraph/lightAttrib.cxx @@ -116,7 +116,7 @@ make(LightAttrib::Operation op, Light *light) { return attrib; } - nassertr(false, make()); + nassert_raise("invalid operation"); return make(); } @@ -154,7 +154,7 @@ make(LightAttrib::Operation op, Light *light1, Light *light2) { return attrib; } - nassertr(false, make()); + nassert_raise("invalid operation"); return make(); } @@ -196,7 +196,7 @@ make(LightAttrib::Operation op, Light *light1, Light *light2, return attrib; } - nassertr(false, make()); + nassert_raise("invalid operation"); return make(); } @@ -241,7 +241,7 @@ make(LightAttrib::Operation op, Light *light1, Light *light2, return attrib; } - nassertr(false, make()); + nassert_raise("invalid operation"); return make(); } diff --git a/panda/src/pgraph/nodePath.cxx b/panda/src/pgraph/nodePath.cxx index a21df38d19..0f2639bccc 100644 --- a/panda/src/pgraph/nodePath.cxx +++ b/panda/src/pgraph/nodePath.cxx @@ -718,7 +718,8 @@ get_state(const NodePath &other, Thread *current_thread) const { } else { pgraph_cat.error() << *this << " is not related to " << other << "\n"; - nassertr(false, RenderState::make_empty()); + nassert_raise("unrelated nodes"); + return RenderState::make_empty(); } } @@ -792,7 +793,8 @@ get_transform(const NodePath &other, Thread *current_thread) const { } else { pgraph_cat.error() << *this << " is not related to " << other << "\n"; - nassertr(false, TransformState::make_identity()); + nassert_raise("unrelated nodes"); + return TransformState::make_identity(); } } @@ -877,7 +879,8 @@ get_prev_transform(const NodePath &other, Thread *current_thread) const { } else { pgraph_cat.error() << *this << " is not related to " << other << "\n"; - nassertr(false, TransformState::make_identity()); + nassert_raise("unrelated nodes"); + return TransformState::make_identity(); } } diff --git a/panda/src/pgraph/pandaNode.cxx b/panda/src/pgraph/pandaNode.cxx index 6994e643f8..7d53cbcaf7 100644 --- a/panda/src/pgraph/pandaNode.cxx +++ b/panda/src/pgraph/pandaNode.cxx @@ -2383,7 +2383,8 @@ r_copy_subgraph(PandaNode::InstanceMap &inst_map, Thread *current_thread) const << "Don't know how to copy nodes of type " << get_type() << "\n"; if (no_unsupported_copy) { - nassertr(false, nullptr); + nassert_raise("unsupported copy"); + return nullptr; } } diff --git a/panda/src/pgraph/renderAttribRegistry.cxx b/panda/src/pgraph/renderAttribRegistry.cxx index 939f9753f7..7919d75799 100644 --- a/panda/src/pgraph/renderAttribRegistry.cxx +++ b/panda/src/pgraph/renderAttribRegistry.cxx @@ -78,7 +78,7 @@ register_slot(TypeHandle type_handle, int sort, RenderAttrib *default_attrib) { pgraph_cat->error() << "Too many registered RenderAttribs; not registering " << type_handle << "\n"; - nassertr(false, 0); + nassert_raise("out of RenderAttrib slots"); return 0; } diff --git a/panda/src/pgraph/sceneGraphReducer.cxx b/panda/src/pgraph/sceneGraphReducer.cxx index 03179d38dd..06a80e5a4d 100644 --- a/panda/src/pgraph/sceneGraphReducer.cxx +++ b/panda/src/pgraph/sceneGraphReducer.cxx @@ -333,7 +333,8 @@ r_apply_attribs(PandaNode *node, const AccumulatedAttribs &attribs, << child_node->get_type() << "\n"; if (no_unsupported_copy) { - nassertv(false); + nassert_raise("unsupported copy"); + return; } resist_copy = true; diff --git a/panda/src/pgraphnodes/ambientLight.cxx b/panda/src/pgraphnodes/ambientLight.cxx index deb6eed6cc..f072f1ba6f 100644 --- a/panda/src/pgraphnodes/ambientLight.cxx +++ b/panda/src/pgraphnodes/ambientLight.cxx @@ -85,7 +85,7 @@ void AmbientLight:: bind(GraphicsStateGuardianBase *, const NodePath &, int) { // AmbientLights aren't bound to light id's; this function should never be // called. - nassertv(false); + nassert_raise("cannot bind AmbientLight"); } /** diff --git a/panda/src/pipeline/pythonThread.cxx b/panda/src/pipeline/pythonThread.cxx index 53a811401e..13b31e0539 100644 --- a/panda/src/pipeline/pythonThread.cxx +++ b/panda/src/pipeline/pythonThread.cxx @@ -161,7 +161,8 @@ call_python_func(PyObject *function, PyObject *args) { #ifndef HAVE_THREADS // Shouldn't be possible to come here without having some kind of // threading support enabled. - nassertr(false, nullptr); + nassert_raise("threading support disabled"); + return nullptr; #else #ifdef SIMPLE_THREADS diff --git a/panda/src/pnmimage/pfmFile.cxx b/panda/src/pnmimage/pfmFile.cxx index 57b9671d1a..23ba55a44d 100644 --- a/panda/src/pnmimage/pfmFile.cxx +++ b/panda/src/pnmimage/pfmFile.cxx @@ -346,7 +346,8 @@ load(const PNMImage &pnmimage) { break; default: - nassertr(false, false); + nassert_raise("unexpected channel count"); + return false; } return true; } @@ -410,7 +411,8 @@ store(PNMImage &pnmimage) const { break; default: - nassertr(false, false); + nassert_raise("unexpected channel count"); + return false; } return true; } @@ -877,7 +879,8 @@ set_no_data_nan(int num_channels) { _has_point = has_point_nan_4; break; default: - nassertv(false); + nassert_raise("unexpected channel count"); + break; } } else { clear_no_data_value(); @@ -909,7 +912,8 @@ set_no_data_value(const LPoint4f &no_data_value) { _has_point = has_point_4; break; default: - nassertv(false); + nassert_raise("unexpected channel count"); + break; } } @@ -938,7 +942,8 @@ set_no_data_threshold(const LPoint4f &no_data_value) { _has_point = has_point_threshold_4; break; default: - nassertv(false); + nassert_raise("unexpected channel count"); + break; } } @@ -1121,7 +1126,8 @@ quick_filter_from(const PfmFile &from) { break; default: - nassertv(false); + nassert_raise("unexpected channel count"); + return; } new_data.push_back(0.0); @@ -1826,7 +1832,8 @@ compute_planar_bounds(const LPoint2f ¢er, PN_float32 point_dist, PN_float32 break; default: - nassertr(false, nullptr); + nassert_raise("invalid coordinate system"); + return nullptr; } // Rotate the bounding volume back into the original space of the screen. @@ -1879,7 +1886,8 @@ compute_sample_point(LPoint3f &result, break; default: - nassertv(false); + nassert_raise("unexpected channel count"); + break; } } diff --git a/panda/src/pnmimage/pnmImage.cxx b/panda/src/pnmimage/pnmImage.cxx index 9c6c3a68d9..a26528f99a 100644 --- a/panda/src/pnmimage/pnmImage.cxx +++ b/panda/src/pnmimage/pnmImage.cxx @@ -596,8 +596,8 @@ set_color_space(ColorSpace color_space) { break; default: - nassertv(false); - break; + nassert_raise("invalid color space"); + return; } // Initialize the new encoding settings. @@ -852,7 +852,7 @@ get_channel_val(int x, int y, int channel) const { pnmimage_cat.error() << "Invalid request for channel " << channel << " in " << get_num_channels() << "-channel image.\n"; - nassertr(false, 0); + nassert_raise("unexpected channel count"); return 0; } } @@ -888,7 +888,8 @@ set_channel_val(int x, int y, int channel, xelval value) { break; default: - nassertv(false); + nassert_raise("unexpected channel count"); + break; } } @@ -918,7 +919,7 @@ get_channel(int x, int y, int channel) const { pnmimage_cat.error() << "Invalid request for channel " << channel << " in " << get_num_channels() << "-channel image.\n"; - nassertr(false, 0); + nassert_raise("unexpected channel count"); return 0; } } @@ -954,7 +955,8 @@ set_channel(int x, int y, int channel, float value) { break; default: - nassertv(false); + nassert_raise("unexpected channel count"); + break; } } @@ -2126,7 +2128,7 @@ setup_encoding() { break; default: - nassertv(false); + nassert_raise("invalid color space"); break; } } else { @@ -2153,7 +2155,7 @@ setup_encoding() { break; default: - nassertv(false); + nassert_raise("invalid color space"); break; } } diff --git a/panda/src/pnmimagetypes/pnmFileTypePfm.cxx b/panda/src/pnmimagetypes/pnmFileTypePfm.cxx index 89324f3c61..1303cc9c6c 100644 --- a/panda/src/pnmimagetypes/pnmFileTypePfm.cxx +++ b/panda/src/pnmimagetypes/pnmFileTypePfm.cxx @@ -283,7 +283,8 @@ write_pfm(const PfmFile &pfm) { break; default: - nassertr(false, false); + nassert_raise("unexpected channel count"); + return false; } (*_file) << pfm.get_x_size() << " " << pfm.get_y_size() << "\n"; diff --git a/panda/src/pnmimagetypes/pnmFileTypeSGIWriter.cxx b/panda/src/pnmimagetypes/pnmFileTypeSGIWriter.cxx index f5b143e867..4bec4292d5 100644 --- a/panda/src/pnmimagetypes/pnmFileTypeSGIWriter.cxx +++ b/panda/src/pnmimagetypes/pnmFileTypeSGIWriter.cxx @@ -135,7 +135,8 @@ write_header() { break; default: - nassertr(false, false); + nassert_raise("unexpected channel count"); + return false; } // For some reason, we have problems with SGI image files whose pixmax value diff --git a/panda/src/putil/sparseArray.I b/panda/src/putil/sparseArray.I index 682d5f93be..ccfd90b5ab 100644 --- a/panda/src/putil/sparseArray.I +++ b/panda/src/putil/sparseArray.I @@ -93,7 +93,7 @@ has_max_num_bits() { */ INLINE int SparseArray:: get_max_num_bits() { - nassertr(false, 0); + nassert_raise("SparseArray has no maximum bit count"); return 0; } diff --git a/panda/src/text/textAssembler.cxx b/panda/src/text/textAssembler.cxx index 3925715c6d..32cf41eb89 100644 --- a/panda/src/text/textAssembler.cxx +++ b/panda/src/text/textAssembler.cxx @@ -2536,7 +2536,7 @@ get_primitive(TypeHandle prim_type) { return _points; } - nassertr(false, nullptr); + nassert_raise("unexpected primitive type"); return nullptr; } diff --git a/panda/src/vision/webcamVideoCursorV4L.cxx b/panda/src/vision/webcamVideoCursorV4L.cxx index 8bb77658f6..197bda3228 100644 --- a/panda/src/vision/webcamVideoCursorV4L.cxx +++ b/panda/src/vision/webcamVideoCursorV4L.cxx @@ -487,7 +487,8 @@ fetch_buffer() { block[i + 2] = ex; } #else - nassertr(false /* Not compiled with JPEG support*/, nullptr); + nassert_raise("JPEG support not compiled-in"); + return nullptr; #endif break; } diff --git a/pandatool/src/assimp/pandaIOSystem.cxx b/pandatool/src/assimp/pandaIOSystem.cxx index 87dea240d2..241790f646 100644 --- a/pandatool/src/assimp/pandaIOSystem.cxx +++ b/pandatool/src/assimp/pandaIOSystem.cxx @@ -79,7 +79,7 @@ Open(const char *file, const char *mode) { return new PandaIOStream(*stream); } else { - nassertr(false, nullptr); // Not implemented on purpose. + nassert_raise("write mode not implemented"); return nullptr; } } diff --git a/pandatool/src/eggcharbase/eggBackPointer.cxx b/pandatool/src/eggcharbase/eggBackPointer.cxx index b1e269624a..cc6110d075 100644 --- a/pandatool/src/eggcharbase/eggBackPointer.cxx +++ b/pandatool/src/eggcharbase/eggBackPointer.cxx @@ -40,7 +40,7 @@ get_frame_rate() const { void EggBackPointer:: extend_to(int num_frames) { // Whoops, can't extend this kind of table! - nassertv(false); + nassert_raise("can't extend this kind of table"); } /**