VirtualBox

Ignore:
Timestamp:
Jan 1, 2013 7:25:47 PM (12 years ago)
Author:
vboxsync
Message:

tstSharedFolderService.cpp: Fixed fillTestShflString u16Length bug which for buggy reasons only cause trouble on darwin.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/HostServices/SharedFolders/testcase/tstSharedFolderService.cpp

    r40108 r44223  
    11/* $Id$ */
    22/** @file
    3  *
    43 * Testcase for the shared folder service vbsf API.
    54 *
     
    1211
    1312/*
    14  * Copyright (C) 2011 Oracle Corporation
     13 * Copyright (C) 2011-2012 Oracle Corporation
    1514 *
    1615 * This file is part of VirtualBox Open Source Edition (OSE), as
     
    4039#include "teststubs.h"
    4140
     41
    4242/******************************************************************************
    4343*   Global Variables                                                          *
     
    4545static RTTEST g_hTest = NIL_RTTEST;
    4646
     47
    4748/******************************************************************************
    4849*   Declarations                                                              *
    4950******************************************************************************/
    50 
    5151extern "C" DECLCALLBACK(DECLEXPORT(int)) VBoxHGCMSvcLoad (VBOXHGCMSVCFNTABLE *ptable);
     52
    5253
    5354/******************************************************************************
     
    103104
    104105#define ARRAY_FROM_PATH(a, b) \
    105 do { \
    106     Assert((a) == (a)); /* Constant parameter */ \
    107     Assert(sizeof((a)) > 0); \
    108     bufferFromPath(a, sizeof(a), b); \
    109 } while(0)
     106    do { \
     107        Assert((a) == (a)); /* Constant parameter */ \
     108        Assert(sizeof((a)) > 0); \
     109        bufferFromPath(a, sizeof(a), b); \
     110    } while (0)
     111
    110112
    111113/******************************************************************************
    112 *   Stub functions                                                            *
     114*   Stub functions and data                                                   *
    113115******************************************************************************/
    114116
     
    405407{ RTPrintf("%s\n", __PRETTY_FUNCTION__); return 0; }
    406408
     409
    407410/******************************************************************************
    408411*   Tests                                                                     *
     
    485488                               const char *pcszSource)
    486489{
    487     unsigned i;
    488    
    489     AssertRelease(  strlen(pcszSource) * 2 + 2 < sizeof(*pDest)
    490                   - RT_UOFFSETOF(SHFLSTRING, String));
    491     pDest->string.u16Size = (uint16_t)strlen(pcszSource) * 2 + 2;
    492     pDest->string.u16Length = (uint16_t)strlen(pcszSource);
    493     for (i = 0; i < strlen(pcszSource) + 1; ++i)
     490    AssertRelease(  strlen(pcszSource) * 2 + 2
     491                  < sizeof(*pDest) - RT_UOFFSETOF(SHFLSTRING, String));
     492    pDest->string.u16Length = (uint16_t)(strlen(pcszSource) * sizeof(RTUTF16));
     493    pDest->string.u16Size   = pDest->string.u16Length + sizeof(RTUTF16);
     494    for (unsigned i = 0; i <= pDest->string.u16Length; ++i)
    494495        pDest->string.String.ucs2[i] = (uint16_t)pcszSource[i];
    495496}
Note: See TracChangeset for help on using the changeset viewer.

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