コード例 #1
0
XBOX::VError VHTTPWebsocketHandler::ReadBytes(void* inData, uLONG* ioLength)
{
	XBOX::VError	l_err;

	l_err = fEndpt->Read(inData,ioLength);

	if (l_err == VE_SRVR_RESOURCE_TEMPORARILY_UNAVAILABLE)
	{
		if (*ioLength)
		{
			DebugMsg("NON-NULL LENGTH SHOULD NOT HAPPEN!!!!!\n");
		}
		l_err = VE_OK;//'cos non blocking
	}

	if (l_err)
	{
		DebugMsg("ReadBytes ERR=%d\n",l_err);
		DebugMsg("ERRCODE_FROM_VERROR=%d\n",ERRCODE_FROM_VERROR(l_err));
		DebugMsg("NATIVE_ERRCODE_FROM_VERROR=%d\n",NATIVE_ERRCODE_FROM_VERROR(l_err));
		//xbox_assert(!l_err);
	}

	return l_err;
}
コード例 #2
0
VError XLinuxFile::Move(const VFilePath& inDestinationPath, VFileSystem *inDestinationFileSystem, VFile** outFile, FileCopyOptions /*inOptions*/) const
{
	VFilePath dstPath(inDestinationPath);

	if (dstPath.IsFolder())
	{
		VStr255 name;					//jmo - todo : NAME_MAX ?
		fOwner->GetName(name);
		dstPath.SetFileName(name);
	}

	PathBuffer pathBuffer;
	pathBuffer.Init(dstPath);

	//First we try to rename the file...
	VError verr;
	{
		RenameHelper rnmHlp;
		verr=rnmHlp.Rename(fPath, pathBuffer);
	}

	//If Rename() fails because src and dst are not on the same fs, we try a Copy()
	if(verr!=VE_OK && IS_NATIVE_VERROR(verr) && NATIVE_ERRCODE_FROM_VERROR(verr)==EXDEV)
	{
		CopyHelper cpHlp;
		verr = cpHlp.Copy(fPath, pathBuffer);

		// it's a move not a copy, so one must delete the source after a sucessful copy
		if (verr == VE_OK)
		{
			int res=unlink(fPath.GetPath());
			verr = (res==0) ? VE_OK :  MAKE_NATIVE_VERROR(errno);
		}
	}

	if (outFile != NULL)
	{
		*outFile = (verr == VE_OK) ? new VFile( dstPath, inDestinationFileSystem) : NULL;
	}

	return verr;
}
コード例 #3
0
VError XLinuxFile::Move(const VFilePath& inDestinationPath, VFile** outFile, FileCopyOptions inOptions) const
{
	VFilePath dstPath(inDestinationPath);
	
	if (dstPath.IsFolder())
	{
		VStr255 name;					//jmo - todo : NAME_MAX ?
		fOwner->GetName(name);
		dstPath.SetFileName(name);
	}

	//First we try to rename the file...
	VError verr=Rename(dstPath.GetPath(), outFile);

	//If Rename() fails beacause src and dst are not on the same fs, we try a Copy()
	if(verr!=VE_OK && IS_NATIVE_VERROR(verr) && NATIVE_ERRCODE_FROM_VERROR(verr)==EXDEV)
		verr=Copy(inDestinationPath, outFile, inOptions);
	
	return verr;
}