yudit-3.1.0.patch5.txt AKA: yudit-new-delete.patch Received from Jerry James on 2025-04-30 This patch will eliminate compiler warnings: x11/SX11Color.cpp: In member function ‘SX11Color::allocate(SX11Impl*)’: sx11/SX11Color.cpp:197:10: warning: ‘operator delete(void*, unsigned long)’ called on pointer returned from a mismatched allocation function [-Wmismatched-new-delete] 197 | delete colors; | ^~~~~~ sx11/SX11Color.cpp:150:40: note: returned from ‘operator new[](unsigned long)’ 150 | colors = new XColor [_impl->cellCount]; | ^ --- yudit-3.1.0/stoolkit/SBMap.cpp.orig 2023-02-01 02:47:39.000000000 -0700 +++ yudit-3.1.0/stoolkit/SBMap.cpp 2025-04-29 20:22:12.034784784 -0600 @@ -2043,7 +2043,7 @@ SBMapItem::toHex (const unsigned char* i } if (subL < 0 || subH < 0) { - delete retVle; + delete [] retVle; return 0; } retVle[count/2-1] = ((in[old]-subH) << 4) + in[i]-subL; @@ -2709,8 +2709,8 @@ SBMap::serializeUMAP (SString* _fd, SFil } if (icodeSize) { - delete mat[0]; - delete mat[1]; + delete [] mat[0]; + delete [] mat[1]; return -1; } // Determine high and low. @@ -2751,13 +2751,13 @@ SBMap::serializeUMAP (SString* _fd, SFil for (i=0;i<2;i++) { w = write16 (_fd, high[i][0], _format, FT_IGNORE, SS_LAST); - if (w<0) { delete mat[0]; delete mat[1]; return -1; } index += w; + if (w<0) { delete [] mat[0]; delete [] mat[1]; return -1; } index += w; w = write16 (_fd, high[i][1], _format, FT_IGNORE, SS_LAST); - if (w<0) { delete mat[0]; delete mat[1]; return -1; } index += w; + if (w<0) { delete [] mat[0]; delete [] mat[1]; return -1; } index += w; w = write16 (_fd, low[i][0], _format, FT_IGNORE, SS_LAST); - if (w<0) { delete mat[0]; delete mat[1]; return -1; } index += w; + if (w<0) { delete [] mat[0]; delete [] mat[1]; return -1; } index += w; w = write16 (_fd, low[i][1], _format, FT_IGNORE, SS_LAST); - if (w<0) { delete mat[0]; delete mat[1]; return -1; } index += w; + if (w<0) { delete [] mat[0]; delete [] mat[1]; return -1; } index += w; } // Now the two bounded arrays. @@ -2774,11 +2774,11 @@ SBMap::serializeUMAP (SString* _fd, SFil lend = SS_EOF; } w = write16 (_fd, mat[i][(j<<8)+k], _format, FT_IGNORE, lend); - if (w<0) { delete mat[0]; delete mat[1]; return -1; } index += w; + if (w<0) { delete [] mat[0]; delete [] mat[1]; return -1; } index += w; } } } - delete mat[0]; delete mat[1]; + delete [] mat[0]; delete [] mat[1]; return index; } --- yudit-3.1.0/swindow/sx11/SX11Color.cpp.orig 2023-01-13 23:15:37.000000000 -0700 +++ yudit-3.1.0/swindow/sx11/SX11Color.cpp 2025-04-29 20:19:51.372860974 -0600 @@ -194,8 +194,8 @@ SX11Color::allocate(SX11Impl* _impl) flags[bestMatch] = 1; } - delete colors; - delete flags; + delete [] colors; + delete [] flags; if (bestMatch<0) { --- yudit-3.1.0/swindow/sx11/SX11Font.cpp.orig 2023-01-12 08:28:41.000000000 -0700 +++ yudit-3.1.0/swindow/sx11/SX11Font.cpp 2025-04-29 20:24:05.169550580 -0600 @@ -548,7 +548,7 @@ SX11Font::draw (const SString& xlfd, SCa unsigned int collapsed = fc->getPangoLigatures (script, chars, liglen); if (collapsed==0 || collapsed == liglen) { - delete chars; + delete [] chars; return false; } if (collapsed == 1) @@ -567,15 +567,15 @@ SX11Font::draw (const SString& xlfd, SCa || ((dw = fc->draw (canvas, pen, x, y, (SS_UCS2) chars[i])) == 0.0 && i==0)) { - delete chars; + delete [] chars; return false; } x += dw; } - delete chars; + delete [] chars; return true; } - delete chars; + delete [] chars; } else if (isencoded) { @@ -906,7 +906,7 @@ SX11Font::width (const SString& xlfd, SS unsigned int collapsed = fc->getPangoLigatures (script, chars, liglen); if (collapsed==0 || collapsed == liglen) { - delete chars; + delete [] chars; return false; } if (collapsed == 1) @@ -923,17 +923,17 @@ SX11Font::width (const SString& xlfd, SS if (chars[i] > 0xffff || ((dw=fc->width ((SS_UCS2) chars[i]))==0.0 && i==0)) { - delete chars; + delete [] chars; return false; } x += dw; } if (width_) *width_ = x; /* loop */ - delete chars; + delete [] chars; return true; } - delete chars; + delete [] chars; } /** * create a glyphno array --- yudit-3.1.0/swindow/sx11/SX11Window.cpp.orig 2023-02-03 20:23:30.000000000 -0700 +++ yudit-3.1.0/swindow/sx11/SX11Window.cpp 2025-04-29 20:25:03.216501849 -0600 @@ -306,7 +306,7 @@ SX11Window::endImage () { delete colors[i]; } - delete colors; + delete [] colors; delete si; XDestroyImage (ximage); } @@ -667,7 +667,7 @@ SX11Window::createShadedPixmap (const SI { delete colors[i]; } - delete colors; + delete [] colors; XDestroyImage (ximage); *p = xpixmap; @@ -1024,7 +1024,7 @@ SX11Window::bitpoints (const SColor& fg, } XDrawPoints (impl->display, (Drawable) dbuffer[dbindex].id, dbuffer[dbindex].gc, p, _size, CoordModeOrigin); - delete p; + delete [] p; }