VirtualBox

Changeset 39377 in vbox for trunk/src/VBox/Runtime/r3


Ignore:
Timestamp:
Nov 21, 2011 11:25:39 AM (13 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
74975
Message:

iprt/stream.h: Added RTStrSetMode. (untested)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Runtime/r3/stream.cpp

    r39327 r39377  
    9696    0,
    9797    stdin,
    98     true,
     98    /*.fCurrentCodeSet = */ true,
    9999    /*.fBinary = */ false,
    100100    /*.fRecheckMode = */ true
     
    110110    0,
    111111    stderr,
    112     true,
     112    /*.fCurrentCodeSet = */ true,
    113113    /*.fBinary = */ false,
    114114    /*.fRecheckMode = */ true
     
    124124    0,
    125125    stdout,
    126     true,
     126    /*.fCurrentCodeSet = */ true,
    127127    /*.fBinary = */ false,
    128128    /*.fRecheckMode = */ true
     
    429429    clearerr(pStream->pFile);
    430430    ASMAtomicWriteS32(&pStream->i32Error, VINF_SUCCESS);
     431    return VINF_SUCCESS;
     432}
     433
     434
     435RTR3DECL(int) RTStrmSetMode(PRTSTREAM pStream, int fBinary, int fCurrentCodeSet)
     436{
     437    AssertPtrReturn(pStream, VERR_INVALID_HANDLE);
     438    AssertReturn(pStream->u32Magic == RTSTREAM_MAGIC, VERR_INVALID_HANDLE);
     439    AssertReturn(fBinary == true || fBinary == false || fBinary == -1, VERR_INVALID_PARAMETER);
     440    AssertReturn(fCurrentCodeSet == true || fCurrentCodeSet == false || fCurrentCodeSet == -1, VERR_INVALID_PARAMETER);
     441
     442    rtStrmLock(pStream);
     443
     444    if (fBinary != -1)
     445        pStream->fBinary = fBinary != false;
     446    if (fCurrentCodeSet != -1)
     447        pStream->fCurrentCodeSet = fCurrentCodeSet != false;
     448
     449    rtStrmUnlock(pStream);
     450
    431451    return VINF_SUCCESS;
    432452}
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