fix for mipspro: no 'new(nothrow)' available for MIPSpro Compilers: Version 7.3.1.3m
This commit is contained in:
parent
e53e1b3b23
commit
b7190ee2e5
1 changed files with 24 additions and 10 deletions
|
@ -22,7 +22,7 @@
|
|||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
|
||||
// $Id: TextureRender.cc,v 1.13 2004/10/06 19:19:43 akir Exp $
|
||||
// $Id: TextureRender.cc,v 1.14 2004/10/21 10:03:43 akir Exp $
|
||||
|
||||
#include "TextureRender.hh"
|
||||
|
||||
|
@ -41,6 +41,14 @@
|
|||
#endif
|
||||
using namespace std;
|
||||
|
||||
// mipspro has no new(nothrow)
|
||||
#if defined sgi && ! defined GCC
|
||||
#define FB_new_nothrow new
|
||||
#else
|
||||
#warning yeah, thats the way
|
||||
#define FB_new_nothrow new(std::nothrow)
|
||||
#endif
|
||||
|
||||
namespace FbTk {
|
||||
|
||||
TextureRender::TextureRender(ImageControl &imgctrl,
|
||||
|
@ -98,28 +106,34 @@ Pixmap TextureRender::render(const FbTk::Texture &texture) {
|
|||
}
|
||||
|
||||
void TextureRender::allocateColorTables() {
|
||||
red = new(nothrow) unsigned char[width * height];
|
||||
|
||||
_FB_USES_NLS;
|
||||
|
||||
const size_t size = width * height;
|
||||
red = FB_new_nothrow unsigned char[size];
|
||||
|
||||
if (red == 0) {
|
||||
char sbuf[128];
|
||||
sprintf(sbuf, "%d", width*height);
|
||||
throw string("TextureRender::TextureRender(): " + string(_FBTKTEXT(Error, OutOfMemoryRed, "Out of memory while allocating red buffer.", "")) + string(sbuf));
|
||||
sprintf(sbuf, "%d", size);
|
||||
throw std::string("TextureRender::TextureRender(): " +
|
||||
std::string(_FBTKTEXT(Error, OutOfMemoryRed, "Out of memory while allocating red buffer.", "")) + string(sbuf));
|
||||
}
|
||||
|
||||
|
||||
green = new(nothrow) unsigned char[width * height];
|
||||
green = FB_new_nothrow unsigned char[size];
|
||||
if (green == 0) {
|
||||
char sbuf[128];
|
||||
sprintf(sbuf, "%d", width*height);
|
||||
throw string("TextureRender::TextureRender(): " +string(_FBTKTEXT(Error, OutOfMemoryGreen, "Out of memory while allocating green buffer.", ""))+ string(sbuf));
|
||||
sprintf(sbuf, "%d", size);
|
||||
throw std::string("TextureRender::TextureRender(): " +
|
||||
std::string(_FBTKTEXT(Error, OutOfMemoryGreen, "Out of memory while allocating green buffer.", ""))+ string(sbuf));
|
||||
}
|
||||
|
||||
blue = new(nothrow) unsigned char[width * height];
|
||||
blue = FB_new_nothrow unsigned char[size];
|
||||
if (blue == 0) {
|
||||
char sbuf[128];
|
||||
sprintf(sbuf, "%d", width*height);
|
||||
throw string("TextureRender::TextureRender(): " +string(_FBTKTEXT(Error, OutOfMemoryBlue, "Out of memory while allocating blue buffer.", ""))+ string(sbuf));
|
||||
sprintf(sbuf, "%d", size);
|
||||
throw std::string("TextureRender::TextureRender(): " +
|
||||
std::string(_FBTKTEXT(Error, OutOfMemoryBlue, "Out of memory while allocating blue buffer.", ""))+ string(sbuf));
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue