Commit Graph

21 Commits

Author SHA1 Message Date
Norbert Federa
a45ac8dad8 winpr/path: fix PathCchFindExtensionA and more
- PathCchFindExtensionA had an off-by-one error when verifying the
  required null termination
- TestPathCchFindExtension used unicode strings when testing the
  *A (ASCII) functions
- The PathAllocCombineW implementation (which is still buggy has
  hell) used strlen to calculate the lenght of unicode strings

TestPath now succeeds on WIN32
2016-05-26 18:36:02 +02:00
Armin Novak
b5288daea5 Fixed return values. 2015-11-03 17:32:42 +01:00
Norbert Federa
6823cb4a86 winpr/path: PathCchConvertStyle used S_FALSE
Use E_FAIL instead of S_FALSE which was used to indicate errors
although it is a HRESULT success code.
2015-06-08 14:33:19 +02:00
Norbert Federa
d383f95335 winpr/path: unimpl. functions should not succeed
Unimplemented PathCch* functions now return E_NOTIMPL instead of the
HRESULT S_OK and print an error message.
2015-06-08 14:33:19 +02:00
Norbert Federa
c4cd60110a winpr: fix PathCchFindExtension
Fix multiple inplementation errors including the incorrect usage of S_FALSE.
Make this function behave like the Windows 8 implementation and
the according MSDN specification.

- return S_OK if the extension was NOT found
- if no extension was found, ppszExt must point to the string's terminating null
- return E_INVALIDARG if pszPath is not null-terminated within the cchPath range
- return E_INVALIDARG if pszPath is NULL
- return E_INVALIDARG if ppszExt is NULL
- return E_INVALIDARG if cchPath is Zero
- return E_NOTIMPL instead of S_OK in PathPathCchFindExtensionW()

Also extended/fixed the TestPathCchFindExtension ctest
2015-06-08 14:33:19 +02:00
Norbert Federa
92b0076c53 winpr: fix PathCchStripPrefix
And again S_FALSE was incorrectly used to indicate an error.
Fix this and be more compatible to the Windows 8 implementation of
this function:

- return E_INVALIDARG instead of S_FALSE if pszPath is NULL
- return E_INVALIDARG instead of S_FALSE if cchPath < 4
- return E_INVALIDARG if cchPath > PATHCCH_MAX_CCH
- allow stripping of "\\?\c:" and don't require "\\?\c:\"
- verify that the character at the drive letter position is
  actually an alphabetic character
- since the passed pszPath must not necessarily be null terminated
  and we always have enough space after the memmove we can always
  ensure the null termination of the stripped result

Also extended/fixed the TestPathCchStripPrefixctest
2015-06-03 16:06:02 +02:00
Marc-André Moreau
4898868e9d libwinpr-path: extend custom portability functions 2013-11-09 23:38:22 -05:00
Marc-André Moreau
068f0de4d4 libfreerdp-utils: purge old file utils 2013-03-22 15:52:43 -04:00
Bernhard Miklautz
f91b88f714 added missing defined() in #elif
gcc >= 4.4 requires a condition in #elif.
2013-01-25 17:50:40 +01:00
Marc-André Moreau
925eb59bf1 libfreerdp-common: refactoring of addin loader 2012-11-17 22:03:04 -05:00
Marc-André Moreau
2f1711c506 libwinpr-path: make tests pass on Windows 2012-10-18 21:11:12 -04:00
Marc-André Moreau
dd23dd1aee ctest: change default output test path 2012-10-18 15:37:00 -04:00
Marc-André Moreau
74d2244e94 libwinpr-path: fix Windows build 2012-10-17 07:48:24 -04:00
Marc-André Moreau
d815369545 libwinpr-path: extend API with portability functions 2012-10-16 17:18:12 -04:00
Marc-André Moreau
8e424f7e4c channels: simplify API 2012-10-16 12:41:16 -04:00
Marc-André Moreau
fbd2f360e9 winpr: fix compilation on Linux 2012-10-05 14:45:54 -04:00
Marc-André Moreau
1622a2f271 libwinpr-path: make tests pass on Windows 2012-10-05 11:40:33 -04:00
Marc-André Moreau
708499f0d2 libwinpr-path: implement more of the API 2012-10-05 00:14:44 -04:00
Marc-André Moreau
56ea938fbf libwinpr: wrote more tests 2012-10-04 23:19:05 -04:00
Marc-André Moreau
423585a6a1 libwinpr-path: fix build on Linux 2012-10-01 18:34:46 -04:00
Marc-André Moreau
90ffa6ea86 libwinpr: stubbed Path API 2012-09-22 22:02:55 -04:00