Exemple #1
1
void CEntHost::PostThink()
{
    m_bIsBot = (GetBotController()) ? true : false;

    if ( IsAlive() && IsActive() ) {
        UpdateComponents();
        UpdateAttributes();

        m_bOnCombat = (m_CombatTimer.HasStarted() && m_CombatTimer.IsLessThen( 10.0f ));
        m_bUnderAttack = (m_UnderAttackTimer.HasStarted() && m_UnderAttackTimer.IsLessThen( 5.0f ));

        if ( m_bIsBot && !m_bOnCombat ) {
            m_bOnCombat = GetBotController()->IsAlerted() || GetBotController()->IsCombating();
        }
    }

    if ( GetAnimationSystem() ) {
        GetAnimationSystem()->Update();
    }
}
status_t
DefaultCatalog::WriteToFile(const char *path)
{
	BFile catalogFile;
	if (path)
		fPath = path;
	status_t res = catalogFile.SetTo(fPath.String(),
		B_WRITE_ONLY | B_CREATE_FILE | B_ERASE_FILE);
	if (res != B_OK)
		return res;

	BMallocIO mallocIO;
	mallocIO.SetBlockSize(max(fCatMap.Size() * 20, (int32)256));
		// set a largish block-size in order to avoid reallocs
	res = Flatten(&mallocIO);
	if (res == B_OK) {
		ssize_t wsz;
		wsz = catalogFile.Write(mallocIO.Buffer(), mallocIO.BufferLength());
		if (wsz != (ssize_t)mallocIO.BufferLength())
			return B_FILE_ERROR;

		// set mimetype-, language- and signature-attributes:
		UpdateAttributes(catalogFile);
	}
	if (res == B_OK)
		UpdateAttributes(catalogFile);
	return res;
}
Exemple #3
0
NS_IMETHODIMP
nsTextBoxFrame::AttributeChanged(PRInt32         aNameSpaceID,
                                 nsIAtom*        aAttribute,
                                 PRInt32         aModType)
{
    PRBool aResize;
    PRBool aRedraw;

    UpdateAttributes(aAttribute, aResize, aRedraw);

    if (aResize) {
        PresContext()->PresShell()->
            FrameNeedsReflow(this, nsIPresShell::eStyleChange,
                             NS_FRAME_IS_DIRTY);
    } else if (aRedraw) {
        nsBoxLayoutState state(PresContext());
        Redraw(state);
    }

    // If the accesskey changed, register for the new value
    // The old value has been unregistered in nsXULElement::SetAttr
    if (aAttribute == nsGkAtoms::accesskey || aAttribute == nsGkAtoms::control)
        RegUnregAccessKey(PR_TRUE);

    return NS_OK;
}
bool CTGitPath::IsReadOnly() const
{
	if(!m_bLastWriteTimeKnown)
	{
		UpdateAttributes();
	}
	return m_bIsReadOnly;
}
__int64 CTGitPath::GetFileSize() const
{
	if(!m_bDirectoryKnown)
	{
		UpdateAttributes();
	}
	return m_fileSize;
}
__int64  CTGitPath::GetLastWriteTime() const
{
	if(!m_bLastWriteTimeKnown)
	{
		UpdateAttributes();
	}
	return m_lastWriteTime;
}
bool CTGitPath::Exists() const
{
	if (!m_bExistsKnown)
	{
		UpdateAttributes();
	}
	return m_bExists;
}
bool CTGitPath::IsDirectory() const
{
	if(!m_bDirectoryKnown)
	{
		UpdateAttributes();
	}
	return m_bIsDirectory;
}
mozApocPolicyModelNodeRef mozApocPolicyModelNode::ImplDisposeAndGetNext(mozApocNotificationDispatcher const & aNotifier)
{
    MODEL_TRACE(stderr, "apoc data model:   Disposing Node '%s' at %p \n", 
                PromiseFlatCString(mName).get(), (void*)this ); 

    UpdateAttributes(0, aNotifier);
    NS_ASSERTION(!mValue, "apoc - Value not disposed properly");

    DisposeNodeList(mChildren, aNotifier);

    MODEL_TRACE(stderr, "apoc data model:   Done disposing Node '%s' at %p \n", 
                PromiseFlatCString(mName).get(), (void*)this ); 

    return mNext.Release();
}
Exemple #10
0
NS_IMETHODIMP
nsTextBoxFrame::Init(nsIContent*      aContent,
                     nsIFrame*        aParent,
                     nsIFrame*        aPrevInFlow)
{
    nsTextBoxFrameSuper::Init(aContent, aParent, aPrevInFlow);

    PRBool aResize;
    PRBool aRedraw;
    UpdateAttributes(nsnull, aResize, aRedraw); /* update all */

    // register access key
    RegUnregAccessKey(PR_TRUE);

    return NS_OK;
}
status_t
DefaultCatalog::ReadFromFile(const char *path)
{
	if (!path)
		path = fPath.String();

	BFile catalogFile;
	status_t res = catalogFile.SetTo(path, B_READ_ONLY);
	if (res != B_OK)
		return B_ENTRY_NOT_FOUND;

	fPath = path;

	off_t sz = 0;
	res = catalogFile.GetSize(&sz);
	if (res != B_OK) {
		return res;
	}

	auto_ptr<char> buf(new(std::nothrow) char [sz]);
	if (buf.get() == NULL)
		return B_NO_MEMORY;
	res = catalogFile.Read(buf.get(), sz);
	if (res < B_OK)
		return res;
	if (res < sz)
		return res;
	BMemoryIO memIO(buf.get(), sz);
	res = Unflatten(&memIO);

	if (res == B_OK) {
		// some information living in member variables needs to be copied
		// to attributes. Although these attributes should have been written
		// when creating the catalog, we make sure that they exist there:
		UpdateAttributes(catalogFile);
	}

	return res;
}
Exemple #12
0
void
compzillaWindow::BindWindow ()
{
    RedirectWindow ();

    if (!mPixmap) {
        XGrabServer (mDisplay);

        UpdateAttributes ();

        if (mAttr.map_state == IsViewable) {
            // Set up persistent offscreen window contents pixmap.
            mPixmap = XCompositeNameWindowPixmap (mDisplay, mWindow);

            if (mPixmap == None) {
                ERROR ("XCompositeNameWindowPixmap failed for window %p\n", mWindow);
            }
        }

        XUngrabServer (mDisplay);
    }
}
Exemple #13
0
DWORD CTSVNPath::GetFileAttributes() const
{
    if (!m_bIsAttributesKnown)
        UpdateAttributes();
    return m_attributes;
}
Exemple #14
0
STATIC
EFI_STATUS
EFIAPI
Virtio10BindingStart (
  IN EFI_DRIVER_BINDING_PROTOCOL *This,
  IN EFI_HANDLE                  DeviceHandle,
  IN EFI_DEVICE_PATH_PROTOCOL    *RemainingDevicePath
  )
{
  VIRTIO_1_0_DEV *Device;
  EFI_STATUS     Status;
  PCI_TYPE00     Pci;
  UINT64         SetAttributes;

  Device = AllocateZeroPool (sizeof *Device);
  if (Device == NULL) {
    return EFI_OUT_OF_RESOURCES;
  }

  Device->Signature = VIRTIO_1_0_SIGNATURE;
  CopyMem (&Device->VirtIo, &mVirtIoTemplate, sizeof mVirtIoTemplate);

  Status = gBS->OpenProtocol (DeviceHandle, &gEfiPciIoProtocolGuid,
                  (VOID **)&Device->PciIo, This->DriverBindingHandle,
                  DeviceHandle, EFI_OPEN_PROTOCOL_BY_DRIVER);
  if (EFI_ERROR (Status)) {
    goto FreeDevice;
  }

  Status = Device->PciIo->Pci.Read (Device->PciIo, EfiPciIoWidthUint32, 0,
                                sizeof Pci / sizeof (UINT32), &Pci);
  if (EFI_ERROR (Status)) {
    goto ClosePciIo;
  }

  Device->VirtIo.SubSystemDeviceId = Pci.Hdr.DeviceId - 0x1040;

  Status = ParseCapabilities (Device, Pci.Device.CapabilityPtr);
  if (EFI_ERROR (Status)) {
    goto ClosePciIo;
  }

  Status = Device->PciIo->Attributes (Device->PciIo,
                            EfiPciIoAttributeOperationGet, 0,
                            &Device->OriginalPciAttributes);
  if (EFI_ERROR (Status)) {
    goto ClosePciIo;
  }

  SetAttributes = 0;
  UpdateAttributes (&Device->CommonConfig, &SetAttributes);
  UpdateAttributes (&Device->NotifyConfig, &SetAttributes);
  UpdateAttributes (&Device->SpecificConfig, &SetAttributes);
  Status = Device->PciIo->Attributes (Device->PciIo,
                            EfiPciIoAttributeOperationEnable, SetAttributes,
                            NULL);
  if (EFI_ERROR (Status)) {
    goto ClosePciIo;
  }

  Status = gBS->InstallProtocolInterface (&DeviceHandle,
                  &gVirtioDeviceProtocolGuid, EFI_NATIVE_INTERFACE,
                  &Device->VirtIo);
  if (EFI_ERROR (Status)) {
    goto RestorePciAttributes;
  }

  return EFI_SUCCESS;

RestorePciAttributes:
  Device->PciIo->Attributes (Device->PciIo, EfiPciIoAttributeOperationSet,
                   Device->OriginalPciAttributes, NULL);

ClosePciIo:
  gBS->CloseProtocol (DeviceHandle, &gEfiPciIoProtocolGuid,
         This->DriverBindingHandle, DeviceHandle);

FreeDevice:
  FreePool (Device);

  return Status;
}
	clFileAttributesWin( NCDialogParent* parent, PanelWin* Panel )
	 : NCVertDialog( ::createDialogAsChild, 0, parent, utf8_to_unicode(_LT("Attributes")).data(), bListOkCancel )
	 , m_Panel( Panel )
	 , m_Node( Panel ? Panel->GetCurrent() : nullptr )
	 , m_URI( Panel ? Panel->UriOfCurrent() : FSString() )
	 , m_Layout( 17, 3 )
	 , m_CaptionText( 0, this, utf8_to_unicode( _LT( "" ) ).data(), nullptr, StaticLine::CENTER )
	 , m_FileNameText( uiValue, this, utf8_to_unicode( _LT( "" ) ).data(), nullptr, StaticLine::CENTER )
#if defined(_WIN32)
	 , m_ReadOnly( uiVariable, this, utf8_to_unicode( _LT( "Read only" ) ).data(), 0, false )
	 , m_Archive( uiVariable, this, utf8_to_unicode( _LT( "Archive" ) ).data(), 0, false )
	 , m_Hidden( uiVariable, this, utf8_to_unicode( _LT( "Hidden" ) ).data(), 0, false )
	 , m_System( uiVariable, this, utf8_to_unicode( _LT( "System" ) ).data(), 0, false )
	 , m_Compressed( 0, this, utf8_to_unicode( _LT( "Compressed" ) ).data(), 0, false )
	 , m_Encrypted( 0, this, utf8_to_unicode( _LT( "Encrypted" ) ).data(), 0, false )
	 , m_NotIndexed( 0, this, utf8_to_unicode( _LT( "NotIndexed" ) ).data(), 0, false )
	 , m_Sparse( 0, this, utf8_to_unicode( _LT( "Sparse" ) ).data(), 0, false )
	 , m_Temporary( 0, this, utf8_to_unicode( _LT( "Temporary" ) ).data(), 0, false )
	 , m_Offline( 0, this, utf8_to_unicode( _LT( "Offline" ) ).data(), 0, false )
	 , m_ReparsePoint( 0, this, utf8_to_unicode( _LT( "ReparsePoint" ) ).data(), 0, false )
	 , m_Virtual( 0, this, utf8_to_unicode( _LT( "Virtual" ) ).data(), 0, false )
#else
	 , m_UserRead( uiVariable, this, utf8_to_unicode( _LT( "User &read" ) ).data(), 0, false )
	 , m_UserWrite( uiVariable, this, utf8_to_unicode( _LT( "User &write" ) ).data(), 0, false )
    , m_UserExecute( uiVariable, this, utf8_to_unicode( _LT( "User e&xecute" ) ).data(), 0, false )
	 , m_GroupRead( uiVariable, this, utf8_to_unicode( _LT( "&Group read" ) ).data(), 0, false )
	 , m_GroupWrite( uiVariable, this, utf8_to_unicode( _LT( "Group write" ) ).data(), 0, false )
	 , m_GroupExecute( uiVariable, this, utf8_to_unicode( _LT( "Group execute" ) ).data(), 0, false )
	 , m_OthersRead( uiVariable, this, utf8_to_unicode( _LT( "&Others read" ) ).data(), 0, false )
	 , m_OthersWrite( uiVariable, this, utf8_to_unicode( _LT( "Others write" ) ).data(), 0, false )
	 , m_OthersExecute( uiVariable, this, utf8_to_unicode( _LT( "Others execute" ) ).data(), 0, false )
#endif
	// time
	 , m_LastWriteTimeLabel( 0, this, utf8_to_unicode( _LT( "Last write time" ) ).data(), nullptr, StaticLine::LEFT )
	 , m_CreationTimeLabel( 0, this, utf8_to_unicode( _LT( "Creation time" ) ).data(), nullptr, StaticLine::LEFT )
	 , m_LastAccessTimeLabel( 0, this, utf8_to_unicode( _LT( "Last access time" ) ).data(), nullptr, StaticLine::LEFT )
	 , m_ChangeTimeLabel( 0, this, utf8_to_unicode( _LT( "Change time" ) ).data(), nullptr, StaticLine::LEFT )
	 //
	 , m_LastWriteDate( 0, this, nullptr, utf8_to_unicode( _LT( "DD.MM.YYYY" ) ).data(), 9 )
	 , m_CreationDate( 0, this, nullptr, utf8_to_unicode( _LT( "DD.MM.YYYY" ) ).data(), 9 )
	 , m_LastAccessDate( 0, this, nullptr, utf8_to_unicode( _LT( "DD.MM.YYYY" ) ).data(), 9 )
	 , m_ChangeDate( 0, this, nullptr, utf8_to_unicode( _LT( "DD.MM.YYYY" ) ).data(), 9 )
	 //
	 , m_LastWriteTime( 0, this, nullptr, utf8_to_unicode( _LT( "HH:MM:SS" ) ).data(), 13 )
	 , m_CreationTime( 0, this, nullptr, utf8_to_unicode( _LT( "HH:MM:SS" ) ).data(), 13 )
	 , m_LastAccessTime( 0, this, nullptr, utf8_to_unicode( _LT( "HH:MM:SS" ) ).data(), 13 )
	 , m_ChangeTime( 0, this, nullptr, utf8_to_unicode( _LT( "HH:MM:SS" ) ).data(), 13 )
	{
		if ( m_Panel )
		{
			const unicode_t* FileName = m_Panel->GetCurrentFileName();

			m_FileNameText.SetText( FileName );
		}

		if ( m_Node && m_Node->IsDir() )
		{
			m_CaptionText.SetText( utf8_to_unicode( _LT("Change attributes for folder:") ).data() );
		}
		else
		{
			m_CaptionText.SetText( utf8_to_unicode( _LT("Change file attributes for:") ).data() );
		}

		int Row = 0;

		m_Layout.AddWinAndEnable( &m_CaptionText, Row, 0, Row, 2 ); Row++;
		m_Layout.AddWinAndEnable( &m_FileNameText, Row, 0, Row, 2 ); Row++;

		int TRow = Row;

#if defined(_WIN32)
		m_Layout.AddWinAndEnable( &m_ReadOnly, Row++, 0 );
		m_Layout.AddWinAndEnable( &m_Archive, Row++, 0 );
		m_Layout.AddWinAndEnable( &m_Hidden, Row++, 0 );
		m_Layout.AddWinAndEnable( &m_System, Row++, 0 );
		m_Layout.AddWinAndEnable( &m_Compressed, Row++, 0 );
		m_Layout.AddWinAndEnable( &m_Encrypted, Row++, 0 );
		Row = TRow;
		m_Layout.AddWinAndEnable( &m_NotIndexed, Row++, 1 );
		m_Layout.AddWinAndEnable( &m_Sparse, Row++, 1 );
		m_Layout.AddWinAndEnable( &m_Temporary, Row++, 1 );
		m_Layout.AddWinAndEnable( &m_Offline, Row++, 1 );
		m_Layout.AddWinAndEnable( &m_ReparsePoint, Row++, 1 );
		m_Layout.AddWinAndEnable( &m_Virtual, Row++, 1 );

		// disable editing of these properties
		m_Compressed.Enable( false );
		m_Encrypted.Enable( false );
		m_NotIndexed.Enable( false );
		m_Sparse.Enable( false );
		m_Temporary.Enable( false );
		m_Offline.Enable( false );
		m_ReparsePoint.Enable( false );
		m_Virtual.Enable( false );
#else
		m_Layout.AddWinAndEnable( &m_UserRead, Row, 0 );
		m_Layout.AddWinAndEnable( &m_UserWrite, Row, 1 );
		m_Layout.AddWinAndEnable( &m_UserExecute, Row, 2 );
		Row++;
		m_Layout.AddWinAndEnable( &m_GroupRead, Row, 0 );
		m_Layout.AddWinAndEnable( &m_GroupWrite, Row, 1 );
		m_Layout.AddWinAndEnable( &m_GroupExecute, Row, 2 );
		Row++;
		m_Layout.AddWinAndEnable( &m_OthersRead, Row, 0 );
		m_Layout.AddWinAndEnable( &m_OthersWrite, Row, 1 );
		m_Layout.AddWinAndEnable( &m_OthersExecute, Row, 2 );
#endif

		m_Layout.LineSet( Row++, 5 );

		TRow = Row;
		m_Layout.AddWinAndEnable( &m_LastWriteTimeLabel, Row++, 0 );
		m_Layout.AddWinAndEnable( &m_CreationTimeLabel, Row++, 0 );
		m_Layout.AddWinAndEnable( &m_LastAccessTimeLabel, Row++, 0 );
#if defined(HAS_CHANGETIME)
		m_Layout.AddWinAndEnable( &m_ChangeTimeLabel, Row++, 0 );
#endif
		Row = TRow;
		m_Layout.AddWinAndEnable( &m_LastWriteDate, Row++, 1 );
		m_Layout.AddWinAndEnable( &m_CreationDate, Row++, 1 );
		m_Layout.AddWinAndEnable( &m_LastAccessDate, Row++, 1 );
#if defined(HAS_CHANGETIME)
		m_Layout.AddWinAndEnable( &m_ChangeDate, Row++, 1 );
#endif
		Row = TRow;
		m_Layout.AddWinAndEnable( &m_LastWriteTime, Row++, 2 );
		m_Layout.AddWinAndEnable( &m_CreationTime, Row++, 2 );
		m_Layout.AddWinAndEnable( &m_LastAccessTime, Row++, 2 );
#if defined(HAS_CHANGETIME)
		m_Layout.AddWinAndEnable( &m_ChangeTime, Row++, 2 );
#endif

		m_LastWriteDate.SetValidator( new clDateValidator() );
		m_LastWriteDate.SetReplaceMode( true );
		m_CreationDate.SetValidator( new clDateValidator() );
		m_CreationDate.SetReplaceMode( true );
		m_LastAccessDate.SetValidator( new clDateValidator() );
		m_LastAccessDate.SetReplaceMode( true );
#if defined(HAS_CHANGETIME)
		m_ChangeDate.SetValidator( new clDateValidator() );
		m_ChangeDate.SetReplaceMode( true );
#endif
		m_LastWriteTime.SetValidator( new clTimeValidator() );
		m_LastWriteTime.SetReplaceMode( true );
		m_CreationTime.SetValidator( new clTimeValidator() );
		m_CreationTime.SetReplaceMode( true );
		m_LastAccessTime.SetValidator( new clTimeValidator() );
		m_LastAccessTime.SetReplaceMode( true );
#if defined(HAS_CHANGETIME)
		m_ChangeTime.SetValidator( new clTimeValidator() );
		m_ChangeTime.SetReplaceMode( true );
#endif

		UpdateAttributes( m_Node );
		
		AddLayout( &m_Layout );

		order.clear();
#if defined(_WIN32)
		order.append(&m_ReadOnly);
		order.append(&m_Archive);
		order.append(&m_Hidden);
		order.append(&m_System);
#else
		order.append(&m_UserRead);
		order.append(&m_UserWrite);
		order.append(&m_UserExecute);
		order.append(&m_GroupRead);
		order.append(&m_GroupWrite);
		order.append(&m_GroupExecute);
		order.append(&m_OthersRead);
		order.append(&m_OthersWrite);
		order.append(&m_OthersExecute);
#endif // _WIN32
		order.append(&m_LastWriteDate);
		order.append(&m_LastWriteTime);
		order.append(&m_CreationDate);
		order.append(&m_CreationTime);
		order.append(&m_LastAccessDate);
		order.append(&m_LastAccessTime);
#if defined(HAS_CHANGETIME)
		order.append(&m_ChangeDate);
		order.append(&m_ChangeTime);
#endif // HAS_CHANGETIME

		SetEnterCmd( CMD_OK );
		SetPosition();
	}
Exemple #16
0
		AABB::AABB(const glm::vec3& min, const glm::vec3& max) : m_min(min), m_max(max)
		{
			UpdateAttributes();
		}