Changeset 104773 in vbox
- Timestamp:
- May 24, 2024 12:56:32 PM (6 months ago)
- Location:
- trunk
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/VBox/GuestHost/clipboard-helper.h
r101878 r104773 62 62 63 63 /** 64 * Returns the length (in UTF-8 characters) of an UTF-16 string with LF EOL. 64 * Returns calculated length (in UTF-8 characters) of normalized UTF-16 string with CRLF EOL. 65 * 66 * This function should be used in order to calculate number of UTF-8 characters 67 * in normalized UTF-16. Normalized string is expected to have LF characters replaced 68 * with CRLF sequences. 65 69 * 66 70 * @returns VBox status code. … … 70 74 * Does not include terminator. 71 75 */ 72 int ShClUtf16 LFLenUtf8(PCRTUTF16 pcwszSrc, size_t cwcSrc, size_t *pchLen);76 int ShClUtf16CalcNormalizedEolToCRLFLength(PCRTUTF16 pcwszSrc, size_t cwcSrc, size_t *pchLen); 73 77 74 78 /** -
trunk/src/VBox/Additions/darwin/VBoxClient/VBoxClientClipboardGuestToHost.cpp
r100108 r104773 234 234 235 235 size_t cwcTmp; /* (includes a schwarzenegger character) */ 236 int rc = ShClUtf16 LFLenUtf8(pwszData, cbData / sizeof(RTUTF16), &cwcTmp);236 int rc = ShClUtf16CalcNormalizedEolToCRLFLength(pwszData, cbData / sizeof(RTUTF16), &cwcTmp); 237 237 AssertRCReturn(rc, rc); 238 238 -
trunk/src/VBox/GuestHost/SharedClipboard/clipboard-common.cpp
r104762 r104773 668 668 size_t cchDst; 669 669 670 int rc = ShClUtf16 LFLenUtf8(pcwszSrc, cwcSrc, &cchDst);670 int rc = ShClUtf16CalcNormalizedEolToCRLFLength(pcwszSrc, cwcSrc, &cchDst); 671 671 if (RT_SUCCESS(rc)) 672 672 { … … 838 838 } 839 839 840 int ShClUtf16 LFLenUtf8(PCRTUTF16 pcwszSrc, size_t cwSrc, size_t *pchLen)840 int ShClUtf16CalcNormalizedEolToCRLFLength(PCRTUTF16 pcwszSrc, size_t cwSrc, size_t *pchLen) 841 841 { 842 842 AssertPtrReturn(pcwszSrc, VERR_INVALID_POINTER); … … 856 856 { 857 857 /* Check for a single line feed */ 858 if (pcwszSrc[i] == VBOX_SHCL_LINEFEED) 858 if ( pcwszSrc[i] == VBOX_SHCL_LINEFEED 859 && (i == 0 || pcwszSrc[i - 1] != VBOX_SHCL_CARRIAGERETURN)) 860 { 859 861 ++cLen; 862 } 860 863 #ifdef RT_OS_DARWIN 861 864 /* Check for a single carriage return (MacOS) */ 862 if (pcwszSrc[i] == VBOX_SHCL_CARRIAGERETURN) 865 if ( pcwszSrc[i] == VBOX_SHCL_CARRIAGERETURN 866 && (i + 1 >= cwcSrc || pcwszSrc[i + 1] != VBOX_SHCL_LINEFEED)) 867 { 863 868 ++cLen; 869 } 864 870 #endif 865 871 if (pcwszSrc[i] == 0) -
trunk/src/VBox/HostServices/SharedClipboard/darwin-pasteboard.cpp
r103148 r104773 313 313 Assert(cwcSrc == RTUtf16Len(pwszSrc)); 314 314 size_t cwcDst = 0; 315 rc = ShClUtf16 LFLenUtf8(pwszSrc, cwcSrc, &cwcDst);315 rc = ShClUtf16CalcNormalizedEolToCRLFLength(pwszSrc, cwcSrc, &cwcDst); 316 316 if (RT_SUCCESS(rc)) 317 317 {
Note:
See TracChangeset
for help on using the changeset viewer.