diff -r 000000000000 -r c8caa15ef882 simpleengine/engine/src/simpleengineutils.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/simpleengine/engine/src/simpleengineutils.cpp Tue Feb 02 01:05:17 2010 +0200 @@ -0,0 +1,57 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Simple Engine utils +* +*/ + + + + +// INCLUDE FILES +#include +#include + +#include "simpleengineutils.h" +#include "simplecommon.h" + +// ================= MEMBER FUNCTIONS ======================= + +//********************************** +// TSimpleEngineUtils +//********************************** + +// --------------------------------------------------------- +// TSimpleEngineUtils::OpIdRange +// --------------------------------------------------------- +// +TInt TSimpleEngineUtils::OpIdRange() + { + // Bit mask to create server OOM error response + const TUint KMaxId = 0x40000000; + const TInt KMagic2 = 50; + TInt limitLowerValue = REINTERPRET_CAST(TInt, Dll::Tls() ); + TInt limitUpperValue = limitLowerValue + KRangeSize; + // Check that counter does not go around + if ( limitUpperValue & KMaxId ) + { + // start from 50, if this ever happens + limitLowerValue = KMagic2; + limitUpperValue = limitLowerValue + KRangeSize; + } + Dll::SetTls( REINTERPRET_CAST(TAny*, limitUpperValue ) ); + return limitLowerValue; + } + +// End of File +