Coverage Report

Created: 2025-07-01 06:46

/src/FreeRDP/winpr/libwinpr/path/include/PathCchAddSeparator.h
Line
Count
Source (jump to first uncovered line)
1
2
/*
3
#define DEFINE_UNICODE    FALSE
4
#define CUR_PATH_SEPARATOR_CHR  '\\'
5
#define PATH_CCH_ADD_SEPARATOR  PathCchAddBackslashA
6
*/
7
8
#if DEFINE_UNICODE
9
10
HRESULT PATH_CCH_ADD_SEPARATOR(PWSTR pszPath, size_t cchPath)
11
0
{
12
0
  size_t pszPathLength;
13
14
0
  if (!pszPath)
15
0
    return E_INVALIDARG;
16
17
0
  pszPathLength = _wcslen(pszPath);
18
19
0
  if (pszPath[pszPathLength - 1] == CUR_PATH_SEPARATOR_CHR)
20
0
    return S_FALSE;
21
22
0
  if (cchPath > (pszPathLength + 1))
23
0
  {
24
0
    pszPath[pszPathLength] = CUR_PATH_SEPARATOR_CHR;
25
0
    pszPath[pszPathLength + 1] = '\0';
26
27
0
    return S_OK;
28
0
  }
29
30
0
  return HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER);
31
0
}
Unexecuted instantiation: PathCchAddBackslashW
Unexecuted instantiation: PathCchAddSlashW
Unexecuted instantiation: PathCchAddSeparatorW
32
33
#else
34
35
HRESULT PATH_CCH_ADD_SEPARATOR(PSTR pszPath, size_t cchPath)
36
0
{
37
0
  size_t pszPathLength;
38
39
0
  if (!pszPath)
40
0
    return E_INVALIDARG;
41
42
0
  pszPathLength = strlen(pszPath);
43
44
0
  if (pszPath[pszPathLength - 1] == CUR_PATH_SEPARATOR_CHR)
45
0
    return S_FALSE;
46
47
0
  if (cchPath > (pszPathLength + 1))
48
0
  {
49
0
    pszPath[pszPathLength] = CUR_PATH_SEPARATOR_CHR;
50
0
    pszPath[pszPathLength + 1] = '\0';
51
52
0
    return S_OK;
53
0
  }
54
55
0
  return HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER);
56
0
}
Unexecuted instantiation: PathCchAddBackslashA
Unexecuted instantiation: PathCchAddSlashA
Unexecuted instantiation: PathCchAddSeparatorA
57
58
#endif
59
60
/*
61
#undef DEFINE_UNICODE
62
#undef CUR_PATH_SEPARATOR_CHR
63
#undef PATH_CCH_ADD_SEPARATOR
64
*/