~ubuntu-branches/ubuntu/vivid/freerdp/vivid

« back to all changes in this revision

Viewing changes to winpr/libwinpr/path/include/PathCchAddSeparatorEx.c

  • Committer: Package Import Robot
  • Author(s): Iain Lane
  • Date: 2014-11-11 12:20:50 UTC
  • mfrom: (1.1.9) (9.1.17 sid)
  • Revision ID: package-import@ubuntu.com-20141111122050-wyr8hrnwco9fcmum
Tags: 1.1.0~git20140921.1.440916e+dfsg1-2ubuntu1
* Merge with Debian unstable, remaining changes
  - Disable ffmpeg support
* Disable gstreamer support, this relies on gstreamer 0.10 and we don't want
  to add any more deps on that.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
 
 
2
/*
 
3
#define DEFINE_UNICODE                  FALSE
 
4
#define _PATH_SEPARATOR_CHR             '\\'
 
5
#define PATH_CCH_ADD_SEPARATOR_EX       PathCchAddBackslashExA
 
6
*/
 
7
 
 
8
#if DEFINE_UNICODE
 
9
 
 
10
HRESULT PATH_CCH_ADD_SEPARATOR_EX(PWSTR pszPath, size_t cchPath, PWSTR* ppszEnd, size_t* pcchRemaining)
 
11
{
 
12
        size_t pszPathLength;
 
13
 
 
14
        if (!pszPath)
 
15
                return S_FALSE;
 
16
 
 
17
        pszPathLength = lstrlenW(pszPath);
 
18
 
 
19
        if (pszPath[pszPathLength - 1] == _PATH_SEPARATOR_CHR)
 
20
                return S_FALSE;
 
21
 
 
22
        if (cchPath > (pszPathLength + 1))
 
23
        {
 
24
                pszPath[pszPathLength] = _PATH_SEPARATOR_CHR;
 
25
                pszPath[pszPathLength + 1] = '\0';
 
26
 
 
27
                return S_OK;
 
28
        }
 
29
 
 
30
        return S_FALSE;
 
31
}
 
32
 
 
33
#else
 
34
 
 
35
HRESULT PATH_CCH_ADD_SEPARATOR_EX(PSTR pszPath, size_t cchPath, PSTR* ppszEnd, size_t* pcchRemaining)
 
36
{
 
37
        size_t pszPathLength;
 
38
 
 
39
        if (!pszPath)
 
40
                return S_FALSE;
 
41
 
 
42
        pszPathLength = lstrlenA(pszPath);
 
43
 
 
44
        if (pszPath[pszPathLength - 1] == _PATH_SEPARATOR_CHR)
 
45
                return S_FALSE;
 
46
 
 
47
        if (cchPath > (pszPathLength + 1))
 
48
        {
 
49
                pszPath[pszPathLength] = _PATH_SEPARATOR_CHR;
 
50
                pszPath[pszPathLength + 1] = '\0';
 
51
 
 
52
                return S_OK;
 
53
        }
 
54
 
 
55
        return S_FALSE;
 
56
}
 
57
 
 
58
#endif
 
59
 
 
60
/*
 
61
#undef DEFINE_UNICODE
 
62
#undef _PATH_SEPARATOR_CHR
 
63
#undef PATH_CCH_ADD_SEPARATOR_EX
 
64
*/
 
65