VirtualBox

source: vbox/trunk/src/VBox/HostServices/SharedClipboard/VBoxSharedClipboardSvc-utils.cpp@ 79006

Last change on this file since 79006 was 78725, checked in by vboxsync, 6 years ago

Shared Clipboard/URI: Update.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id Revision
File size: 3.3 KB
Line 
1/* $Id: VBoxSharedClipboardSvc-utils.cpp 78725 2019-05-24 13:15:59Z vboxsync $ */
2/** @file
3 * Shared Clipboard Service - Host service utility functions.
4 */
5
6/*
7 * Copyright (C) 2019 Oracle Corporation
8 *
9 * This file is part of VirtualBox Open Source Edition (OSE), as
10 * available from http://www.virtualbox.org. This file is free software;
11 * you can redistribute it and/or modify it under the terms of the GNU
12 * General Public License (GPL) as published by the Free Software
13 * Foundation, in version 2 as it comes in the "COPYING" file of the
14 * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
15 * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
16 */
17
18
19/*********************************************************************************************************************************
20* Header Files *
21*********************************************************************************************************************************/
22#define LOG_GROUP LOG_GROUP_SHARED_CLIPBOARD
23#include <VBox/HostServices/VBoxClipboardSvc.h>
24#include <VBox/HostServices/VBoxClipboardExt.h>
25
26#include <iprt/path.h>
27
28
29/**
30 * Returns whether a given clipboard data header is valid or not.
31 *
32 * @returns \c true if valid, \c false if not.
33 * @param pDataHdr Clipboard data header to validate.
34 */
35bool VBoxSvcClipboardDataHdrIsValid(PVBOXCLIPBOARDDATAHDR pDataHdr)
36{
37 RT_NOREF(pDataHdr);
38 return true; /** @todo Implement this. */
39}
40
41/**
42 * Returns whether a given clipboard data chunk is valid or not.
43 *
44 * @returns \c true if valid, \c false if not.
45 * @param pDataChunk Clipboard data chunk to validate.
46 */
47bool VBoxSvcClipboardDataChunkIsValid(PVBOXCLIPBOARDDATACHUNK pDataChunk)
48{
49 RT_NOREF(pDataChunk);
50 return true; /** @todo Implement this. */
51}
52
53/**
54 * Returns whether given clipboard directory data is valid or not.
55 *
56 * @returns \c true if valid, \c false if not.
57 * @param pDirData Clipboard directory data to validate.
58 */
59bool VBoxSvcClipboardDirDataIsValid(PVBOXCLIPBOARDDIRDATA pDirData)
60{
61 if ( !pDirData->cbPath
62 || pDirData->cbPath > RTPATH_MAX)
63 return false;
64
65 if (!RTStrIsValidEncoding(pDirData->pszPath))
66 return false;
67
68 return true;
69}
70
71/**
72 * Returns whether a given clipboard file header is valid or not.
73 *
74 * @returns \c true if valid, \c false if not.
75 * @param pFileHdr Clipboard file header to validate.
76 * @param pDataHdr Data header to use for validation.
77 */
78bool VBoxSvcClipboardFileHdrIsValid(PVBOXCLIPBOARDFILEHDR pFileHdr, PVBOXCLIPBOARDDATAHDR pDataHdr)
79{
80 if ( !pFileHdr->cbFilePath
81 || pFileHdr->cbFilePath > RTPATH_MAX)
82 return false;
83
84 if (!RTStrIsValidEncoding(pFileHdr->pszFilePath))
85 return false;
86
87 if (pFileHdr->cbSize > pDataHdr->cbTotal)
88 return false;
89
90 return true;
91}
92
93/**
94 * Returns whether given clipboard file data is valid or not.
95 *
96 * @returns \c true if valid, \c false if not.
97 * @param pFileData Clipboard file data to validate.
98 * @param pDataHdr Data header to use for validation.
99 */
100bool VBoxSvcClipboardFileDataIsValid(PVBOXCLIPBOARDFILEDATA pFileData, PVBOXCLIPBOARDDATAHDR pDataHdr)
101{
102 RT_NOREF(pFileData, pDataHdr);
103 return true;
104}
105
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette