From b03b560e71ecc865598c34dce28249c4e0e04d26 Mon Sep 17 00:00:00 2001 From: vladislavbelov Date: Sat, 22 May 2021 19:21:33 +0000 Subject: [PATCH] Adds std namespace to shared_ptr usages in graphics. This was SVN commit r25525. --- source/graphics/FontManager.cpp | 6 +++--- source/graphics/FontManager.h | 6 +++--- source/graphics/FontMetrics.h | 4 ++-- source/graphics/HeightMipmap.cpp | 4 ++-- source/graphics/MapGenerator.cpp | 2 +- source/graphics/MapIO.cpp | 8 ++++---- source/graphics/Overlay.h | 2 +- source/graphics/ParticleEmitter.h | 6 +++--- source/graphics/ParticleEmitterType.h | 8 ++++---- source/graphics/ShaderDefines.cpp | 2 +- source/graphics/ShaderDefines.h | 4 ++-- source/graphics/TerrainProperties.h | 4 ++-- source/graphics/TerrainTextureEntry.cpp | 4 ++-- source/graphics/TerrainTextureManager.h | 4 ++-- source/graphics/TextRenderer.h | 4 ++-- source/graphics/TextureConverter.cpp | 12 ++++++------ source/graphics/TextureConverter.h | 6 +++--- source/graphics/TextureManager.cpp | 10 +++++----- source/graphics/tests/test_MeshManager.h | 8 ++++---- source/graphics/tests/test_TextureConverter.h | 2 +- 20 files changed, 53 insertions(+), 53 deletions(-) diff --git a/source/graphics/FontManager.cpp b/source/graphics/FontManager.cpp index 8820b4f076..0521084119 100644 --- a/source/graphics/FontManager.cpp +++ b/source/graphics/FontManager.cpp @@ -29,13 +29,13 @@ #include -shared_ptr CFontManager::LoadFont(CStrIntern fontName) +std::shared_ptr CFontManager::LoadFont(CStrIntern fontName) { FontsMap::iterator it = m_Fonts.find(fontName); if (it != m_Fonts.end()) return it->second; - shared_ptr font(new CFont()); + std::shared_ptr font(new CFont()); if (!ReadFont(font.get(), fontName)) { @@ -55,7 +55,7 @@ bool CFontManager::ReadFont(CFont* font, CStrIntern fontName) const VfsPath path(L"fonts/"); // Read font definition file into a stringstream - shared_ptr buf; + std::shared_ptr buf; size_t size; const VfsPath fntName(fontName.string() + ".fnt"); if (g_VFS->LoadFile(path / fntName, buf, size) < 0) diff --git a/source/graphics/FontManager.h b/source/graphics/FontManager.h index 858306ebdd..487e63d374 100644 --- a/source/graphics/FontManager.h +++ b/source/graphics/FontManager.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2019 Wildfire Games. +/* Copyright (C) 2021 Wildfire Games. * This file is part of 0 A.D. * * 0 A.D. is free software: you can redistribute it and/or modify @@ -30,12 +30,12 @@ class CFont; class CFontManager { public: - shared_ptr LoadFont(CStrIntern fontName); + std::shared_ptr LoadFont(CStrIntern fontName); private: bool ReadFont(CFont* font, CStrIntern fontName); - using FontsMap = std::unordered_map >; + using FontsMap = std::unordered_map>; FontsMap m_Fonts; }; diff --git a/source/graphics/FontMetrics.h b/source/graphics/FontMetrics.h index d62d590604..d84bf7f39e 100644 --- a/source/graphics/FontMetrics.h +++ b/source/graphics/FontMetrics.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2013 Wildfire Games. +/* Copyright (C) 2021 Wildfire Games. * This file is part of 0 A.D. * * 0 A.D. is free software: you can redistribute it and/or modify @@ -37,7 +37,7 @@ public: void CalculateStringSize(const wchar_t* string, int& w, int& h) const; private: - shared_ptr m_Font; + std::shared_ptr m_Font; }; #endif // INCLUDED_FONTMETRICS diff --git a/source/graphics/HeightMipmap.cpp b/source/graphics/HeightMipmap.cpp index 01fb4d9964..f2720a695a 100644 --- a/source/graphics/HeightMipmap.cpp +++ b/source/graphics/HeightMipmap.cpp @@ -1,4 +1,4 @@ -/* Copyright (C) 2019 Wildfire Games. +/* Copyright (C) 2021 Wildfire Games. * This file is part of 0 A.D. * * 0 A.D. is free software: you can redistribute it and/or modify @@ -228,7 +228,7 @@ void CHeightMipmap::DumpToDisk(const VfsPath& filename) const const size_t img_size = w * h * bpp/8; const size_t hdr_size = tex_hdr_size(filename); - shared_ptr buf; + std::shared_ptr buf; AllocateAligned(buf, hdr_size+img_size, maxSectorSize); void* img = buf.get() + hdr_size; Tex t; diff --git a/source/graphics/MapGenerator.cpp b/source/graphics/MapGenerator.cpp index 0c9f994f5c..79d84a59ff 100644 --- a/source/graphics/MapGenerator.cpp +++ b/source/graphics/MapGenerator.cpp @@ -92,7 +92,7 @@ void CMapGeneratorWorker::RunThread(CMapGeneratorWorker* self) debug_SetThreadName("MapGenerator"); g_Profiler2.RegisterCurrentThread("MapGenerator"); - shared_ptr mapgenContext = ScriptContext::CreateContext(RMS_CONTEXT_SIZE); + std::shared_ptr mapgenContext = ScriptContext::CreateContext(RMS_CONTEXT_SIZE); // Enable the script to be aborted JS_AddInterruptCallback(mapgenContext->GetGeneralJSContext(), MapGeneratorInterruptCallback); diff --git a/source/graphics/MapIO.cpp b/source/graphics/MapIO.cpp index 66c24df687..4ffc1f3a37 100644 --- a/source/graphics/MapIO.cpp +++ b/source/graphics/MapIO.cpp @@ -32,11 +32,11 @@ #include #include -Status ParseHeightmapImage(const shared_ptr& fileData, size_t fileSize, std::vector& heightmap); +Status ParseHeightmapImage(const std::shared_ptr& fileData, size_t fileSize, std::vector& heightmap); Status LoadHeightmapImageVfs(const VfsPath& filepath, std::vector& heightmap) { - shared_ptr fileData; + std::shared_ptr fileData; size_t fileSize; RETURN_STATUS_IF_ERR(g_VFS->LoadFile(filepath, fileData, fileSize)); @@ -52,7 +52,7 @@ Status LoadHeightmapImageOs(const OsPath& filepath, std::vector& heightmap) size_t fileSize = lseek(file.Descriptor(), 0, SEEK_END); lseek(file.Descriptor(), 0, SEEK_SET); - shared_ptr fileData; + std::shared_ptr fileData; RETURN_STATUS_IF_ERR(AllocateAligned(fileData, fileSize, maxSectorSize)); Status readvalue = read(file.Descriptor(), fileData.get(), fileSize); @@ -63,7 +63,7 @@ Status LoadHeightmapImageOs(const OsPath& filepath, std::vector& heightmap) return ParseHeightmapImage(fileData, fileSize, heightmap); } -Status ParseHeightmapImage(const shared_ptr& fileData, size_t fileSize, std::vector& heightmap) +Status ParseHeightmapImage(const std::shared_ptr& fileData, size_t fileSize, std::vector& heightmap) { // Decode to a raw pixel format Tex tex; diff --git a/source/graphics/Overlay.h b/source/graphics/Overlay.h index 7b25ff9dea..b091fe58d9 100644 --- a/source/graphics/Overlay.h +++ b/source/graphics/Overlay.h @@ -116,7 +116,7 @@ struct SOverlayTexturedLine * recompute it, while at the same time maintaining copyability of this object (see also docs on * CTexturedLineRData). */ - shared_ptr m_RenderData; + std::shared_ptr m_RenderData; /** * Converts a string line cap type into its corresponding LineCap enum value, and returns diff --git a/source/graphics/ParticleEmitter.h b/source/graphics/ParticleEmitter.h index 76b0bd0498..fb9c059a35 100644 --- a/source/graphics/ParticleEmitter.h +++ b/source/graphics/ParticleEmitter.h @@ -41,7 +41,7 @@ struct SParticle float maxAge; }; -typedef shared_ptr CParticleEmitterPtr; +typedef std::shared_ptr CParticleEmitterPtr; /** * Particle emitter. @@ -129,10 +129,10 @@ public: /** * Stop this emitter emitting new particles, and pass responsibility for rendering - * to the CParticleManager. This should be called before dropping the last shared_ptr + * to the CParticleManager. This should be called before dropping the last std::shared_ptr * to this object so that it will carry on rendering (until all particles have dissipated) * even when it's no longer attached to a model. - * @param self the shared_ptr you're about to drop + * @param self the std::shared_ptr you're about to drop */ void Unattach(const CParticleEmitterPtr& self); diff --git a/source/graphics/ParticleEmitterType.h b/source/graphics/ParticleEmitterType.h index 4edb6b4573..4a3bbcfa58 100644 --- a/source/graphics/ParticleEmitterType.h +++ b/source/graphics/ParticleEmitterType.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2020 Wildfire Games. +/* Copyright (C) 2021 Wildfire Games. * This file is part of 0 A.D. * * 0 A.D. is free software: you can redistribute it and/or modify @@ -103,15 +103,15 @@ private: u16 m_MaxParticles; CBoundingBoxAligned m_MaxBounds; - typedef shared_ptr IParticleVarPtr; + typedef std::shared_ptr IParticleVarPtr; std::vector m_Variables; - typedef shared_ptr IParticleEffectorPtr; + typedef std::shared_ptr IParticleEffectorPtr; std::vector m_Effectors; CParticleManager& m_Manager; }; -typedef shared_ptr CParticleEmitterTypePtr; +typedef std::shared_ptr CParticleEmitterTypePtr; #endif // INCLUDED_PARTICLEEMITTERTYPE diff --git a/source/graphics/ShaderDefines.cpp b/source/graphics/ShaderDefines.cpp index 66cb515689..84dc4085c4 100644 --- a/source/graphics/ShaderDefines.cpp +++ b/source/graphics/ShaderDefines.cpp @@ -91,7 +91,7 @@ typename CShaderParams::SItems* CShaderParams::GetInterned(con typedef ItemNameCmp Cmp; ENSURE(std::adjacent_find(items.items.begin(), items.items.end(), std::binary_negate(Cmp())) == items.items.end()); - shared_ptr ptr = std::make_shared(items); + std::shared_ptr ptr = std::make_shared(items); s_InternedItems.insert(std::make_pair(items, ptr)); return ptr.get(); } diff --git a/source/graphics/ShaderDefines.h b/source/graphics/ShaderDefines.h index 702ee53729..b37c53bd5c 100644 --- a/source/graphics/ShaderDefines.h +++ b/source/graphics/ShaderDefines.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2020 Wildfire Games. +/* Copyright (C) 2021 Wildfire Games. * This file is part of 0 A.D. * * 0 A.D. is free software: you can redistribute it and/or modify @@ -119,7 +119,7 @@ protected: SItems* m_Items; // interned value private: - using InternedItems_t = std::unordered_map, SItemsHash >; + using InternedItems_t = std::unordered_map, SItemsHash>; static InternedItems_t s_InternedItems; /** diff --git a/source/graphics/TerrainProperties.h b/source/graphics/TerrainProperties.h index 5cbe61364a..d14ef85e76 100644 --- a/source/graphics/TerrainProperties.h +++ b/source/graphics/TerrainProperties.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2015 Wildfire Games. +/* Copyright (C) 2021 Wildfire Games. * This file is part of 0 A.D. * * 0 A.D. is free software: you can redistribute it and/or modify @@ -37,7 +37,7 @@ class XMBElement; class CXeromyces; class CTerrainProperties; -typedef shared_ptr CTerrainPropertiesPtr; +typedef std::shared_ptr CTerrainPropertiesPtr; class CTerrainProperties { diff --git a/source/graphics/TerrainTextureEntry.cpp b/source/graphics/TerrainTextureEntry.cpp index 5b6fb526ba..71c8a5e3b2 100644 --- a/source/graphics/TerrainTextureEntry.cpp +++ b/source/graphics/TerrainTextureEntry.cpp @@ -287,7 +287,7 @@ void CTerrainTextureEntry::LoadAlphaMaps(VfsPath &amtype) size_t tile_w = 2+base+2; // 2 pixel border (avoids bilinear filtering artifacts) size_t total_w = round_up_to_pow2(tile_w * NUM_ALPHA_MAPS); size_t total_h = base; ENSURE(is_pow2(total_h)); - shared_ptr data; + std::shared_ptr data; AllocateAligned(data, total_w*total_h, maxSectorSize); // for each tile on row for (size_t i = 0; i < NUM_ALPHA_MAPS; i++) @@ -346,7 +346,7 @@ void CTerrainTextureEntry::LoadAlphaMaps(VfsPath &amtype) // write to disk //Status ret = INFO::OK; { - shared_ptr file = DummySharedPtr(da.base); + std::shared_ptr file = DummySharedPtr(da.base); const ssize_t bytes_written = g_VFS->CreateFile(filename, file, da.pos); if(bytes_written > 0) ENSURE(bytes_written == (ssize_t)da.pos); diff --git a/source/graphics/TerrainTextureManager.h b/source/graphics/TerrainTextureManager.h index 377986f11f..71cb776583 100644 --- a/source/graphics/TerrainTextureManager.h +++ b/source/graphics/TerrainTextureManager.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2015 Wildfire Games. +/* Copyright (C) 2021 Wildfire Games. * This file is part of 0 A.D. * * 0 A.D. is free software: you can redistribute it and/or modify @@ -38,7 +38,7 @@ class CXeromyces; class CTerrainTextureEntry; class CTerrainProperties; -typedef shared_ptr CTerrainPropertiesPtr; +typedef std::shared_ptr CTerrainPropertiesPtr; class CTerrainGroup { diff --git a/source/graphics/TextRenderer.h b/source/graphics/TextRenderer.h index 9cf486fd4d..e0f88ca90a 100644 --- a/source/graphics/TextRenderer.h +++ b/source/graphics/TextRenderer.h @@ -158,7 +158,7 @@ private: size_t chars; // sum of runs[i].text->size() CMatrix3D transform; CColor color; - shared_ptr font; + std::shared_ptr font; std::list runs; }; @@ -171,7 +171,7 @@ private: CColor m_Color; CStrIntern m_FontName; - shared_ptr m_Font; + std::shared_ptr m_Font; bool m_Dirty; diff --git a/source/graphics/TextureConverter.cpp b/source/graphics/TextureConverter.cpp index ea0c572a95..a272b44e52 100644 --- a/source/graphics/TextureConverter.cpp +++ b/source/graphics/TextureConverter.cpp @@ -330,7 +330,7 @@ CTextureConverter::~CTextureConverter() bool CTextureConverter::ConvertTexture(const CTexturePtr& texture, const VfsPath& src, const VfsPath& dest, const Settings& settings) { - shared_ptr file; + std::shared_ptr file; size_t fileSize; if (m_VFS->LoadFile(src, file, fileSize) < 0) { @@ -385,7 +385,7 @@ bool CTextureConverter::ConvertTexture(const CTexturePtr& texture, const VfsPath #if CONFIG2_NVTT - shared_ptr request = std::make_shared(); + std::shared_ptr request = std::make_shared(); request->dest = dest; request->texture = texture; @@ -485,7 +485,7 @@ bool CTextureConverter::ConvertTexture(const CTexturePtr& texture, const VfsPath bool CTextureConverter::Poll(CTexturePtr& texture, VfsPath& dest, bool& ok) { #if CONFIG2_NVTT - shared_ptr result; + std::shared_ptr result; // Grab the first result (if any) { @@ -512,7 +512,7 @@ bool CTextureConverter::Poll(CTexturePtr& texture, VfsPath& dest, bool& ok) // Move output into a correctly-aligned buffer size_t size = result->output.buffer.size(); - shared_ptr file; + std::shared_ptr file; AllocateAligned(file, size, maxSectorSize); memcpy(file.get(), &result->output.buffer[0], size); if (m_VFS->CreateFile(result->dest, file, size) < 0) @@ -559,7 +559,7 @@ void CTextureConverter::RunThread(CTextureConverter* textureConverter) g_Profiler2.RecordSyncMarker(); PROFILE2_EVENT("wakeup"); - shared_ptr request; + std::shared_ptr request; { std::lock_guard wait_lock(textureConverter->m_WorkerMutex); @@ -572,7 +572,7 @@ void CTextureConverter::RunThread(CTextureConverter* textureConverter) } // Set up the result object - shared_ptr result = std::make_shared(); + std::shared_ptr result = std::make_shared(); result->dest = request->dest; result->texture = request->texture; diff --git a/source/graphics/TextureConverter.h b/source/graphics/TextureConverter.h index e6e1d44602..d5c0706724 100644 --- a/source/graphics/TextureConverter.h +++ b/source/graphics/TextureConverter.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2019 Wildfire Games. +/* Copyright (C) 2021 Wildfire Games. * This file is part of 0 A.D. * * 0 A.D. is free software: you can redistribute it and/or modify @@ -214,8 +214,8 @@ private: struct ConversionRequest; struct ConversionResult; - std::deque > m_RequestQueue; // protected by m_WorkerMutex - std::deque > m_ResultQueue; // protected by m_WorkerMutex + std::deque> m_RequestQueue; // protected by m_WorkerMutex + std::deque> m_ResultQueue; // protected by m_WorkerMutex bool m_Shutdown; // protected by m_WorkerMutex }; diff --git a/source/graphics/TextureManager.cpp b/source/graphics/TextureManager.cpp index c04c4f3a05..9e25995ae3 100644 --- a/source/graphics/TextureManager.cpp +++ b/source/graphics/TextureManager.cpp @@ -90,7 +90,7 @@ public: if (!m_DisableGL) { // Construct 1x1 24-bit texture - shared_ptr data(new u8[3], ArrayDeleter()); + std::shared_ptr data(new u8[3], ArrayDeleter()); data.get()[0] = 64; data.get()[1] = 64; data.get()[2] = 64; @@ -107,7 +107,7 @@ public: if (!m_DisableGL) { // Construct 1x1 24-bit texture - shared_ptr data(new u8[3], ArrayDeleter()); + std::shared_ptr data(new u8[3], ArrayDeleter()); data.get()[0] = 255; data.get()[1] = 0; data.get()[2] = 255; @@ -449,13 +449,13 @@ public: if (m_VFS->GetFileInfo(path, NULL) >= 0) { - shared_ptr settings(m_TextureConverter.LoadSettings(path)); + std::shared_ptr settings(m_TextureConverter.LoadSettings(path)); m_SettingsFiles.insert(std::make_pair(path, settings)); return settings.get(); } else { - m_SettingsFiles.insert(std::make_pair(path, shared_ptr())); + m_SettingsFiles.insert(std::make_pair(path, std::shared_ptr())); return NULL; } } @@ -520,7 +520,7 @@ private: // Cache for the conversion settings files using SettingsFilesMap = - std::unordered_map >; + std::unordered_map>; SettingsFilesMap m_SettingsFiles; }; diff --git a/source/graphics/tests/test_MeshManager.h b/source/graphics/tests/test_MeshManager.h index 06ecf0171b..6dace98273 100644 --- a/source/graphics/tests/test_MeshManager.h +++ b/source/graphics/tests/test_MeshManager.h @@ -75,7 +75,7 @@ class TestMeshManager : public CxxTest::TestSuite void copyFile(const VfsPath& src, const VfsPath& dst) { // Copy a file into the mod directory, so we can work on it: - shared_ptr data; size_t size = 0; + std::shared_ptr data; size_t size = 0; TS_ASSERT_OK(g_VFS->LoadFile(src, data, size)); TS_ASSERT_OK(g_VFS->CreateFile(dst, data, size)); } @@ -113,7 +113,7 @@ public: { copyFile(srcDAE, testDAE); //buildArchive(); - shared_ptr buf; + std::shared_ptr buf; AllocateAligned(buf, 100, maxSectorSize); strcpy_s((char*)buf.get(), 5, "Test"); g_VFS->CreateFile(testDAE, buf, 4); @@ -179,7 +179,7 @@ public: TestLogger logger; copyFile(srcDAE, testDAE); - shared_ptr buf; + std::shared_ptr buf; AllocateAligned(buf, 100, maxSectorSize); strcpy_s((char*)buf.get(), 100, "Not valid XML"); g_VFS->CreateFile(testSkeletonDefs, buf, 13); @@ -194,7 +194,7 @@ public: TestLogger logger; copyFile(srcSkeletonDefs, testSkeletonDefs); - shared_ptr buf; + std::shared_ptr buf; AllocateAligned(buf, 100, maxSectorSize); strcpy_s((char*)buf.get(), 100, "Not valid XML"); g_VFS->CreateFile(testDAE, buf, 13); diff --git a/source/graphics/tests/test_TextureConverter.h b/source/graphics/tests/test_TextureConverter.h index bf0083b2d8..166116dd8e 100644 --- a/source/graphics/tests/test_TextureConverter.h +++ b/source/graphics/tests/test_TextureConverter.h @@ -68,7 +68,7 @@ public: SDL_Delay(10); } - shared_ptr file; + std::shared_ptr file; size_t fileSize = 0; TS_ASSERT_OK(m_VFS->LoadFile(dest, file, fileSize));