Browse Source

Merge branch 'release/1.10.x'

rdb 3 years ago
parent
commit
dae147ec0c

+ 2 - 0
dtool/src/dtoolutil/pandaSystem.cxx

@@ -53,6 +53,8 @@ PandaSystem() :
   set_system_tag("system", "malloc", "dlmalloc");
 #elif defined(USE_MEMORY_PTMALLOC2)
   set_system_tag("system", "malloc", "ptmalloc2");
+#elif defined(USE_MEMORY_MIMALLOC)
+  set_system_tag("system", "malloc", "mimalloc");
 #else
   set_system_tag("system", "malloc", "malloc");
 #endif

+ 3 - 0
panda/src/express/datagramIterator.h

@@ -23,6 +23,9 @@
  * A class to retrieve the individual data elements previously stored in a
  * Datagram.  Elements may be retrieved one at a time; it is up to the caller
  * to know the correct type and order of each element.
+ *
+ * Note that it is the responsibility of the caller to ensure that the datagram
+ * object is not destructed while this DatagramIterator is in use.
  */
 class EXPCL_PANDA_EXPRESS DatagramIterator {
 public:

+ 6 - 5
panda/src/gobj/texture.cxx

@@ -7511,7 +7511,8 @@ get_ram_image_as(const string &requested_format) {
     gobj_cat.error() << "Couldn't find an uncompressed RAM image!\n";
     return CPTA_uchar(get_class_type());
   }
-  int imgsize = cdata->_x_size * cdata->_y_size;
+  size_t imgsize = (size_t)cdata->_x_size * (size_t)cdata->_y_size *
+                   (size_t)cdata->_z_size * (size_t)cdata->_num_views;
   nassertr(cdata->_num_components > 0 && cdata->_num_components <= 4, CPTA_uchar(get_class_type()));
   nassertr(data.size() == (size_t)(cdata->_component_width * cdata->_num_components * imgsize), CPTA_uchar(get_class_type()));
 
@@ -7549,7 +7550,7 @@ get_ram_image_as(const string &requested_format) {
       const uint32_t *src = (const uint32_t *)data.p();
       uint32_t *dst = (uint32_t *)newdata.p();
 
-      for (int p = 0; p < imgsize; ++p) {
+      for (size_t p = 0; p < imgsize; ++p) {
         uint32_t v = *src++;
         *dst++ = ((v & 0xff00ff00u)) |
                  ((v & 0x00ff0000u) >> 16) |
@@ -7636,14 +7637,14 @@ get_ram_image_as(const string &requested_format) {
     }
     if (format == "A" && cdata->_num_components != 3) {
       // We can generally rely on alpha to be the last component.
-      for (int p = 0; p < imgsize; ++p) {
+      for (size_t p = 0; p < imgsize; ++p) {
         dst[p] = src[alpha];
         src += cdata->_num_components;
       }
       return newdata;
     }
     // Fallback case for other 8-bit-per-channel formats.
-    for (int p = 0; p < imgsize; ++p) {
+    for (size_t p = 0; p < imgsize; ++p) {
       for (size_t i = 0; i < format.size(); ++i) {
         if (format[i] == 'B' || (cdata->_num_components <= 2 && format[i] != 'A')) {
           *dst++ = src[0];
@@ -7669,7 +7670,7 @@ get_ram_image_as(const string &requested_format) {
   }
 
   // The slow and general case.
-  for (int p = 0; p < imgsize; ++p) {
+  for (size_t p = 0; p < imgsize; ++p) {
     for (size_t i = 0; i < format.size(); ++i) {
       int component = 0;
       if (format[i] == 'B' || (cdata->_num_components <= 2 && format[i] != 'A')) {