From 5cc49efe2cb48f26135e846e03efff351b52f227 Mon Sep 17 00:00:00 2001 From: Struma Date: Sat, 2 Jan 2021 21:41:11 -0500 Subject: [PATCH] "throw new Exception" -> "throw Exception" I don't know why I had it this way tbh --- src/display/bitmap.cpp | 4 ++-- src/filesystem/filesystemImpl.cpp | 4 ++-- src/filesystem/filesystemImplApple.mm | 6 +++--- src/input/input.cpp | 4 ++-- src/net/net.cpp | 8 ++++---- 5 files changed, 13 insertions(+), 13 deletions(-) diff --git a/src/display/bitmap.cpp b/src/display/bitmap.cpp index c29a3764..5b11e0db 100644 --- a/src/display/bitmap.cpp +++ b/src/display/bitmap.cpp @@ -927,7 +927,7 @@ void Bitmap::saveToFile(const char *filename) SDL_Surface *surf = SDL_CreateRGBSurface(0, width(), height(),p->format->BitsPerPixel, p->format->Rmask,p->format->Gmask,p->format->Bmask,p->format->Amask); if (!surf) - throw new Exception(Exception::SDLError, "Failed to save bitmap: %s", SDL_GetError()); + throw Exception(Exception::SDLError, "Failed to save bitmap: %s", SDL_GetError()); getRaw(surf->pixels, surf->w * surf->h * 4); @@ -935,7 +935,7 @@ void Bitmap::saveToFile(const char *filename) int rc = SDL_SaveBMP(surf, fn_normalized.c_str()); SDL_FreeSurface(surf); - if (rc) throw new Exception(Exception::SDLError, "%s", SDL_GetError()); + if (rc) throw Exception(Exception::SDLError, "%s", SDL_GetError()); } void Bitmap::hueChange(int hue) diff --git a/src/filesystem/filesystemImpl.cpp b/src/filesystem/filesystemImpl.cpp index 5414b726..4a4b332e 100644 --- a/src/filesystem/filesystemImpl.cpp +++ b/src/filesystem/filesystemImpl.cpp @@ -34,7 +34,7 @@ std::string filesystemImpl::contentsOfFileAsString(const char *path) { ret = std::string ( (std::istreambuf_iterator(ifs) ), (std::istreambuf_iterator() ) ); } catch (...) { - throw new Exception(Exception::NoFileError, "Failed to read file at %s", path); + throw Exception(Exception::NoFileError, "Failed to read file at %s", path); } return ret; @@ -60,7 +60,7 @@ std::string filesystemImpl::getCurrentDirectory() { try { ret = std::string(fs::current_path().string()); } catch (...) { - throw new Exception(Exception::MKXPError, "Failed to retrieve current path"); + throw Exception(Exception::MKXPError, "Failed to retrieve current path"); } return ret; } diff --git a/src/filesystem/filesystemImplApple.mm b/src/filesystem/filesystemImplApple.mm index 284f13ff..a8b3b457 100644 --- a/src/filesystem/filesystemImplApple.mm +++ b/src/filesystem/filesystemImplApple.mm @@ -24,7 +24,7 @@ bool filesystemImpl::fileExists(const char *path) { std::string filesystemImpl::contentsOfFileAsString(const char *path) { NSString *fileContents = [NSString stringWithContentsOfFile: PATHTONS(path)]; if (fileContents == nil) - throw new Exception(Exception::NoFileError, "Failed to read file at %s", path); + throw Exception(Exception::NoFileError, "Failed to read file at %s", path); return std::string(fileContents.UTF8String); @@ -67,7 +67,7 @@ NSString *getPathForAsset_internal(const char *baseName, const char *ext) { std::string filesystemImpl::getPathForAsset(const char *baseName, const char *ext) { NSString *assetPath = getPathForAsset_internal(baseName, ext); if (assetPath == nil) - throw new Exception(Exception::NoFileError, "Failed to find the asset named %s.%s", baseName, ext); + throw Exception(Exception::NoFileError, "Failed to find the asset named %s.%s", baseName, ext); return std::string(NSTOPATH(getPathForAsset_internal(baseName, ext))); } @@ -78,7 +78,7 @@ std::string filesystemImpl::contentsOfAssetAsString(const char *baseName, const // This should never fail if (fileContents == nil) - throw new Exception(Exception::MKXPError, "Failed to read file at %s", path.UTF8String); + throw Exception(Exception::MKXPError, "Failed to read file at %s", path.UTF8String); return std::string(fileContents.UTF8String); diff --git a/src/input/input.cpp b/src/input/input.cpp index f014f6cc..cc1041dd 100644 --- a/src/input/input.cpp +++ b/src/input/input.cpp @@ -1234,14 +1234,14 @@ char *Input::getClipboardText() { char *tx = SDL_GetClipboardText(); if (!tx) - throw new Exception(Exception::SDLError, "Failed to get clipboard text: %s", SDL_GetError()); + throw Exception(Exception::SDLError, "Failed to get clipboard text: %s", SDL_GetError()); return tx; } void Input::setClipboardText(char *text) { if (SDL_SetClipboardText(text) < 0) - throw new Exception(Exception::SDLError, "Failed to set clipboard text: %s", SDL_GetError()); + throw Exception(Exception::SDLError, "Failed to set clipboard text: %s", SDL_GetError()); } Input::~Input() diff --git a/src/net/net.cpp b/src/net/net.cpp index f8f183e8..587de63d 100644 --- a/src/net/net.cpp +++ b/src/net/net.cpp @@ -46,7 +46,7 @@ const char *urlErrorNames[] = { LUrlParser::ParseURL readURL(const char *url) { LUrlParser::ParseURL p = LUrlParser::ParseURL::parseURL(std::string(url)); if (!p.isValid() || p.errorCode_){ - throw new Exception(Exception::MKXPError, "Invalid URL: %s", urlErrorNames[p.errorCode_]); + throw Exception(Exception::MKXPError, "Invalid URL: %s", urlErrorNames[p.errorCode_]); } return p; } @@ -132,7 +132,7 @@ HTTPResponse HTTPRequest::get() { else { int err = result.error(); const char *errname = httpErrorNames[err]; - throw new Exception(Exception::MKXPError, "Failed to GET %s (%i: %s)", destination.c_str(), err, errname); + throw Exception(Exception::MKXPError, "Failed to GET %s (%i: %s)", destination.c_str(), err, errname); } return ret; @@ -165,7 +165,7 @@ HTTPResponse HTTPRequest::post(StringMap &postData) { else { int err = result.error(); const char *errname = httpErrorNames[err]; - throw new Exception(Exception::MKXPError, "Failed to POST %s (%i: %s)", destination.c_str(), err, errname); + throw Exception(Exception::MKXPError, "Failed to POST %s (%i: %s)", destination.c_str(), err, errname); } return ret; } @@ -192,7 +192,7 @@ HTTPResponse HTTPRequest::post(const char *body, const char *content_type) { } else { int err = result.error(); - throw new Exception(Exception::MKXPError, "Failed to POST %s (%i: %s)", destination.c_str(), err, httpErrorNames[err]); + throw Exception(Exception::MKXPError, "Failed to POST %s (%i: %s)", destination.c_str(), err, httpErrorNames[err]); } return ret; }