Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Code review for const auto vs auto const #210

Merged
merged 2 commits into from
Feb 4, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion UVAtlas/isochart/SymmetricMatrix.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ namespace Isochart
static_cast<int>(std::min(dwMaxRange * 2, dwDimension))
);
eigs.init();
auto const numConverged = eigs.compute(
const auto numConverged = eigs.compute(
Spectra::SortRule::LargestAlge, // Sort by descending eigenvalues.
maxIterations,
epsilon
Expand Down
16 changes: 8 additions & 8 deletions UVAtlasTool/Mesh.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ namespace

if (length > 0)
{
auto const bytes = static_cast<DWORD>(sizeof(wchar_t) * length);
const auto bytes = static_cast<DWORD>(sizeof(wchar_t) * length);

if (!WriteFile(hFile, value, bytes, &bytesWritten, nullptr))
return HRESULT_FROM_WIN32(GetLastError());
Expand Down Expand Up @@ -1323,7 +1323,7 @@ HRESULT Mesh::ExportToVBO(const wchar_t* szFileName) const noexcept
if (FAILED(hr))
return hr;

auto const vertSize = static_cast<DWORD>(sizeof(vertex_t) * header.numVertices);
const auto vertSize = static_cast<DWORD>(sizeof(vertex_t) * header.numVertices);

DWORD bytesWritten;
if (!WriteFile(hFile.get(), vb.get(), vertSize, &bytesWritten, nullptr))
Expand All @@ -1332,7 +1332,7 @@ HRESULT Mesh::ExportToVBO(const wchar_t* szFileName) const noexcept
if (bytesWritten != vertSize)
return E_FAIL;

auto const indexSize = static_cast<DWORD>(sizeof(uint16_t) * header.numIndices);
const auto indexSize = static_cast<DWORD>(sizeof(uint16_t) * header.numIndices);

if (!WriteFile(hFile.get(), ib.get(), indexSize, &bytesWritten, nullptr))
return HRESULT_FROM_WIN32(GetLastError());
Expand Down Expand Up @@ -1404,7 +1404,7 @@ HRESULT Mesh::CreateFromVBO(const wchar_t* szFileName, std::unique_ptr<Mesh>& re
if (!vb || !ib)
return E_OUTOFMEMORY;

auto const vertSize = static_cast<DWORD>(sizeof(vertex_t) * header.numVertices);
const auto vertSize = static_cast<DWORD>(sizeof(vertex_t) * header.numVertices);

if (!ReadFile(hFile.get(), vb.get(), vertSize, &bytesRead, nullptr))
{
Expand All @@ -1414,7 +1414,7 @@ HRESULT Mesh::CreateFromVBO(const wchar_t* szFileName, std::unique_ptr<Mesh>& re
if (bytesRead != vertSize)
return E_FAIL;

auto const indexSize = static_cast<DWORD>(sizeof(uint16_t) * header.numIndices);
const auto indexSize = static_cast<DWORD>(sizeof(uint16_t) * header.numIndices);

if (!ReadFile(hFile.get(), ib.get(), indexSize, &bytesRead, nullptr))
{
Expand Down Expand Up @@ -1899,7 +1899,7 @@ HRESULT Mesh::ExportToCMO(const wchar_t* szFileName, size_t nMaterials, const Ma
if (FAILED(hr))
return hr;

auto const indexSize = static_cast<DWORD>(sizeof(uint16_t) * nIndices);
const auto indexSize = static_cast<DWORD>(sizeof(uint16_t) * nIndices);

DWORD bytesWritten;
if (!WriteFile(hFile.get(), ib.get(), indexSize, &bytesWritten, nullptr))
Expand All @@ -1919,7 +1919,7 @@ HRESULT Mesh::ExportToCMO(const wchar_t* szFileName, size_t nMaterials, const Ma
if (FAILED(hr))
return hr;

auto const vertSize = static_cast<DWORD>(sizeof(Vertex) * mnVerts);
const auto vertSize = static_cast<DWORD>(sizeof(Vertex) * mnVerts);

if (!WriteFile(hFile.get(), vb.get(), vertSize, &bytesWritten, nullptr))
return HRESULT_FROM_WIN32(GetLastError());
Expand All @@ -1940,7 +1940,7 @@ HRESULT Mesh::ExportToCMO(const wchar_t* szFileName, size_t nMaterials, const Ma
if (FAILED(hr))
return hr;

auto const skinVertSize = static_cast<DWORD>(sizeof(SkinningVertex) * mnVerts);
const auto skinVertSize = static_cast<DWORD>(sizeof(SkinningVertex) * mnVerts);

if (!WriteFile(hFile.get(), vbSkin.get(), skinVertSize, &bytesWritten, nullptr))
return HRESULT_FROM_WIN32(GetLastError());
Expand Down
6 changes: 3 additions & 3 deletions UVAtlasTool/UVAtlas.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -903,7 +903,7 @@ int __cdecl wmain(_In_ int argc, _In_z_count_(argc) wchar_t* argv[])
for (auto pConv = conversion.begin(); pConv != conversion.end(); ++pConv)
{
std::filesystem::path curpath(pConv->szSrc);
auto const ext = curpath.extension();
const auto ext = curpath.extension();

if (pConv != conversion.begin())
wprintf(L"\n");
Expand Down Expand Up @@ -1109,7 +1109,7 @@ int __cdecl wmain(_In_ int argc, _In_z_count_(argc) wchar_t* argv[])
}

std::filesystem::path tname(texFile);
auto const txext = tname.extension();
const auto txext = tname.extension();

ScratchImage iimage;

Expand Down Expand Up @@ -1540,7 +1540,7 @@ int __cdecl wmain(_In_ int argc, _In_z_count_(argc) wchar_t* argv[])

os.imbue(std::locale::classic());

for (auto const& mtl : inMaterial)
for (const auto& mtl : inMaterial)
{
// Minimal material output.
os << L"newmtl " << mtl.name << std::endl;
Expand Down
2 changes: 1 addition & 1 deletion build/UVAtlas-GitHub-WSL-13.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ pr:
- build/*.cmake
- build/*.in
- build/vcpkg.json
- build/UVAtlas-GitHub-WSL-11.yml
- build/UVAtlas-GitHub-WSL-13.yml

resources:
repositories:
Expand Down
Loading