summaryrefslogtreecommitdiff
path: root/src/binder
diff options
context:
space:
mode:
authorLakshmi Priya Sekar <lasekar@microsoft.com>2015-09-17 13:00:36 -0700
committerLakshmi Priya Sekar <lasekar@microsoft.com>2015-09-21 14:34:51 -0700
commitb8282e0b7359e1abbcfdf4574621118b4f61d377 (patch)
treeeb56fb869cbe63685dc99e3ca3d8f9821a217788 /src/binder
parent8811dcdddbbde43e8286bfe29765fe4bd3ae328d (diff)
downloadcoreclr-b8282e0b7359e1abbcfdf4574621118b4f61d377.tar.gz
coreclr-b8282e0b7359e1abbcfdf4574621118b4f61d377.tar.bz2
coreclr-b8282e0b7359e1abbcfdf4574621118b4f61d377.zip
Use SString type for path allocations in binder.
Diffstat (limited to 'src/binder')
-rw-r--r--src/binder/cdebuglog.cpp10
-rw-r--r--src/binder/inc/bindertypes.hpp2
-rw-r--r--src/binder/utils.cpp14
3 files changed, 18 insertions, 8 deletions
diff --git a/src/binder/cdebuglog.cpp b/src/binder/cdebuglog.cpp
index 717fbd2ef9..114a42ba33 100644
--- a/src/binder/cdebuglog.cpp
+++ b/src/binder/cdebuglog.cpp
@@ -56,7 +56,7 @@ namespace BINDER_SPACE
{
HRESULT hr=S_OK;
LPTSTR pszFileName;
- TCHAR szPath[MAX_LONGPATH];
+ PathString szPathString;
DWORD dw = 0;
// _ASSERTE (pszPath ) ;
@@ -65,8 +65,12 @@ namespace BINDER_SPACE
IF_FAIL_GO(HRESULT_FROM_WIN32(ERROR_BUFFER_OVERFLOW));
}
- IF_FAIL_GO(StringCbCopy(szPath, sizeof(szPath), pszName));
-
+ size_t pszNameLen = wcslen(pszName);
+ WCHAR * szPath = szPathString.OpenUnicodeBuffer(static_cast<COUNT_T>(pszNameLen));
+ size_t cbSzPath = (sizeof(WCHAR)) * (pszNameLen + 1); // SString allocates extra byte for null
+ IF_FAIL_GO(StringCbCopy(szPath, cbSzPath, pszName));
+ szPathString.CloseBuffer(static_cast<COUNT_T>(pszNameLen));
+
pszFileName = PathFindFileName(szPath);
if (pszFileName <= szPath)
diff --git a/src/binder/inc/bindertypes.hpp b/src/binder/inc/bindertypes.hpp
index 3c4bed4514..62c6fa61e0 100644
--- a/src/binder/inc/bindertypes.hpp
+++ b/src/binder/inc/bindertypes.hpp
@@ -32,7 +32,7 @@ class PEAssembly;
namespace BINDER_SPACE
{
- typedef InlineSString<MAX_LONGPATH + 1> PathString;
+ typedef InlineSString<512> PathString;
class AssemblyVersion;
class AssemblyName;
diff --git a/src/binder/utils.cpp b/src/binder/utils.cpp
index 5befa8d629..a8e5cbc3e9 100644
--- a/src/binder/utils.cpp
+++ b/src/binder/utils.cpp
@@ -267,14 +267,17 @@ namespace BINDER_SPACE
if (!path.IsEmpty())
{
- WCHAR wszCanonicalPath[MAX_LONGPATH];
+ PathString wszCanonicalPathString;
+ WCHAR * pwszCanonicalPath = wszCanonicalPathString.OpenUnicodeBuffer(MAX_LONGPATH);
PlatformPath(path);
// This is also defined in rotor pal
- if (PathCanonicalizeW(wszCanonicalPath, path))
+ if (PathCanonicalizeW(pwszCanonicalPath, path))
{
- path.Set(wszCanonicalPath);
+ path.Set(pwszCanonicalPath);
}
+
+ wszCanonicalPathString.CloseBuffer();
if (fAppendPathSeparator)
{
@@ -300,7 +303,9 @@ namespace BINDER_SPACE
BINDER_LOG_STRING(W("path A"), pathA);
BINDER_LOG_STRING(W("path B"), pathB);
- WCHAR tempResultPath[MAX_LONGPATH];
+ PathString tempResultPathString;
+ WCHAR * tempResultPath = tempResultPathString.OpenUnicodeBuffer(MAX_LONGPATH);
+
if (PathCombineW(tempResultPath, pathA, pathB))
{
combinedPath.Set(tempResultPath);
@@ -311,6 +316,7 @@ namespace BINDER_SPACE
combinedPath.Clear();
}
+ tempResultPathString.CloseBuffer();
BINDER_LOG_LEAVE(W("Utils::CombinePath"));
}