Skip to content

Commit

Permalink
Minor code cleanup.
Browse files Browse the repository at this point in the history
Add missing variable initialization.
  • Loading branch information
rdoeffinger committed Sep 8, 2021
1 parent f3f6463 commit 6053b3e
Show file tree
Hide file tree
Showing 10 changed files with 10 additions and 17 deletions.
1 change: 1 addition & 0 deletions impl11/ddraw/BackbufferSurface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ BackbufferSurface::BackbufferSurface(DeviceResources* deviceResources)
this->_buffer = new char[this->_bufferSize];
memset(this->_buffer, 0, this->_bufferSize);
this->_lockCount = 0;
this->sawSrcCopy = false;
}

BackbufferSurface::~BackbufferSurface()
Expand Down
1 change: 0 additions & 1 deletion impl11/ddraw/Direct3DDevice.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -555,7 +555,6 @@ HRESULT Direct3DDevice::Execute(
DumpExecuteBuffer(executeBuffer);
#endif

auto& device = this->_deviceResources->_d3dDevice;
auto& context = this->_deviceResources->_d3dDeviceContext;

HRESULT hr = S_OK;
Expand Down
1 change: 1 addition & 0 deletions impl11/ddraw/Direct3DMaterial.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
class Direct3DMaterial : public IDirect3DMaterial
{
public:
constexpr Direct3DMaterial() : material(), _refCount(1) {}
virtual ~Direct3DMaterial() {}
/*** IUnknown methods ***/

Expand Down
2 changes: 2 additions & 0 deletions impl11/ddraw/Direct3DTexture.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -382,6 +382,8 @@ HRESULT Direct3DTexture::Load(
case DXGI_ERROR_INVALID_CALL:
s << "invalid call ";
break;
default:
s << reason;
}
s << reason << " " << _com_error(reason).ErrorMessage();
MessageBox(nullptr, s.str().c_str(), __FUNCTION__, MB_ICONERROR);
Expand Down
3 changes: 2 additions & 1 deletion impl11/ddraw/Direct3DViewport.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
#include "Direct3DMaterial.h"
#include "Direct3DViewport.h"

Direct3DViewport::Direct3DViewport(DeviceResources* deviceResources)
Direct3DViewport::Direct3DViewport(DeviceResources* deviceResources) :
clearColor{}
{
this->_refCount = 1;
this->_deviceResources = deviceResources;
Expand Down
9 changes: 0 additions & 9 deletions impl11/ddraw/DirectDrawPalette.cpp
Original file line number Diff line number Diff line change
@@ -1,15 +1,6 @@
#include "common.h"
#include "DirectDrawPalette.h"

DirectDrawPalette::DirectDrawPalette()
{
this->_refCount = 1;
}

DirectDrawPalette::~DirectDrawPalette()
{
}

HRESULT DirectDrawPalette::QueryInterface(
REFIID riid,
LPVOID* obp
Expand Down
4 changes: 2 additions & 2 deletions impl11/ddraw/DirectDrawPalette.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
class DirectDrawPalette : public IDirectDrawPalette
{
public:
DirectDrawPalette();
DirectDrawPalette() : _refCount(1), palette() {}

virtual ~DirectDrawPalette();
virtual ~DirectDrawPalette() = default;

/*** IUnknown methods ***/

Expand Down
2 changes: 1 addition & 1 deletion impl11/ddraw/config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ Config::Config()
continue;
}

int pos = line.find("=");
int pos = line.find('=');

std::string name = line.substr(0, pos);
name.erase(remove_if(name.begin(), name.end(), isspace_wrapper), name.end());
Expand Down
2 changes: 0 additions & 2 deletions impl11/ddraw/ddraw.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@
#include "DeviceResources.h"
#include "DirectDraw.h"

#include "joystick.h"

#pragma comment(lib, "dxguid")
#pragma comment(lib, "dxgi")
#pragma comment(lib, "d3d11")
Expand Down
2 changes: 1 addition & 1 deletion impl11/tests/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -473,7 +473,7 @@ void main()
DDCOLORKEY colorkey;
DDBLTFX ddBltFx;

#define CALL(fct) std::cout << #fct << std::endl; if(FAILED(hr = (fct))) { std::cout << (void*)hr << ": " << _com_error(hr).ErrorMessage() << std::endl; return; }
#define CALL(fct) do { std::cout << #fct << std::endl; if(FAILED(hr = (fct))) { std::cout << (void*)hr << ": " << _com_error(hr).ErrorMessage() << std::endl; return; } } while (false)

ComPtr<IDirectDraw> ddraw;
CALL(DirectDrawCreate(nullptr, &ddraw, nullptr));
Expand Down

0 comments on commit 6053b3e

Please sign in to comment.