Esempio n. 1
0
CTelServer* CTelServer::New()
	{
	CTelServer* pS=new CTelServer(EPriority);

	__ASSERT_ALWAYS(pS!=NULL,Fault(EEtelFaultSvrCreateServer));
	TRAPD(r,pS->ConstructL());
	__ASSERT_ALWAYS(r==KErrNone,Fault(EEtelFaultSvrStartServer));
	return pS;
	}
Esempio n. 2
0
/**
Destructor.
 
Deallocates memory associated with this objects name, if a name 
has been set.
 
@panic FSERV 104 if the reference count is not zero when
       the destructor is called.
*/
EXPORT_C  CFsObject::~CFsObject()
	{
	__PRINT1(_L("CFsObject::~CFsObject() 0x%x"),this);
	__ASSERT_ALWAYS(Dec()==0,Fault(EObjDestructorAccessCount));	
	__ASSERT_ALWAYS(!iContainer,Fault(EObjDestructorContainer));
	if(iName)
		User::Free(iName);
#if defined(_DEBUG) || defined(_DEBUG_RELEASE)
	__e32_atomic_add_ord32(&ObjectCount, (TUint32) -1);
#endif
	}
Esempio n. 3
0
CFsObject *CFsObjectCon::At(TInt aFindHandle) const
//
// Return the object at aFindHandle.
// Should only be used there is no other access to the CFsObject
//
	{

	__ASSERT_ALWAYS(uniqueID(aFindHandle)==iUniqueID,Fault(EObjFindBadHandle));
	TInt ix=index(aFindHandle);
	__ASSERT_ALWAYS(ix<iCount,Fault(EObjFindIndexOutOfRange));
	return iObjects[ix];
	}
Esempio n. 4
0
void CGavdp::ServiceComplete(TInt aResult)
	{
	__ASSERT_DEBUG(iRequesterHelper, Fault(EGavdpHelperCompletingBadly));
	iRequesterHelper = NULL;
	
	if (aResult==KErrNone)
		{
		switch (iState)
			{
			case EConfiguringRemoteSEP:
			case EListening:
			case EConnecting:
				iState = EConnected;
				break;
			case EConfiguringLocalSEP:
				{
				iState = EIdle;
				break;
				}
				
			}
		}
	else
		{
		iState = EIdle; // or perhaps errored? 
		}
	}
Esempio n. 5
0
VOID ShowError(Object *application, Object *window, CONST_STRPTR message, BOOL useIOError)
{
    TEXT   buffer[128];
    STRPTR newline = "\n",
           period  = ".",
           extra   = buffer;
           
    /* Never use IO error if it is 0 */
    if (IoErr() == 0) useIOError = FALSE;
    
    if (useIOError)
    {
        Fault(IoErr(), NULL, buffer, sizeof(buffer));
        buffer[0] = toupper(buffer[0]);
    }
    else
    {
        newline = "";
        period  = "";
        extra   = "";
    }
            
    MUI_Request
    (
        application, window, 0, _(MSG_TITLE), _(MSG_ERROR_OK), 
        "%s:\n%s%s%s%s", _(MSG_ERROR_HEADER), message, newline, extra, period
    );
}
Esempio n. 6
0
TInt CFsObjectCon::FindByName(TInt &aFindHandle,const TDesC &aMatch) const
//
// Find an object starting at aFindHandle which matches aMatch
// just using the objects name.
//
	{

	if (!iCount)
		return KErrNotFound;
	TInt ix=0;
	if (aFindHandle!=0)
		{
		__ASSERT_ALWAYS(uniqueID(aFindHandle)==iUniqueID,Fault(EObjFindBadHandle));
		ix=index(aFindHandle)+1;
		};
	CFsObject** pS=iObjects;
	CFsObject** pE=pS+iCount;
	pS+=ix;
	while(pS<pE)
		{
		TName name=*((*pS++)->iName);
		if (name.MatchF(aMatch)!=KErrNotFound)
			{
			aFindHandle=makeFindHandle(ix,iUniqueID);
			return KErrNone;
			}
		ix++;
		}
	aFindHandle=makeFindHandle(KObjectMaxIndex,iUniqueID);
	return KErrNotFound;
	}
Esempio n. 7
0
void CShdrEchoInstance::Open() 
{
	// FIXME: blank lines and other stuff not handled well.

	if(GetFileAttributesA(_shdrfilename.c_str())== INVALID_FILE_ATTRIBUTES)
	{
		_shdrfilename= ::ExeDirectory() + _shdrfilename;
	}

	in.open(_shdrfilename.c_str());
	if(GetNextTokens())
	{
		lasttime = GetDateTime(tokens[0]);
		//SetTimer ( 1, 1000 );
		OutputTokens();

		localvalues=_backend->_values;
		std::string info=_backend->ShdrString(_backend->_values);;
		if(!info.empty())
			EchoShdr(info.c_str());
	}
	else
	{
		Fault();
		std::cout << StdStringFormat("Problem reading file%s\n", ShdrFilename().c_str());
	}
}
Esempio n. 8
0
void CTelScheduler::Error(TInt) const
//
// Called if any Run() method leaves.
//
	{
	Fault(EEtelFaultMainSchedulerError);
	}
Esempio n. 9
0
TInt CFatFileCB::SeekToPosition(TInt aNewRelCluster,TInt aClusterOffset)
//
// Use the seek index to set iCurrentPos.iCluster as close as possible to aNewRelCluster
// Return aNewRelCluster-aCurrentPos.iCluster
//
{
    TInt clusterOffset=aClusterOffset;
    TInt seekPos=(aNewRelCluster>>iSeekIndexSize)-1;
    __ASSERT_DEBUG(seekPos<KSeekIndexSize,Fault(EFatFileSeekIndexTooSmall));

    while(seekPos>=0 && iSeekIndex[seekPos]==0 && clusterOffset!=0)
    {
        seekPos--;
        clusterOffset--;
    }
    if (clusterOffset==0) // Counted back to the current cluster
        return(aClusterOffset);
    if (seekPos<0)
    {
        iCurrentPos.iCluster=iStartCluster;
        return(aNewRelCluster);
    }

    iCurrentPos.iCluster=iSeekIndex[seekPos];
    return(aNewRelCluster-((seekPos+1)<<iSeekIndexSize));
}
Esempio n. 10
0
CFsObject *CFsObjectCon::operator[](TInt anIndex)
//
// Return the object at anIndex.
//
	{
	__ASSERT_ALWAYS(anIndex>=0 && anIndex<iCount, Fault(EArrayIndexOutOfRange));
	return iObjects[anIndex];
	}
Esempio n. 11
0
static void getarguments(void)
{
    if (!(myargs = ReadArgs(ARG_TEMPLATE, args, 0)))
    {
    	Fault(IoErr(), 0, s, 255);
	cleanup(s, RETURN_FAIL);
    }
}
Esempio n. 12
0
static void GetArguments(void)
{
    if (!(MyArgs = ReadArgs(ARG_TEMPLATE,Args,0)))
    {
    	Fault(IoErr(),0,s,255);
	Cleanup(s);
    }
}
Esempio n. 13
0
void CFsObjectIx::Remove(TInt aHandle,TBool aLock)
//
// Remove an object from the index.
//
	{
	if(aLock)
		Lock();
	TInt i=index(aHandle);
	__ASSERT_ALWAYS(i<iHighWaterMark,Fault(EObjRemoveBadHandle));
	SFsObjectIxRec* pR=iObjects+i;
	CFsObject *pO=pR->obj;
	if (!pO || pR->instance!=instance(aHandle) || pR->uniqueID!=pO->UniqueID())
		Fault(EObjRemoveBadHandle);
	pR->obj=NULL;
	--iNumEntries;
	if (i==iHighWaterMark-1)
		{
		do
			{
			i--;
			pR--;
			} while(i>=0 && !pR->obj);
		TInt newAlloc=(i+KObjectIxGranularity)&~(KObjectIxGranularity-1);
		if (newAlloc!=iAllocated)
			{
			if (newAlloc)
			    {
				iObjects=(SFsObjectIxRec*)User::ReAlloc(iObjects,newAlloc*sizeof(SFsObjectIxRec));
				if(!iObjects)
				    {
                    Fault(EContainerHeapCorruptionOnRemove);
				    }
			    }
			else
				{
				delete iObjects;
				iObjects=NULL;
				}
			iAllocated=newAlloc;
			}
		iHighWaterMark=i+1;
		}
	if(aLock)
		Unlock();
	pO->Close();
	}
Esempio n. 14
0
EXPORT_C TInt CFsObject::Open()
	{
	TInt count=Inc();
	(void)count;
	__THRD_PRINT2(_L("CFsObject::Open() object=0x%x count=%d"),this,count);
	__ASSERT_DEBUG(count>=1,Fault(EFsObjectOpen));
	return KErrNone;
	}
Esempio n. 15
0
/**
Utility function for obtaining info on file delete requests.  

@param	aRequest			Dir read request
@param	aFileName			The name of the file
*/
LOCAL_C TInt FileDelVars(CFsRequest* aRequest, TDes& aFileName)
	{
	__ASSERT_ALWAYS(aRequest->Operation()->Function()==EFsDelete,Fault(EBaseRequestMessage));

	aFileName = aRequest->Src().FullName();

	return(KErrNone);
	}
Esempio n. 16
0
/**
Utility function for obtaining info on dir remove requests.

@param	aRequest			RmDir request
@param	aPath				The path name specifiying the directory to be removed.
*/
LOCAL_C TInt DirRemoveVars(CFsRequest* aRequest, TDes& aPath)
	{
	__ASSERT_ALWAYS(aRequest->Operation()->Function()==EFsRmDir,Fault(EBaseRequestMessage));

	aPath = aRequest->Src().FullName();

	return(KErrNone);
	}
Esempio n. 17
0
LONG
LoadConfig( STRPTR fname )
{
    BPTR    file;

    if( !( file = Open( fname, MODE_OLDFILE ) ) )
    {
        Fault( IoErr(), "", FaultBuff, sizeof( FaultBuff ) );
        LocEZReq( MSG_ERROR_ACCESSING_FILE, MSG_OK, fname, FaultBuff + 2 );
        return( TRUE );
    }

    if( Read( file, LOADSAVETO, PREFSLEN ) != PREFSLEN )
    {
        LocEZReq( MSG_READ_ERROR, MSG_ABORT );
        Close( file );
        return( FALSE );
    }
#ifdef __AROS__
#define READ_ULONG *((ULONG *)configptr); configptr += sizeof(ULONG)
#define READ_UWORD *((UWORD *)configptr); configptr += sizeof(UWORD)

    {
        UBYTE *configptr = configbuffer;
	ULONG val;
	WORD  i;
	
	val = READ_ULONG;
	RTPrefs.Flags = AROS_LONG2BE(val);
	
	for(i = 0;i < RTPREF_NR_OF_REQ; i++)
	{
	    val = READ_ULONG;
	    RTPrefs.ReqDefaults[i].Size = AROS_LONG2BE(val);
	    
	    val = READ_ULONG;
	    RTPrefs.ReqDefaults[i].ReqPos = AROS_LONG2BE(val);
	    
	    val = READ_UWORD;
	    RTPrefs.ReqDefaults[i].LeftOffset = AROS_WORD2BE(val);

	    val = READ_UWORD;
	    RTPrefs.ReqDefaults[i].TopOffset = AROS_WORD2BE(val);

	    val = READ_UWORD;
	    RTPrefs.ReqDefaults[i].MinEntries = AROS_WORD2BE(val);

	    val = READ_UWORD;
	    RTPrefs.ReqDefaults[i].MaxEntries = AROS_WORD2BE(val);	    
	}
	
    }
#endif

    Close( file );
    WheelType = GetWheelType( RTPrefs.Flags );
    return( TRUE );
}
Esempio n. 18
0
LONG
SaveConfig( STRPTR fname )
{
    BPTR    file;

    if( !( file = Open( fname, MODE_NEWFILE ) ) )
    {
        Fault( IoErr(), "", FaultBuff, sizeof( FaultBuff ) );
        LocEZReq( MSG_ERROR_ACCESSING_FILE, MSG_OK, fname, FaultBuff + 2 );
        return( FALSE );
    }

#ifdef __AROS__
#define WRITE_ULONG *((ULONG *)configptr) = AROS_LONG2BE(val); configptr += sizeof(ULONG)
#define WRITE_UWORD *((UWORD *)configptr) = AROS_WORD2BE(val); configptr += sizeof(UWORD)

    {
        UBYTE *configptr = configbuffer;
	ULONG val;
	WORD  i;
	
	val = RTPrefs.Flags;
	WRITE_ULONG;
	
	for(i = 0;i < RTPREF_NR_OF_REQ; i++)
	{
	    val = RTPrefs.ReqDefaults[i].Size;
	    WRITE_ULONG;
	    
	    val = RTPrefs.ReqDefaults[i].ReqPos;
	    WRITE_ULONG;
	    
	    val = RTPrefs.ReqDefaults[i].LeftOffset;
	    WRITE_UWORD;
	    
	    val = RTPrefs.ReqDefaults[i].TopOffset;
	    WRITE_UWORD;
	    
	    val = RTPrefs.ReqDefaults[i].MinEntries;
	    WRITE_UWORD;
	    
	    val = RTPrefs.ReqDefaults[i].MaxEntries;
	    WRITE_UWORD;

	}
	
    }
#endif
    if( Write( file, LOADSAVETO, PREFSLEN ) != PREFSLEN )
    {
        LocEZReq( MSG_ERROR_SAVING_PREFS, MSG_OK );
        Close( file );
        return( FALSE );
    }

    Close( file );
    return( TRUE );
}
Esempio n. 19
0
void CClkIdleObserver::StartIdleRefresh(void)
{
  if(!iIdle) Fault(0);
  if(!iIdle->IsActive())
  {
    TCallBack callback(IdleCallBackL,this);
    iIdle->Start(callback);
  }
}
Esempio n. 20
0
static void openfile(void)
{
    fh = Open((STRPTR)args[ARG_FILE], MODE_OLDFILE);
    if (!fh)
    {
    	Fault(IoErr(), 0, s, 255);
	cleanup(s, RETURN_FAIL);
    }
}
Esempio n. 21
0
CFsObject* CFsObjectIx::operator[](TInt anIndex)
//
// Return the object at anIndex
//
	{

	__ASSERT_ALWAYS(anIndex>=0 && anIndex<iHighWaterMark,Fault(EArrayIndexOutOfRange));
	return iObjects[anIndex].obj;
	}
Esempio n. 22
0
/**
Utility function for obtaining info on dir Make requests. 

@param	aRequest			MkDir/MkDirAll request
@param	aMkDirAll			if MkDirAll it will be 1
@param	aPath				The path name specifiying the directory or directories to create.
*/
LOCAL_C TInt DirMakeVars(CFsRequest* aRequest, TInt& aMkDirAll, TDes& aPath)
	{
	__ASSERT_ALWAYS(aRequest->Operation()->Function()==EFsMkDir,Fault(EBaseRequestMessage));
	
	aMkDirAll = aRequest->Message().Int1();
	aPath = aRequest->Src().FullName();

	return(KErrNone);
	}
Esempio n. 23
0
CFsObjectCon::~CFsObjectCon()
//
// Destructor
//
	{
	__ASSERT_ALWAYS(iCount==0,Fault(EObjectConDestructor));
	iLock.Close();
	delete iObjects;
	}
Esempio n. 24
0
/**
Utility function for obtaining info on file entry requests.

@param	aRequest	File entry request
@param	aName		Entry name
*/
LOCAL_C TInt FileEntryVars(CFsRequest* aRequest, TDes& aName)
	{
	__ASSERT_ALWAYS(aRequest->Operation()->Function()==EFsEntry ||
                    aRequest->Operation()->Function()==EFsSetEntry,
                    Fault(EBaseRequestMessage));

	aName = aRequest->Src().FullName();

	return(KErrNone);
	}
Esempio n. 25
0
void CModelBase::DoObserverNotify(TInt aNotification)
//
//	Single function that actually calls the view notifier
//
	{
	__ASSERT_DEBUG(iObserver,Fault(EModelfNoNotifier));
	iDoingViewNotify=ETrue;
	iObserver->HandleUpdate(aNotification);
	iDoingViewNotify=EFalse;
	}
Esempio n. 26
0
static void GetArguments(void)
{
    if (!(myargs = ReadArgs(ARG_TEMPLATE, args, NULL)))
    {
	Fault(IoErr(), 0, s, 256);
	Cleanup(s);
    }
    
    if (!args[ARG_FROM]) args[ARG_FROM] = (IPTR)CONFIGNAME_ENV;
}
Esempio n. 27
0
/**
Cancels all the requests of plugin connection

@param		aCompletionCode: the code the request are completed 
*/
EXPORT_C void TPluginConnRequestQue::DoCancelAll(TInt aCompletionCode)
	{
	TDblQueIter<CFsPluginConnRequest> q(iHeader);
	CFsPluginConnRequest* info;
	while((info=q++)!=NULL)
		{
		info->Complete(aCompletionCode);
		}
	__ASSERT_DEBUG(iHeader.IsEmpty(),Fault(EBaseQueCancel));
	}
Esempio n. 28
0
void CFsObjectCon::Remove(CFsObject *anObj,TBool aLock)	
//
// Remove an object from the container.
// This assumes that close is called by the calling function
// 
	{
	if(aLock)
		Lock();
	CFsObject** pS=iObjects;
	CFsObject** pE=pS+iCount;
	while(pS<pE)
		{
		if (*pS==anObj)
			{
			Mem::Move((TAny*)pS,(TAny*)(pS+1),TInt(pE)-TInt(pS)-sizeof(CFsObject*));
			TInt newAlloc=--iCount;
			newAlloc=(newAlloc+(KObjectConGranularity-1))&~(KObjectConGranularity-1);
			if (newAlloc!=iAllocated)
				{
				if (newAlloc)
				    {
					iObjects=(CFsObject**)User::ReAlloc(iObjects,newAlloc*sizeof(CFsObject*));
					if(!iObjects)
					    {
					    Fault(EContainerHeapCorruptionOnRemove);
					    }
				    }
				else
					{
					delete iObjects;
					iObjects=NULL;
					}
				iAllocated=newAlloc;
				}
			if(aLock)
				Unlock();
			anObj->iContainer = NULL;
			return;
			}
		pS++;
		}
	Fault(EObjRemoveObjectNotFound);
	}
Esempio n. 29
0
void displayMsg(LONG code)
{
    if (code)
    {
	Fault(code, "IconX", errbuffer, sizeof(errbuffer));
	struct EasyStruct es = {sizeof(struct EasyStruct), 0,
	    "Error", errbuffer, "OK"};
	EasyRequest(0, &es, 0);
    }
}
Esempio n. 30
0
CTelScheduler* CTelScheduler::New()
//
// Create and install the active scheduler.
//
	{
	CTelScheduler* pA=new CTelScheduler;
	__ASSERT_ALWAYS(pA!=NULL,Fault(EEtelFaultMainSchedulerError));
	CTelScheduler::Install(pA);
	return pA;
	}