sl@0
|
1 |
// Copyright (c) 1999-2009 Nokia Corporation and/or its subsidiary(-ies).
|
sl@0
|
2 |
// All rights reserved.
|
sl@0
|
3 |
// This component and the accompanying materials are made available
|
sl@0
|
4 |
// under the terms of "Eclipse Public License v1.0"
|
sl@0
|
5 |
// which accompanies this distribution, and is available
|
sl@0
|
6 |
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
sl@0
|
7 |
//
|
sl@0
|
8 |
// Initial Contributors:
|
sl@0
|
9 |
// Nokia Corporation - initial contribution.
|
sl@0
|
10 |
//
|
sl@0
|
11 |
// Contributors:
|
sl@0
|
12 |
//
|
sl@0
|
13 |
// Description:
|
sl@0
|
14 |
//
|
sl@0
|
15 |
|
sl@0
|
16 |
#include <e32std.h>
|
sl@0
|
17 |
#include <redirstr.h>
|
sl@0
|
18 |
#include <redircli.h>
|
sl@0
|
19 |
//
|
sl@0
|
20 |
// -------------- Stream implementation ------------------------
|
sl@0
|
21 |
//
|
sl@0
|
22 |
EXPORT_C void CStreamBase2::CompleteRead(const RMessage2 &aMessage)
|
sl@0
|
23 |
{
|
sl@0
|
24 |
// retrieve the max length of the buffer the client has allocated
|
sl@0
|
25 |
TInt length = aMessage.Int1();
|
sl@0
|
26 |
// create a local buffer for placing characters to be written to
|
sl@0
|
27 |
// client. This is a copy of the the iBuf internal buffer of the stream
|
sl@0
|
28 |
TBuf8<256> buf(iBuf);
|
sl@0
|
29 |
|
sl@0
|
30 |
if (length < buf.Length() )
|
sl@0
|
31 |
{
|
sl@0
|
32 |
// then we can't copy all the buffer to the client so we have reduce
|
sl@0
|
33 |
// the buffers length
|
sl@0
|
34 |
buf.SetLength(length);
|
sl@0
|
35 |
// delete appropriate part of stream's internal buffer
|
sl@0
|
36 |
iBuf.Delete(0,length);
|
sl@0
|
37 |
}
|
sl@0
|
38 |
else
|
sl@0
|
39 |
{
|
sl@0
|
40 |
// we can copy all of the buffer to the client so we set the streams
|
sl@0
|
41 |
// descriptor to zero length
|
sl@0
|
42 |
iBuf.Zero();
|
sl@0
|
43 |
}
|
sl@0
|
44 |
// copy the local descriptor to the client.
|
sl@0
|
45 |
TRAPD(ret,aMessage.WriteL(0, buf));
|
sl@0
|
46 |
// inform the client of success/failure by completing the message
|
sl@0
|
47 |
aMessage.Complete(ret);
|
sl@0
|
48 |
return;
|
sl@0
|
49 |
}
|
sl@0
|
50 |
|
sl@0
|
51 |
EXPORT_C void CStreamFactoryBase2::AppendToStatus(const TDesC& aMsg) { iStatusMsg.Append(aMsg); }
|
sl@0
|
52 |
|
sl@0
|
53 |
EXPORT_C const TDesC& CStreamFactoryBase2::GetStatus() const { return iStatusMsg; }
|
sl@0
|
54 |
|
sl@0
|
55 |
// Dummy functions to replace previous exports so def file does not need reordering.
|
sl@0
|
56 |
EXPORT_C void DummyReserved1() {};
|
sl@0
|
57 |
EXPORT_C void DummyReserved2() {};
|
sl@0
|
58 |
EXPORT_C void DummyReserved3() {};
|
sl@0
|
59 |
EXPORT_C void DummyReserved4() {};
|
sl@0
|
60 |
EXPORT_C void DummyReserved5() {};
|
sl@0
|
61 |
EXPORT_C void DummyReserved6() {};
|
sl@0
|
62 |
EXPORT_C void DummyReserved7() {};
|
sl@0
|
63 |
EXPORT_C void DummyReserved8() {};
|
sl@0
|
64 |
EXPORT_C void DummyReserved9() {};
|
sl@0
|
65 |
EXPORT_C void DummyReserved10() {};
|
sl@0
|
66 |
EXPORT_C void DummyReserved11() {};
|