Browse Source

Use SDLUniquePtr

pull/2867/head
Vladimir Olteanu 5 years ago committed by Anders Jenbo
parent
commit
4a9ebf1460
  1. 7
      Source/dx.cpp
  2. 6
      Source/utils/paths.cpp

7
Source/dx.cpp

@ -297,12 +297,9 @@ void Blit(SDL_Surface *src, SDL_Rect *srcRect, SDL_Rect *dstRect)
// A surface with a non-output pixel format but without a color key needs scaling.
// We can convert the format and then call BlitScaled.
SDL_Surface *converted = SDL_ConvertSurface(src, dst->format, 0);
if (SDL_BlitScaled(converted, srcRect, dst, dstRect) < 0) {
SDL_FreeSurface(converted);
SDLSurfaceUniquePtr converted = SDLWrap::ConvertSurface(src, dst->format, 0);
if (SDL_BlitScaled(converted.get(), srcRect, dst, dstRect) < 0)
ErrSdl();
}
SDL_FreeSurface(converted);
#endif
}

6
Source/utils/paths.cpp

@ -5,6 +5,7 @@
#include "utils/file_util.h"
#include "utils/log.hpp"
#include "utils/stdcompat/optional.hpp"
#include "utils/sdl_ptrs.h"
#ifdef USE_SDL1
#include "utils/sdl2_to_1_2_backports.h"
@ -48,10 +49,9 @@ void AddTrailingSlash(std::string &path)
std::string FromSDL(char *s)
{
SDLUniquePtr<char> pinned(s);
std::string result = (s != nullptr ? s : "");
if (s != nullptr) {
SDL_free(s);
} else {
if (s == nullptr) {
Log("{}", SDL_GetError());
SDL_ClearError();
}

Loading…
Cancel
Save