...
 
Commits (10)
......@@ -14,6 +14,8 @@ are of interest here (the project names are in parentheses bebind):
* TortoiseGitMerge.exe (TortoiseGitMerge)
* TortoiseGitPlink.exe (TortoiseGitPlink)
* SshAskPass.exe (SshAskPass)
* GitWCRev.exe (GitWCRev)
* GitWCRevCOM.exe (GitWCRevCOM)
* tgittouch.exe (tgittouch)
TortoiseGit(32).dll and TortoiseGitStub(32).dll
......@@ -124,6 +126,21 @@ a helper utility (using the environment variables SSH_ASKPASS and GIT_ASKPASS).
All SshAskPass.exe does is, it displays the command line parameters in the GUI
and passes the entered values to STDOUT (where it is read by the calling tool).
GitWCRev.exe
==============
This program is for reading the status of a Git working tree or specific files
inside a working tree, and performing keyword substitution in a template file.
This is a console command line program.
cf. https://tortoisegit.org/docs/tortoisegit/tgit-gitwcrev.html
GitWCRevCOM.exe
==============
This program is the COM interface of GitWCRev.
cf. https://tortoisegit.org/docs/tortoisegit/tgit-gitwcrev-com-interface.html
tgittouch.exe
=============
This is a helper utility which creates/touches a file which is passed as
......
......@@ -25,7 +25,7 @@ First, you need to install the compiler package:
* Visual C++-ATL-support
* Windows 8.1 SDK and UCRT SDK
* MFC and ATL support (x86 and x64)
* Windows 10 SDK 17134.0 (for building the ribbon interface for TortoiseGitMerge)
* Windows 10 SDK (for building the ribbon interface for TortoiseGitMerge)
* optional: NuGet packet manager (requirement for GoogleTestAdapter, see below)
* optional: GoogleTestAdapter (if you want to run the tests from within VS or use the package described below)
......@@ -74,5 +74,5 @@ Open Developer Command Prompt for VS2017
If you want to build the installer package, make sure you build the Win32 configuration before the x64 one
Also, build the docs before the installer packages (or copy existing TortoiseGit_en.chm and TortoiseMerge_en.chm files into the doc/output folder).
For optimized debugging copy TGitNatVis.dll and TortoiseGit.natvis from contrib\NatVis to %USERPROFILE%\Documents\Visual Studio 2013\Visualizers.
For optimized debugging copy TGitNatVis.dll and TortoiseGit.natvis from contrib\NatVis to %USERPROFILE%\Documents\Visual Studio 2017\Visualizers.
Then CGitHash will provide a readable preview of the SHA-1 and CTGitPath is also optimized.
......@@ -47,16 +47,6 @@
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="..\tgit\apply.c" />
<ClCompile Include="..\tgit\builtin\am.c" />
<ClCompile Include="..\tgit\builtin\check-mailmap.c" />
<ClCompile Include="..\tgit\builtin\get-tar-commit-id.c" />
<ClCompile Include="..\tgit\builtin\interpret-trailers.c" />
<ClCompile Include="..\tgit\builtin\pull.c" />
<ClCompile Include="..\tgit\builtin\repack.c" />
<ClCompile Include="..\tgit\builtin\verify-commit.c" />
<ClCompile Include="..\tgit\builtin\worktree.c">
<ObjectFileName>$(IntDir)BuildIn%(Filename).obj</ObjectFileName>
</ClCompile>
<ClCompile Include="..\tgit\chdir-notify.c" />
<ClCompile Include="..\tgit\commit-graph.c" />
<ClCompile Include="..\tgit\compat\msvc.c" />
......@@ -263,138 +253,8 @@
<ClCompile Include="..\tgit\xdiff\xpatience.c" />
<ClCompile Include="..\tgit\xdiff\xprepare.c" />
<ClCompile Include="..\tgit\xdiff\xutils.c" />
<ClCompile Include="..\tgit\builtin\add.c" />
<ClCompile Include="..\tgit\builtin\annotate.c" />
<ClCompile Include="..\tgit\builtin\apply.c">
<ObjectFileName>$(IntDir)BuildIn%(Filename).obj</ObjectFileName>
</ClCompile>
<ClCompile Include="..\tgit\builtin\archive.c">
<ObjectFileName>$(IntDir)BuildIn%(Filename).obj</ObjectFileName>
</ClCompile>
<ClCompile Include="..\tgit\builtin\bisect--helper.c" />
<ClCompile Include="..\tgit\builtin\blame.c" />
<ClCompile Include="..\tgit\builtin\branch.c">
<ObjectFileName>$(IntDir)BuildIn%(Filename).obj</ObjectFileName>
</ClCompile>
<ClCompile Include="..\tgit\builtin\bundle.c">
<ObjectFileName>$(IntDir)BuildIn%(Filename).obj</ObjectFileName>
</ClCompile>
<ClCompile Include="..\tgit\builtin\cat-file.c" />
<ClCompile Include="..\tgit\builtin\check-attr.c" />
<ClCompile Include="..\tgit\builtin\check-ref-format.c" />
<ClCompile Include="..\tgit\builtin\checkout-index.c" />
<ClCompile Include="..\tgit\builtin\checkout.c" />
<ClCompile Include="..\tgit\builtin\clean.c" />
<ClCompile Include="..\tgit\builtin\clone.c" />
<ClCompile Include="..\tgit\builtin\commit-tree.c" />
<ClCompile Include="..\tgit\builtin\commit.c">
<ObjectFileName>$(IntDir)BuildIn%(Filename).obj</ObjectFileName>
</ClCompile>
<ClCompile Include="..\tgit\builtin\config.c">
<ObjectFileName>$(IntDir)BuildIn%(Filename).obj</ObjectFileName>
</ClCompile>
<ClCompile Include="..\tgit\builtin\count-objects.c" />
<ClCompile Include="..\tgit\builtin\describe.c" />
<ClCompile Include="..\tgit\builtin\diff-files.c" />
<ClCompile Include="..\tgit\builtin\diff-index.c" />
<ClCompile Include="..\tgit\builtin\diff-tree.c" />
<ClCompile Include="..\tgit\builtin\diff.c">
<ObjectFileName>$(IntDir)BuildIn%(Filename).obj</ObjectFileName>
</ClCompile>
<ClCompile Include="..\tgit\builtin\fast-export.c" />
<ClCompile Include="..\tgit\builtin\fetch-pack.c">
<ObjectFileName>$(IntDir)BuildIn%(Filename).obj</ObjectFileName>
</ClCompile>
<ClCompile Include="..\tgit\builtin\fetch.c" />
<ClCompile Include="..\tgit\builtin\fmt-merge-msg.c" />
<ClCompile Include="..\tgit\builtin\for-each-ref.c" />
<ClCompile Include="..\tgit\builtin\fsck.c">
<ObjectFileName>$(IntDir)BuildIn%(Filename).obj</ObjectFileName>
</ClCompile>
<ClCompile Include="..\tgit\builtin\gc.c" />
<ClCompile Include="..\tgit\builtin\grep.c">
<ObjectFileName>$(IntDir)BuildIn%(Filename).obj</ObjectFileName>
</ClCompile>
<ClCompile Include="..\tgit\builtin\hash-object.c" />
<ClCompile Include="..\tgit\builtin\help.c">
<ObjectFileName>$(IntDir)BuildIn%(Filename).obj</ObjectFileName>
</ClCompile>
<ClCompile Include="..\tgit\builtin\index-pack.c" />
<ClCompile Include="..\tgit\builtin\init-db.c" />
<ClCompile Include="..\tgit\builtin\log.c" />
<ClCompile Include="..\tgit\builtin\ls-files.c" />
<ClCompile Include="..\tgit\builtin\ls-remote.c" />
<ClCompile Include="..\tgit\builtin\ls-tree.c" />
<ClCompile Include="..\tgit\builtin\mailinfo.c" />
<ClCompile Include="..\tgit\builtin\mailsplit.c" />
<ClCompile Include="..\tgit\builtin\merge-base.c" />
<ClCompile Include="..\tgit\builtin\merge-file.c">
<ObjectFileName>$(IntDir)BuildIn%(Filename).obj</ObjectFileName>
</ClCompile>
<ClCompile Include="..\tgit\builtin\merge-index.c" />
<ClCompile Include="..\tgit\builtin\merge-ours.c" />
<ClCompile Include="..\tgit\builtin\merge-recursive.c">
<ObjectFileName>$(IntDir)BuildIn%(Filename).obj</ObjectFileName>
</ClCompile>
<ClCompile Include="..\tgit\builtin\merge-tree.c" />
<ClCompile Include="..\tgit\builtin\merge.c">
<ObjectFileName>$(IntDir)BuildIn%(Filename).obj</ObjectFileName>
</ClCompile>
<ClCompile Include="..\tgit\builtin\mktag.c" />
<ClCompile Include="..\tgit\builtin\mktree.c" />
<ClCompile Include="..\tgit\builtin\mv.c" />
<ClCompile Include="..\tgit\builtin\name-rev.c" />
<ClCompile Include="..\tgit\builtin\notes.c">
<ObjectFileName>$(IntDir)BuildIn%(Filename).obj</ObjectFileName>
</ClCompile>
<ClCompile Include="..\tgit\builtin\pack-objects.c">
<ObjectFileName>$(IntDir)BuildIn%(Filename).obj</ObjectFileName>
</ClCompile>
<ClCompile Include="..\tgit\builtin\pack-redundant.c" />
<ClCompile Include="..\tgit\builtin\pack-refs.c">
<ObjectFileName>$(IntDir)BuildIn%(Filename).obj</ObjectFileName>
</ClCompile>
<ClCompile Include="..\tgit\builtin\patch-id.c" />
<ClCompile Include="..\tgit\builtin\prune-packed.c" />
<ClCompile Include="..\tgit\builtin\prune.c" />
<ClCompile Include="..\tgit\builtin\push.c" />
<ClCompile Include="..\tgit\builtin\read-tree.c" />
<ClCompile Include="..\tgit\builtin\receive-pack.c" />
<ClCompile Include="..\tgit\builtin\reflog.c" />
<ClCompile Include="..\tgit\builtin\remote-ext.c" />
<ClCompile Include="..\tgit\builtin\remote-fd.c" />
<ClCompile Include="..\tgit\builtin\remote.c">
<ObjectFileName>$(IntDir)BuildIn%(Filename).obj</ObjectFileName>
</ClCompile>
<ClCompile Include="..\tgit\builtin\replace.c" />
<ClCompile Include="..\tgit\builtin\rerere.c">
<ObjectFileName>$(IntDir)BuildIn%(Filename).obj</ObjectFileName>
</ClCompile>
<ClCompile Include="..\tgit\builtin\reset.c" />
<ClCompile Include="..\tgit\builtin\rev-list.c" />
<ClCompile Include="..\tgit\builtin\rev-parse.c" />
<ClCompile Include="..\tgit\builtin\revert.c" />
<ClCompile Include="..\tgit\builtin\rm.c" />
<ClCompile Include="..\tgit\builtin\send-pack.c">
<ObjectFileName>$(IntDir)BuildIn%(Filename).obj</ObjectFileName>
</ClCompile>
<ClCompile Include="..\tgit\builtin\show-branch.c" />
<ClCompile Include="..\tgit\builtin\show-ref.c" />
<ClCompile Include="..\tgit\builtin\stripspace.c" />
<ClCompile Include="..\tgit\builtin\symbolic-ref.c" />
<ClCompile Include="..\tgit\builtin\tag.c">
<ObjectFileName>$(IntDir)BuildIn%(Filename).obj</ObjectFileName>
</ClCompile>
<ClCompile Include="..\tgit\builtin\unpack-file.c" />
<ClCompile Include="..\tgit\builtin\unpack-objects.c" />
<ClCompile Include="..\tgit\builtin\update-index.c" />
<ClCompile Include="..\tgit\builtin\update-ref.c" />
<ClCompile Include="..\tgit\builtin\update-server-info.c" />
<ClCompile Include="..\tgit\builtin\upload-archive.c" />
<ClCompile Include="..\tgit\builtin\var.c" />
<ClCompile Include="..\tgit\builtin\verify-pack.c" />
<ClCompile Include="..\tgit\builtin\verify-tag.c" />
<ClCompile Include="..\tgit\builtin\write-tree.c" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\tgit\apply.h" />
......
This diff is collapsed.
......@@ -46,7 +46,7 @@
<ItemDefinitionGroup>
<ClCompile>
<AdditionalIncludeDirectories>..\zlib;..\libgit2\src;..\libgit2\include;..\libgit2\deps\regex;..\libgit2\deps\http-parser;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>LIBGIT2_NO_FEATURES_H;HAVE_QSORT_S;GIT_HTTPS;GIT_WINHTTP;GIT_USE_NSEC;GIT_THREADS;GIT_SHA1_WIN32;GIT_DEPRECATE_HARD;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>LIBGIT2_NO_FEATURES_H;HAVE_QSORT_S;GIT_HTTPS;GIT_WINHTTP;GIT_USE_NSEC;GIT_THREADS;GIT_SHA1_WIN32;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions Condition="'$(Platform)'=='Win32'">GIT_ARCH_32;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions Condition="'$(Platform)'=='x64'">GIT_ARCH_64;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PrecompiledHeaderFile>precompiled.h</PrecompiledHeaderFile>
......@@ -241,6 +241,7 @@
<ClInclude Include="..\libgit2\include\git2\buffer.h" />
<ClInclude Include="..\libgit2\include\git2\cherrypick.h" />
<ClInclude Include="..\libgit2\include\git2\cred_helpers.h" />
<ClInclude Include="..\libgit2\include\git2\deprecated.h" />
<ClInclude Include="..\libgit2\include\git2\describe.h" />
<ClInclude Include="..\libgit2\include\git2\filter.h" />
<ClInclude Include="..\libgit2\include\git2\global.h" />
......
......@@ -1225,6 +1225,9 @@
<ClInclude Include="..\libgit2\src\streams\registry.h">
<Filter>Header Files\streams</Filter>
</ClInclude>
<ClInclude Include="..\libgit2\include\git2\deprecated.h">
<Filter>Public Header Files</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="..\libgit2\src\win32\git2.rc">
......
/***************************************************************************
/***************************************************************************
* Copyright (C) 2009-2011 by Stefan Fuhrmann *
* stefanfuhrmann@alice-dsl.de *
* *
......@@ -282,7 +282,7 @@ CJobScheduler::TJob CJobScheduler::AssignJob (SThreadInfo* info)
break;
}
return TJob ((IJob*)NULL, terminateThread);
return TJob(static_cast<IJob*>(nullptr), terminateThread);
}
// extract one job
......@@ -703,4 +703,4 @@ size_t CJobScheduler::GetHWThreadCount()
return sysNumProcs;
}
}
\ No newline at end of file
}
......@@ -4,6 +4,7 @@ Released: unreleased
== Bug Fixes ==
* Implement generic fix for "libgit2 returned the requested type does not match the type in ODB"
* Fixed issue #3342: Windows Explorer context menu: TortoiseGit doesn't recognize local Git working copy if "gitdir-redirection" is used within same folder
* Fixed issue #3349: View patch missing color
= Release 2.8.0 =
Released: 2019-02-28
......
This diff is collapsed.
......@@ -439,12 +439,12 @@ public:
{
winTime -= 116444736000000000LL; /* Windows to Unix Epoch conversion */
winTime /= 10000000; /* Nano to seconds resolution */
return (time_t)winTime;
return static_cast<time_t>(winTime);
}
static inline __int64 filetime_to_time_t(const FILETIME *ft)
{
return filetime_to_time_t(((__int64)ft->dwHighDateTime << 32) + ft->dwLowDateTime);
return filetime_to_time_t(static_cast<__int64>(ft->dwHighDateTime) << 32 | ft->dwLowDateTime);
}
static int GetFileModifyTime(LPCTSTR filename, __int64* time, bool* isDir = nullptr, __int64* size = nullptr, bool* isSymlink = nullptr)
......@@ -452,11 +452,11 @@ public:
WIN32_FILE_ATTRIBUTE_DATA fdata;
if (GetFileAttributesEx(filename, GetFileExInfoStandard, &fdata))
{
if(time)
*time = ((__int64)fdata.ftLastWriteTime.dwHighDateTime << 32) + fdata.ftLastWriteTime.dwLowDateTime;
if (time)
*time = static_cast<__int64>(fdata.ftLastWriteTime.dwHighDateTime) << 32 | fdata.ftLastWriteTime.dwLowDateTime;
if (size)
*size = ((__int64)fdata.nFileSizeHigh << 32) + fdata.nFileSizeLow;
*size = static_cast<__int64>(fdata.nFileSizeHigh) << 32 | fdata.nFileSizeLow;
if(isDir)
*isDir = !!( fdata.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY);
......@@ -478,7 +478,7 @@ public:
{
shortname = ref.Right(ref.GetLength() - prefix.GetLength());
if (CStringUtils::EndsWith(shortname, L"^{}"))
shortname.Truncate(shortname.GetLength() - (int)wcslen(L"^{}"));
shortname.Truncate(shortname.GetLength() - static_cast<int>(wcslen(L"^{}")));
return TRUE;
}
return FALSE;
......
......@@ -162,7 +162,7 @@ bool GitAdminDir::GetAdminDirPath(const CString& projectTopDir, CString& adminDi
int size = 65536;
CStringA commonDirA;
int length = (int)fread(commonDirA.GetBufferSetLength(size), sizeof(char), size, pFile);
int length = static_cast<int>(fread(commonDirA.GetBufferSetLength(size), sizeof(char), size, pFile));
commonDirA.ReleaseBuffer(length);
CString commonDir = CUnicodeUtils::GetUnicode(commonDirA);
commonDir.TrimRight(L"\r\n");
......@@ -209,13 +209,13 @@ CString GitAdminDir::ReadGitLink(const CString& topDir, const CString& dotGitPat
int size = 65536;
auto buffer = std::make_unique<char[]>(size);
int length = (int)fread(buffer.get(), sizeof(char), size, pFile);
int length = static_cast<int>(fread(buffer.get(), sizeof(char), size, pFile));
CStringA gitPathA(buffer.get(), length);
if (length < 8 || !CStringUtils::StartsWith(gitPathA, "gitdir: "))
return L"";
CString gitPath = CUnicodeUtils::GetUnicode(gitPathA);
// trim after converting to UTF-16, because CStringA trim does not work when having UTF-8 chars
gitPath = gitPath.Trim().Mid((int)wcslen(L"gitdir: "));
gitPath = gitPath.Trim().Mid(static_cast<int>(wcslen(L"gitdir: ")));
if (gitPath.IsEmpty())
return gitPath;
......
// TortoiseGit - a Windows shell extension for easy version control
// Copyright (C) 2016-2018 - TortoiseGit
// Copyright (C) 2016-2019 - TortoiseGit
// Copyright (C) 2007-2014 - TortoiseSVN
// This program is free software; you can redistribute it and/or
......@@ -25,12 +25,12 @@
#include "StringUtils.h"
#include <strsafe.h>
CLIPFORMAT CF_FILECONTENTS = (CLIPFORMAT)RegisterClipboardFormat(CFSTR_FILECONTENTS);
CLIPFORMAT CF_FILEDESCRIPTOR = (CLIPFORMAT)RegisterClipboardFormat(CFSTR_FILEDESCRIPTOR);
CLIPFORMAT CF_PREFERREDDROPEFFECT = (CLIPFORMAT)RegisterClipboardFormat(CFSTR_PREFERREDDROPEFFECT);
CLIPFORMAT CF_INETURL = (CLIPFORMAT)RegisterClipboardFormat(CFSTR_INETURL);
CLIPFORMAT CF_SHELLURL = (CLIPFORMAT)RegisterClipboardFormat(CFSTR_SHELLURL);
CLIPFORMAT CF_FILE_ATTRIBUTES_ARRAY = (CLIPFORMAT)RegisterClipboardFormat(CFSTR_FILE_ATTRIBUTES_ARRAY);
CLIPFORMAT CF_FILECONTENTS = static_cast<CLIPFORMAT>(RegisterClipboardFormat(CFSTR_FILECONTENTS));
CLIPFORMAT CF_FILEDESCRIPTOR = static_cast<CLIPFORMAT>(RegisterClipboardFormat(CFSTR_FILEDESCRIPTOR));
CLIPFORMAT CF_PREFERREDDROPEFFECT = static_cast<CLIPFORMAT>(RegisterClipboardFormat(CFSTR_PREFERREDDROPEFFECT));
CLIPFORMAT CF_INETURL = static_cast<CLIPFORMAT>(RegisterClipboardFormat(CFSTR_INETURL));
CLIPFORMAT CF_SHELLURL = static_cast<CLIPFORMAT>(RegisterClipboardFormat(CFSTR_SHELLURL));
CLIPFORMAT CF_FILE_ATTRIBUTES_ARRAY = static_cast<CLIPFORMAT>(RegisterClipboardFormat(CFSTR_FILE_ATTRIBUTES_ARRAY));
GitDataObject::GitDataObject(const CTGitPathList& gitpaths, const CGitHash& rev, int stripLength)
: m_gitPaths(gitpaths)
......@@ -129,13 +129,13 @@ STDMETHODIMP GitDataObject::GetData(FORMATETC* pformatetcIn, STGMEDIUM* pmedium)
if (m_revision.IsEmpty())
{
if ((pformatetcIn->lindex >= 0) && (pformatetcIn->lindex < (LONG)m_allPaths.size()))
if (pformatetcIn->lindex >= 0 && pformatetcIn->lindex < static_cast<LONG>(m_allPaths.size()))
filepath = g_Git.CombinePath(m_allPaths[pformatetcIn->lindex]);
}
else
{
filepath = CTempFiles::Instance().GetTempFilePath(true).GetWinPathString();
if ((pformatetcIn->lindex >= 0) && (pformatetcIn->lindex < (LONG)m_allPaths.size()))
if (pformatetcIn->lindex >= 0 && pformatetcIn->lindex < static_cast<LONG>(m_allPaths.size()))
{
if (g_Git.GetOneFile(m_revision.ToString(), m_allPaths[pformatetcIn->lindex], filepath))
{
......@@ -167,17 +167,17 @@ STDMETHODIMP GitDataObject::GetData(FORMATETC* pformatetcIn, STGMEDIUM* pmedium)
m_allPaths.push_back(m_gitPaths[i]);
}
size_t dataSize = sizeof(FILEGROUPDESCRIPTOR) + ((max((size_t)1, m_allPaths.size()) - 1) * sizeof(FILEDESCRIPTOR));
size_t dataSize = sizeof(FILEGROUPDESCRIPTOR) + ((max(size_t(1), m_allPaths.size()) - 1) * sizeof(FILEDESCRIPTOR));
HGLOBAL data = GlobalAlloc(GMEM_MOVEABLE | GMEM_SHARE | GMEM_ZEROINIT, dataSize);
FILEGROUPDESCRIPTOR* files = (FILEGROUPDESCRIPTOR*)GlobalLock(data);
auto files = static_cast<FILEGROUPDESCRIPTOR*>(GlobalLock(data));
files->cItems = static_cast<UINT>(m_allPaths.size());
int index = 0;
for (auto it = m_allPaths.cbegin(); it != m_allPaths.cend(); ++it)
{
CString temp(m_iStripLength > 0 ? it->GetWinPathString().Mid(m_iStripLength + 1) : (m_iStripLength == 0 ? it->GetWinPathString() : it->GetUIFileOrDirectoryName()));
if (temp.GetLength() < MAX_PATH)
wcscpy_s(files->fgd[index].cFileName, (LPCTSTR)temp);
wcscpy_s(files->fgd[index].cFileName, static_cast<LPCTSTR>(temp));
else
{
files->cItems--;
......@@ -213,7 +213,7 @@ STDMETHODIMP GitDataObject::GetData(FORMATETC* pformatetcIn, STGMEDIUM* pmedium)
HGLOBAL data = GlobalAlloc(GMEM_MOVEABLE | GMEM_SHARE | GMEM_ZEROINIT, sizeof(DWORD));
if (!data)
return E_OUTOFMEMORY;
DWORD* effect = (DWORD*)GlobalLock(data);
auto effect = static_cast<DWORD*>(GlobalLock(data));
if (!effect)
{
GlobalFree(data);
......@@ -244,8 +244,8 @@ STDMETHODIMP GitDataObject::GetData(FORMATETC* pformatetcIn, STGMEDIUM* pmedium)
pmedium->hGlobal = GlobalAlloc(GHND, (texta.GetLength() + 1) * sizeof(char));
if (pmedium->hGlobal)
{
char* pMem = (char*)GlobalLock(pmedium->hGlobal);
strcpy_s(pMem, texta.GetLength() + 1, (LPCSTR)texta);
auto pMem = static_cast<char*>(GlobalLock(pmedium->hGlobal));
strcpy_s(pMem, texta.GetLength() + 1, static_cast<LPCSTR>(texta));
GlobalUnlock(pmedium->hGlobal);
}
pmedium->pUnkForRelease = nullptr;
......@@ -272,8 +272,8 @@ STDMETHODIMP GitDataObject::GetData(FORMATETC* pformatetcIn, STGMEDIUM* pmedium)
pmedium->hGlobal = GlobalAlloc(GHND, (text.GetLength() + 1) * sizeof(TCHAR));
if (pmedium->hGlobal)
{
TCHAR* pMem = (TCHAR*)GlobalLock(pmedium->hGlobal);
wcscpy_s(pMem, text.GetLength() + 1, (LPCTSTR)text);
auto pMem = static_cast<TCHAR*>(GlobalLock(pmedium->hGlobal));
wcscpy_s(pMem, text.GetLength() + 1, static_cast<LPCTSTR>(text));
GlobalUnlock(pmedium->hGlobal);
}
pmedium->pUnkForRelease = nullptr;
......@@ -296,11 +296,11 @@ STDMETHODIMP GitDataObject::GetData(FORMATETC* pformatetcIn, STGMEDIUM* pmedium)
auto pBuffer = std::make_unique<char[]>(nBufferSize);
SecureZeroMemory(pBuffer.get(), nBufferSize);
DROPFILES* df = (DROPFILES*)pBuffer.get();
auto df = reinterpret_cast<DROPFILES*>(pBuffer.get());
df->pFiles = sizeof(DROPFILES);
df->fWide = 1;
TCHAR* pFilenames = (TCHAR*)(pBuffer.get() + sizeof(DROPFILES));
auto pFilenames = reinterpret_cast<TCHAR*>(pBuffer.get() + sizeof(DROPFILES));
TCHAR* pCurrentFilename = pFilenames;
for (int i = 0; i < m_gitPaths.GetCount(); ++i)
......@@ -308,7 +308,7 @@ STDMETHODIMP GitDataObject::GetData(FORMATETC* pformatetcIn, STGMEDIUM* pmedium)
if (m_gitPaths[i].m_Action & (CTGitPath::LOGACTIONS_MISSING | CTGitPath::LOGACTIONS_DELETED) || m_gitPaths[i].IsDirectory())
continue;
CString str = g_Git.CombinePath(m_gitPaths[i]);
wcscpy_s(pCurrentFilename, str.GetLength() + 1, (LPCWSTR)str);
wcscpy_s(pCurrentFilename, str.GetLength() + 1, static_cast<LPCWSTR>(str));
pCurrentFilename += str.GetLength();
*pCurrentFilename = '\0'; // separator between file names
pCurrentFilename++;
......@@ -333,7 +333,7 @@ STDMETHODIMP GitDataObject::GetData(FORMATETC* pformatetcIn, STGMEDIUM* pmedium)
auto pBuffer = std::make_unique<char[]>(nBufferSize);
SecureZeroMemory(pBuffer.get(), nBufferSize);
FILE_ATTRIBUTES_ARRAY* cf = (FILE_ATTRIBUTES_ARRAY*)pBuffer.get();
auto cf = reinterpret_cast<FILE_ATTRIBUTES_ARRAY*>(pBuffer.get());
cf->cItems = m_gitPaths.GetCount();
cf->dwProductFileAttributes = DWORD_MAX;
cf->dwSumFileAttributes = 0;
......@@ -528,19 +528,19 @@ void GitDataObject::CopyMedium(STGMEDIUM* pMedDest, STGMEDIUM* pMedSrc, FORMATET
switch (pMedSrc->tymed)
{
case TYMED_HGLOBAL:
pMedDest->hGlobal = (HGLOBAL)OleDuplicateData(pMedSrc->hGlobal, pFmtSrc->cfFormat, 0);
pMedDest->hGlobal = static_cast<HGLOBAL>(OleDuplicateData(pMedSrc->hGlobal, pFmtSrc->cfFormat, 0));
break;
case TYMED_GDI:
pMedDest->hBitmap = (HBITMAP)OleDuplicateData(pMedSrc->hBitmap, pFmtSrc->cfFormat, 0);
pMedDest->hBitmap = static_cast<HBITMAP>(OleDuplicateData(pMedSrc->hBitmap, pFmtSrc->cfFormat, 0));
break;
case TYMED_MFPICT:
pMedDest->hMetaFilePict = (HMETAFILEPICT)OleDuplicateData(pMedSrc->hMetaFilePict, pFmtSrc->cfFormat, 0);
pMedDest->hMetaFilePict = static_cast<HMETAFILEPICT>(OleDuplicateData(pMedSrc->hMetaFilePict, pFmtSrc->cfFormat, 0));
break;
case TYMED_ENHMF:
pMedDest->hEnhMetaFile = (HENHMETAFILE)OleDuplicateData(pMedSrc->hEnhMetaFile, pFmtSrc->cfFormat, 0);
pMedDest->hEnhMetaFile = static_cast<HENHMETAFILE>(OleDuplicateData(pMedSrc->hEnhMetaFile, pFmtSrc->cfFormat, 0));
break;
case TYMED_FILE:
pMedSrc->lpszFileName = (LPOLESTR)OleDuplicateData(pMedSrc->lpszFileName, pFmtSrc->cfFormat, 0);
pMedSrc->lpszFileName = static_cast<LPOLESTR>(OleDuplicateData(pMedSrc->lpszFileName, pFmtSrc->cfFormat, 0));
break;
case TYMED_ISTREAM:
pMedDest->pstm = pMedSrc->pstm;
......@@ -611,7 +611,7 @@ HRESULT GitDataObject::SetDropDescription(DROPIMAGETYPE image, LPCTSTR format, L
return E_INVALIDARG;
FORMATETC fetc = { 0 };
fetc.cfFormat = (CLIPFORMAT)RegisterClipboardFormat(CFSTR_DROPDESCRIPTION);
fetc.cfFormat = static_cast<CLIPFORMAT>(RegisterClipboardFormat(CFSTR_DROPDESCRIPTION));
fetc.dwAspect = DVASPECT_CONTENT;
fetc.lindex = -1;
fetc.tymed = TYMED_HGLOBAL;
......@@ -621,7 +621,7 @@ HRESULT GitDataObject::SetDropDescription(DROPIMAGETYPE image, LPCTSTR format, L
if (medium.hGlobal == 0)
return E_OUTOFMEMORY;
DROPDESCRIPTION* pDropDescription = (DROPDESCRIPTION*)GlobalLock(medium.hGlobal);
auto pDropDescription = static_cast<DROPDESCRIPTION*>(GlobalLock(medium.hGlobal));
if (!pDropDescription)
return E_FAIL;
StringCchCopy(pDropDescription->szInsert, _countof(pDropDescription->szInsert), insert);
......
// TortoiseGit - a Windows shell extension for easy version control
// TortoiseGit - a Windows shell extension for easy version control
// Copyright (C) 2003-2008,2011, 2014 - TortoiseSVN
// Copyright (C) 2008-2017 - TortoiseGit
// Copyright (C) 2008-2017, 2019 - TortoiseGit
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
......@@ -112,7 +112,7 @@ const FileStatusCacheEntry * GitFolderStatus::BuildCache(const CTGitPath& filepa
FileStatusCacheEntry* ret = nullptr;
if (wcslen(filepath.GetWinPath()) == 3)
ret = &m_cache[(LPCTSTR)filepath.GetWinPathString().Left(2)];
ret = &m_cache[static_cast<LPCTSTR>(filepath.GetWinPathString().Left(2))];
else
ret = &m_cache[filepath.GetWinPath()];
......@@ -134,7 +134,7 @@ const FileStatusCacheEntry * GitFolderStatus::BuildCache(const CTGitPath& filepa
ULONGLONG GitFolderStatus::GetTimeoutValue()
{
ULONGLONG timeout = GITFOLDERSTATUS_CACHETIMEOUT;
ULONGLONG factor = (ULONGLONG)m_cache.size() / 200UL;
ULONGLONG factor = static_cast<ULONGLONG>(m_cache.size()) / 200UL;
if (factor==0)
factor = 1;
return factor*timeout;
......
// TortoiseGit - a Windows shell extension for easy version control
// Copyright (C) 2008-2016 - TortoiseGit
// Copyright (C) 2008-2016, 2019 - TortoiseGit
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
......@@ -54,7 +54,7 @@ static bool FindGitForWindows(CString& sMsysGitPath)
sMsysGitPath += L"\\cmd";
else
{
CTraceToOutputDebugString::Instance()(_T(__FUNCTION__) L": Git for Windows installation found, but git.exe not exists in %s\n", (LPCTSTR)sMsysGitPath);
CTraceToOutputDebugString::Instance()(_T(__FUNCTION__) L": Git for Windows installation found, but git.exe not exists in %s\n", static_cast<LPCTSTR>(sMsysGitPath));
sMsysGitPath.Empty();
}
}
......
// TortoiseGit - a Windows shell extension for easy version control
// Copyright (C) 2008-2018 - TortoiseGit
// Copyright (C) 2008-2019 - TortoiseGit
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
......@@ -46,11 +46,11 @@ public:
}
CGitHash(const git_oid* oid)
{
git_oid_cpy((git_oid*)m_hash, oid);
git_oid_cpy(reinterpret_cast<git_oid*>(m_hash), oid);
}
CGitHash(const git_oid& oid)
{
git_oid_cpy((git_oid*)m_hash, &oid);
git_oid_cpy(reinterpret_cast<git_oid*>(m_hash), &oid);
}
CGitHash& operator = (const CString& str)
{
......@@ -65,12 +65,12 @@ public:
}
CGitHash& operator = (const git_oid* oid)
{
git_oid_cpy((git_oid*)m_hash, oid);
git_oid_cpy(reinterpret_cast<git_oid*>(m_hash), oid);
return *this;
}
CGitHash& operator = (const git_oid& oid)
{
git_oid_cpy((git_oid*)m_hash, &oid);
git_oid_cpy(reinterpret_cast<git_oid*>(m_hash), &oid);
return *this;
}
CGitHash(const CString &str)
......@@ -152,7 +152,7 @@ public:
operator const git_oid*() const
{
return (const git_oid*)m_hash;
return reinterpret_cast<const git_oid*>(m_hash);
}
explicit operator const unsigned char*() const
......@@ -209,7 +209,7 @@ namespace std
{
std::size_t operator()(const CGitHash& k) const
{
return *(size_t*)k.m_hash;
return reinterpret_cast<const size_t&>(k.m_hash);
}
};
}
This diff is collapsed.
// TortoiseGitMerge - a Diff/Patch program
// Copyright (C) 2012-2013, 2015-2018 - TortoiseGit
// Copyright (C) 2012-2013, 2015-2019 - TortoiseGit
// Copyright (C) 2010-2012 - TortoiseSVN
// This program is free software; you can redistribute it and/or
......@@ -87,7 +87,7 @@ int GitPatch::Init(const CString& patchfile, const CString& targetpath, CSysProg
m_pProgDlg = nullptr;
if ((m_nRejected > ((int)m_filePaths.size() / 3)) && !m_testPath.IsEmpty())
if ((m_nRejected > (static_cast<int>(m_filePaths.size()) / 3)) && !m_testPath.IsEmpty())
{
++m_nStrip;
for (m_nStrip = 0; m_nStrip < STRIP_LIMIT; ++m_nStrip)
......@@ -110,7 +110,7 @@ int GitPatch::Init(const CString& patchfile, const CString& targetpath, CSysProg
if (!ApplyPatches())
m_filePaths.clear();
}
return (int)m_filePaths.size();
return static_cast<int>(m_filePaths.size());
}
bool GitPatch::ApplyPatches()
......@@ -136,7 +136,7 @@ bool GitPatch::PatchFile(int nIndex, CString &datapath)
pr.path = m_patch.GetFilename(nIndex);
if (m_pProgDlg)
m_pProgDlg->FormatPathLine(2, IDS_PATCH_PATHINGFILE, (LPCTSTR)pr.path);
m_pProgDlg->FormatPathLine(2, IDS_PATCH_PATHINGFILE, static_cast<LPCTSTR>(pr.path));
//first, do a "dry run" of patching against the file in place...
if (!m_patch.PatchFile(m_nStrip, nIndex, datapath, sTempFile))
......@@ -153,20 +153,20 @@ bool GitPatch::PatchFile(int nIndex, CString &datapath)
{
if (sVersion.IsEmpty())
{
m_errorStr.Format(IDS_ERR_MAINFRAME_FILECONFLICTNOVERSION, (LPCTSTR)sFilePath);
m_errorStr.Format(IDS_ERR_MAINFRAME_FILECONFLICTNOVERSION, static_cast<LPCTSTR>(sFilePath));
return false; // cannot apply patch which does not apply cleanly w/o git information in patch file.
}
sBaseFile = CTempFiles::Instance().GetTempFilePathString();
if (!CAppUtils::GetVersionedFile(sFilePath, sVersion, sBaseFile, m_pProgDlg))
{
m_errorStr.FormatMessage(IDS_ERR_MAINFRAME_FILEVERSIONNOTFOUND, (LPCTSTR)sVersion, (LPCTSTR)sFilePath);
m_errorStr.FormatMessage(IDS_ERR_MAINFRAME_FILEVERSIONNOTFOUND, static_cast<LPCTSTR>(sVersion), static_cast<LPCTSTR>(sFilePath));
return false;
}
}
if (m_pProgDlg)
m_pProgDlg->FormatPathLine(2, IDS_PATCH_PATHINGFILE, (LPCTSTR)pr.path);
m_pProgDlg->FormatPathLine(2, IDS_PATCH_PATHINGFILE, static_cast<LPCTSTR>(pr.path));
int patchtry = m_patch.PatchFile(m_nStrip, nIndex, datapath, sTempFile, sBaseFile, true);
......@@ -182,13 +182,13 @@ bool GitPatch::PatchFile(int nIndex, CString &datapath)
pr.rejectsPath = m_patch.GetErrorMessage();
}
TRACE(L"comparing %s and %s\nagainst the base file %s\n", (LPCTSTR)sTempFile, (LPCTSTR)sFilePath, (LPCTSTR)sBaseFile);
TRACE(L"comparing %s and %s\nagainst the base file %s\n", static_cast<LPCTSTR>(sTempFile), static_cast<LPCTSTR>(sFilePath), static_cast<LPCTSTR>(sBaseFile));
}
else
{
//"dry run" was successful, so save the patched file somewhere...
pr.rejects = 0;
TRACE(L"comparing %s\nwith the patched result %s\n", (LPCTSTR)sFilePath, (LPCTSTR)sTempFile);
TRACE(L"comparing %s\nwith the patched result %s\n", static_cast<LPCTSTR>(sFilePath), static_cast<LPCTSTR>(sTempFile));
}
pr.resultPath = sTempFile;
......@@ -206,7 +206,7 @@ CString GitPatch::GetPatchRejects(int nIndex) const
{
if (nIndex < 0)
return L"";
if (nIndex < (int)m_filePaths.size())
if (nIndex < static_cast<int>(m_filePaths.size()))
return m_filePaths[nIndex].rejectsPath;
return L"";
......@@ -342,7 +342,7 @@ CString GitPatch::GetStrippedPath(int nIndex) const
{
if (nIndex < 0)
return L"";
if (nIndex < (int)m_filePaths.size())
if (nIndex < static_cast<int>(m_filePaths.size()))
{
CString filepath = Strip(GetFilePath(nIndex));
return filepath;
......
// TortoiseGitMerge - a Diff/Patch program
// TortoiseGitMerge - a Diff/Patch program
// Copyright (C) 2012 - TortoiseGit
// Copyright (C) 2012, 2019 - TortoiseGit
// Copyright (C) 2010-2012, 2015 - TortoiseSVN
// This program is free software; you can redistribute it and/or
......@@ -69,7 +69,7 @@ public:
/**
* returns the number of files that are affected by the patchfile.
*/
int GetNumberOfFiles() const { return (int)m_filePaths.size(); }
int GetNumberOfFiles() const { return static_cast<int>(m_filePaths.size()); }
/**
* Returns the path of the affected file
......
......@@ -135,7 +135,7 @@ int GitRev::ParserFromCommit(const git_commit* commit)
m_Subject = CUnicodeUtils::GetUnicode(msg, encode);
else
{
m_Subject = CUnicodeUtils::GetUnicode(CStringA(msg, (int)(body - msg)), encode);
m_Subject = CUnicodeUtils::GetUnicode(CStringA(msg, static_cast<int>(body - msg)), encode);
m_Body = CUnicodeUtils::GetUnicode(body + 1, encode);
}
......@@ -175,10 +175,10 @@ int GitRev::GetCommit(git_repository* repo, const CString& refname)
void GitRev::DbgPrint()
{
ATLTRACE(L"Commit %s\r\n", (LPCTSTR)this->m_CommitHash.ToString());
ATLTRACE(L"Commit %s\r\n", static_cast<LPCTSTR>(this->m_CommitHash.ToString()));
for (unsigned int i = 0; i < this->m_ParentHash.size(); ++i)
{
ATLTRACE(L"Parent %i %s", i, (LPCTSTR)m_ParentHash[i].ToString());
ATLTRACE(L"Parent %i %s", i, static_cast<LPCTSTR>(m_ParentHash[i].ToString()));
}
ATLTRACE(L"\n");
}
......
// TortoiseGit - a Windows shell extension for easy version control
// TortoiseGit - a Windows shell extension for easy version control
// Copyright (C) 2008-2017 - TortoiseGit
// Copyright (C) 2008-2017, 2019 - TortoiseGit
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
......@@ -112,7 +112,7 @@ public:
GIT_REV_LIST m_ParentHash;
virtual void Clear();
inline int ParentsCount(){ return (int)m_ParentHash.size(); }
inline int ParentsCount() {return static_cast<int>(m_ParentHash.size()); }
int ParserFromCommit(GIT_COMMIT *commit);
int ParserParentFromCommit(GIT_COMMIT *commit);
......
......@@ -229,7 +229,7 @@ int GitRevLoglist::SafeFetchFullInfo(CGit* git)
{
git_diff_find_options diffopts = GIT_DIFF_FIND_OPTIONS_INIT;
diffopts.flags = GIT_DIFF_FIND_COPIES | GIT_DIFF_FIND_RENAMES;
diffopts.rename_threshold = diffopts.copy_threshold = (uint16_t)CGit::ms_iSimilarityIndexThreshold;
diffopts.rename_threshold = diffopts.copy_threshold = static_cast<uint16_t>(CGit::ms_iSimilarityIndexThreshold);
if (git_diff_find_similar(diff, &diffopts) < 0)
return-1;
}
......@@ -365,7 +365,7 @@ int GitRevLoglist::SafeFetchFullInfo(CGit* git)
CGit::StringAppend(&stroldname, oldname, CP_UTF8);
path.SetFromGit(strnewname, &stroldname, &isDir);
}
path.ParserAction((BYTE)status);
path.ParserAction(static_cast<BYTE>(status));
path.m_ParentNo = i;
m_Action |= path.m_Action;
......@@ -421,7 +421,7 @@ int GitRevLoglist::GetRefLog(const CString& ref, std::vector<GitRevLoglist>& ref
GitRevLoglist rev;
rev.m_CommitHash = git_reflog_entry_id_new(entry);
rev.m_Ref.Format(L"%s@{%zu}", (LPCTSTR)ref, i);
rev.m_Ref.Format(L"%s@{%zu}", static_cast<LPCTSTR>(ref), i);
rev.GetCommitterDate() = CTime(git_reflog_entry_committer(entry)->when.time);
if (git_reflog_entry_message(entry) != nullptr)
{
......@@ -446,9 +446,9 @@ int GitRevLoglist::GetRefLog(const CString& ref, std::vector<GitRevLoglist>& ref
// no error checking, because the only error which could occur is file not found
git_for_each_reflog_ent(CUnicodeUtils::GetUTF8(ref), [](struct GIT_OBJECT_OID* /*old_oid*/, struct GIT_OBJECT_OID* new_oid, const char* /*committer*/, unsigned long long time, int /*sz*/, const char* msg, void* data)
{
std::vector<GitRevLoglist>* vector = (std::vector<GitRevLoglist>*)data;
auto vector = static_cast<std::vector<GitRevLoglist>*>(data);
GitRevLoglist rev;
rev.m_CommitHash = (const unsigned char*)new_oid->hash;
rev.m_CommitHash = static_cast<const unsigned char*>(new_oid->hash);
rev.GetCommitterDate() = CTime(time);
CString one = CUnicodeUtils::GetUnicode(msg);
......@@ -468,7 +468,7 @@ int GitRevLoglist::GetRefLog(const CString& ref, std::vector<GitRevLoglist>& ref
for (size_t i = tmp.size(), id = 0; i > 0; --i, ++id)
{
GitRevLoglist rev = tmp[i - 1];
rev.m_Ref.Format(L"%s@{%zu}", (LPCTSTR)ref, id);
rev.m_Ref.Format(L"%s@{%zu}", static_cast<LPCTSTR>(ref), id);
refloglist.push_back(rev);
}
return 0;
......@@ -487,7 +487,7 @@ int GitRevLoglist::GetRefLog(const CString& ref, std::vector<GitRevLoglist>& ref
return 0;
CString cmd, out;
cmd.Format(L"git.exe reflog show --pretty=\"%%H %%gD: %%gs\" --date=raw %s", (LPCTSTR)ref);
cmd.Format(L"git.exe reflog show --pretty=\"%%H %%gD: %%gs\" --date=raw %s", static_cast<LPCTSTR>(ref));
if (g_Git.Run(cmd, &out, &error, CP_UTF8))
return -1;
......@@ -503,7 +503,7 @@ int GitRevLoglist::GetRefLog(const CString& ref, std::vector<GitRevLoglist>& ref
GitRevLoglist rev;
rev.m_CommitHash = one.Left(refPos);
rev.m_Ref.Format(L"%s@{%d}", (LPCTSTR)ref, i++);
rev.m_Ref.Format(L"%s@{%d}", static_cast<LPCTSTR>(ref), i++);
int prefixPos = one.Find(prefix, refPos + 1);
if (prefixPos != refPos + 1)
continue;
......
......@@ -53,7 +53,7 @@ int GitRevRefBrowser::GetGitRevRefMap(MAP_REF_GITREVREFBROWSER& map, int mergefi
}
CString cmd;
cmd.Format(L"git.exe for-each-ref%s --format=\"%%(refname)%%04 %%(objectname)%%04 %%(upstream)%%04 %%(subject)%%04 %%(authorname)%%04 %%(authordate:raw)%%04 %%(creator)%%04 %%(creatordate:raw)%%03\"", (LPCTSTR)args);
cmd.Format(L"git.exe for-each-ref%s --format=\"%%(refname)%%04 %%(objectname)%%04 %%(upstream)%%04 %%(subject)%%04 %%(authorname)%%04 %%(authordate:raw)%%04 %%(creator)%%04 %%(creatordate:raw)%%03\"", static_cast<LPCTSTR>(args));
CString allRefs;
if (g_Git.Run(cmd, &allRefs, &err, CP_UTF8))
return -1;
......@@ -85,7 +85,7 @@ int GitRevRefBrowser::GetGitRevRefMap(MAP_REF_GITREVREFBROWSER& map, int mergefi
}
if (CStringUtils::StartsWith(refName, L"refs/heads/"))
ref.m_Description = descriptions[refName.Mid((int)wcslen(L"refs/heads/"))];
ref.m_Description = descriptions[refName.Mid(static_cast<int>(wcslen(L"refs/heads/")))];
map.emplace(refName, ref);
}
......
// TortoiseGit - a Windows shell extension for easy version control
// Copyright (C) 2008-2018 - TortoiseGit
// Copyright (C) 2008-2019 - TortoiseGit
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
......@@ -60,8 +60,7 @@ int GitStatus::GetAllStatus(const CTGitPath& path, bool bIsRecursive, git_wc_sta
sSubPath = s.Right(s.GetLength() - sProjectRoot.GetLength() - 1/*otherwise it gets initial slash*/);
}
bool isfull = ((DWORD)CRegStdDWORD(L"Software\\TortoiseGit\\CacheType",
GetSystemMetrics(SM_REMOTESESSION) ? ShellCache::dll : ShellCache::exe) == ShellCache::dllFull);
bool isfull = (static_cast<DWORD>(CRegStdDWORD(L"Software\\TortoiseGit\\CacheType", GetSystemMetrics(SM_REMOTESESSION)) ? ShellCache::dll : ShellCache::exe) == ShellCache::dllFull);
if(isDir)
{
......@@ -116,8 +115,7 @@ void GitStatus::GetStatus(const CTGitPath& path, bool /*update*/ /* = false */,
if ( !path.HasAdminDir(&sProjectRoot) )
return;
bool isfull = ((DWORD)CRegStdDWORD(L"Software\\TortoiseGit\\CacheType",
GetSystemMetrics(SM_REMOTESESSION) ? ShellCache::dll : ShellCache::exe) == ShellCache::dllFull);
bool isfull = (static_cast<DWORD>(CRegStdDWORD(L"Software\\TortoiseGit\\CacheType", GetSystemMetrics(SM_REMOTESESSION)) ? ShellCache::dll : ShellCache::exe) == ShellCache::dllFull);
int err = 0;
......@@ -242,7 +240,7 @@ static int GetFileStatus_int(const CString& gitdir, CGitRepoLists& repolists, co
if (start == NPOS)
{
status.status = git_wc_status_added;
CTraceToOutputDebugString::Instance()(_T(__FUNCTION__) L": File miss in head tree %s", (LPCTSTR)path);
CTraceToOutputDebugString::Instance()(_T(__FUNCTION__) L": File miss in head tree %s", static_cast<LPCTSTR>(path));
return 0;
}
......@@ -316,7 +314,7 @@ int GitStatus::GetFileList(const CString& path, std::vector<CGitFileName>& list,
if (wcscmp(data.cFileName, L"..") == 0)
continue;
CGitFileName filename(data.cFileName, ((__int64)data.nFileSizeHigh << 32) + data.nFileSizeLow, ((__int64)data.ftLastWriteTime.dwHighDateTime << 32) + data.ftLastWriteTime.dwLowDateTime);
CGitFileName filename(data.cFileName, static_cast<__int64>(data.nFileSizeHigh) << 32 | data.nFileSizeLow, static_cast<__int64>(data.ftLastWriteTime.dwHighDateTime) << 32 | data.ftLastWriteTime.dwLowDateTime);
if ((data.dwFileAttributes & FILE_ATTRIBUTE_REPARSE_POINT) && !CPathUtils::ReadLink(CombinePath(path, filename.m_FileName)))
filename.m_bSymlink = true;
else if (data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
......@@ -429,7 +427,7 @@ int GitStatus::EnumDirStatus(const CString& gitdir, const CString& subpath, git_
else if (pos != NPOS && posintree == NPOS) /* Check if file added */
{
status.status = git_wc_status_added;
if ((*indexptr)[pos].m_Flags & GIT_IDXENTRY_STAGEMASK)
if ((*indexptr)[pos].m_Flags & GIT_INDEX_ENTRY_STAGEMASK)
status.status = git_wc_status_conflicted;
callback(CombinePath(gitdir, onepath), &status, bIsDir, fileentry.m_LastModified, pData);
}
......@@ -443,7 +441,7 @@ int GitStatus::EnumDirStatus(const CString& gitdir, const CString& subpath, git_
else
{
auto& indexentry = (*indexptr)[pos];
if (indexentry.m_Flags & GIT_IDXENTRY_STAGEMASK)
if (indexentry.m_Flags & GIT_INDEX_ENTRY_STAGEMASK)
{
status.status = git_wc_status_conflicted;
callback(CombinePath(gitdir, onepath), &status, false, fileentry.m_LastModified, pData);
......@@ -485,7 +483,7 @@ int GitStatus::EnumDirStatus(const CString& gitdir, const CString& subpath, git_
if (SearchInSortVector(filelist, filename, isDir ? length : -1, indexptr->IsIgnoreCase()) == NPOS) // do full match for filenames and only prefix-match ending with "/" for folders
{
git_wc_status2_t status = { (!isDir || IsDirectSubmodule(entry.m_FileName, commonPrefixLength)) ? git_wc_status_deleted : git_wc_status_modified, false, false }; // only report deleted submodules and files as deletedy
if ((entry.m_FlagsExtended & GIT_IDXENTRY_SKIP_WORKTREE) != 0)
if ((entry.m_FlagsExtended & GIT_INDEX_ENTRY_SKIP_WORKTREE) != 0)
{
status.skipWorktree = true;
status.status = git_wc_status_normal;
......@@ -629,7 +627,7 @@ int GitStatus::GetDirStatus(const CString& gitdir, const CString& subpath, git_w
// Check Conflict;
for (auto it = sharedRepoLists.pIndex->cbegin() + start, itlast = sharedRepoLists.pIndex->cbegin() + end; sharedRepoLists.pIndex->m_bHasConflicts && it <= itlast; ++it)
{
if (((*it).m_Flags & GIT_IDXENTRY_STAGEMASK) != 0)
if (((*it).m_Flags & GIT_INDEX_ENTRY_STAGEMASK) != 0)
{
*status = git_wc_status_conflicted;
// When status == git_wc_status_conflicted, we don't need to check each file status
......
This diff is collapsed.
......@@ -240,7 +240,7 @@ public:
};
static_assert(IDGITLC_MOVETOCS < 64, "IDs must be <64 in order to be usable in a bitfield");
int GetColumnIndex(int colmask);
static inline unsigned __int64 GetContextMenuBit(int i){ return ((unsigned __int64 )0x1)<<i ;}
static inline unsigned __int64 GetContextMenuBit(int i) { return static_cast<unsigned __int64>(0x1) << i; }
/**
* Sent to the parent window (using ::SendMessage) after a context menu
* command has finished if the item count has changed.
......
// TortoiseGit - a Windows shell extension for easy version control
// Copyright (C) 2011-2016 - TortoiseGit
// Copyright (C) 2011-2016, 2019 - TortoiseGit
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
......@@ -86,7 +86,7 @@ bool CMassiveGitTaskBase::ExecuteCommands(volatile BOOL& cancel)
}
CString cmd, out;
cmd.Format(L"git.exe %s %s%s", (LPCTSTR)m_sParams, m_bIsPath ? L"--" : L"", (LPCTSTR)add);
cmd.Format(L"git.exe %s %s%s", static_cast<LPCTSTR>(m_sParams), m_bIsPath ? L"--" : L"", static_cast<LPCTSTR>(add));
int exitCode = g_Git.Run(cmd, &out, CP_UTF8);
if (exitCode && !m_bIgnoreErrors)
{
......@@ -122,7 +122,7 @@ void CMassiveGitTaskBase::ReportError(const CString& out, int /*exitCode*/)
int CMassiveGitTaskBase::GetListCount() const
{
return m_bIsPath ? m_pathList.GetCount() : (int)m_itemList.size();
return m_bIsPath ? m_pathList.GetCount() : static_cast<int>(m_itemList.size());
}
bool CMassiveGitTaskBase::IsListEmpty() const
......
......@@ -362,7 +362,7 @@ void CTGitPath::UpdateAttributes() const
if (m_bIsDirectory)
m_fileSize = 0;
else
m_fileSize = ((INT64)( (DWORD)(attribs.nFileSizeLow) ) | ( (INT64)( (DWORD)(attribs.nFileSizeHigh) )<<32 ));
m_fileSize = static_cast<__int64>(attribs.nFileSizeHigh) << 32 | attribs.nFileSizeLow;
m_bIsReadOnly = !!(attribs.dwFileAttributes & FILE_ATTRIBUTE_READONLY);
m_bExists = true;
}
......@@ -385,7 +385,7 @@ void CTGitPath::UpdateAttributes() const
m_bExistsKnown = true;
}
CTGitPath CTGitPath::GetSubPath(const CTGitPath &root)
CTGitPath CTGitPath::GetSubPath(const CTGitPath& root) const
{
CTGitPath path;
......@@ -754,7 +754,7 @@ bool CTGitPath::IsRegisteredSubmoduleOfParentProject(CString* parentProjectRoot
relativePath.Replace(L'\\', L'/');
relativePath.Trim(L'/');
CStringA submodulePath = CUnicodeUtils::GetUTF8(relativePath);
if (git_config_foreach_match(config, "submodule\\..*\\.path", [](const git_config_entry *entry, void *data) { return entry->value == *(CStringA *)data ? GIT_EUSER : 0; }, &submodulePath) == GIT_EUSER)
if (git_config_foreach_match(config, "submodule\\..*\\.path", [](const git_config_entry* entry, void* data) { return entry->value == *static_cast<CStringA*>(data) ? GIT_EUSER : 0; }, &submodulePath) == GIT_EUSER)
return true;
return false;
}
......@@ -929,7 +929,7 @@ bool CTGitPath::IsValidOnWindows() const
// the 'file://' URL is just a normal windows path:
if (CStringUtils::StartsWithI(sMatch, L"file:\\\\"))
{
sMatch = sMatch.Mid((int)wcslen(L"file:\\\\"));
sMatch = sMatch.Mid(static_cast<int>(wcslen(L"file:\\\\")));
sMatch.TrimLeft(L'\\');
sPattern = L"^(\\\\\\\\\\?\\\\)?(([a-zA-Z]:|\\\\)\\\\)?(((\\.)|(\\.\\.)|([^\\\\/:\\*\\?\"\\|<> ](([^\\\\/:\\*\\?\"\\|<>\\. ])|([^\\\\/:\\*\\?\"\\|<>]*[^\\\\/:\\*\\?\"\\|<>\\. ]))?))\\\\)*[^\\\\/:\\*\\?\"\\|<> ](([^\\\\/:\\*\\?\"\\|<>\\. ])|([^\\\\/:\\*\\?\"\\|<>]*[^\\\\/:\\*\\?\"\\|<>\\. ]))?$";
}
......@@ -941,7 +941,7 @@ bool CTGitPath::IsValidOnWindows() const
std::wregex rx(sPattern, std::regex_constants::icase | std::regex_constants::ECMAScript);
std::wsmatch match;
std::wstring rmatch = std::wstring((LPCTSTR)sMatch);
std::wstring rmatch = std::wstring(static_cast<LPCTSTR>(sMatch));
if (std::regex_match(rmatch, match, rx))
{
if (std::wstring(match[0]).compare(sMatch)==0)
......@@ -1057,7 +1057,7 @@ int CTGitPathList::FillUnRev(unsigned int action, const CTGitPathList* list, CSt
{
ATLASSERT(!(*list)[i].GetWinPathString().IsEmpty());
cmd.Format(L"git.exe ls-files --exclude-standard --full-name --others -z%s -- \"%s\"",
(LPCTSTR)ignored,
static_cast<LPCTSTR>(ignored),
(*list)[i].GetWinPath());
}
......@@ -1066,7 +1066,7 @@ int CTGitPathList::FillUnRev(unsigned int action, const CTGitPathList* list, CSt
if (g_Git.Run(cmd, &out, &errb))
{
if (err != nullptr)
CGit::StringAppend(err, errb.data(), CP_UTF8, (int)errb.size());
CGit::StringAppend(err, errb.data(), CP_UTF8, static_cast<int>(errb.size()));
return -1;
}
......