FontDropItem *FontDropDown::DecodeSelection(INT32 SelectionIndex) { // do not allow the extra "missing" item to be selected if (SelectionIndex == GetNumberOfItems() - 1 && m_MissingItemAdded) return NULL; FontDropItem *Fred = (FontDropItem *) GetItemData(SelectionIndex); if (Fred==&TheTopItem) return(NULL); return Fred; }
ULONGLONG EndlessISO::GetExtractedSize(const CString & image, const BOOL isInstallerImage) { auto extractor = SevenZip::SevenZipExtractor(pImpl->sevenZip, image.GetString()); extractor.SetCompressionFormat(SevenZip::CompressionFormat::SquashFS); auto n = extractor.GetNumberOfItems(); IFFALSE_RETURN_VALUE(n == 1, "not exactly 1 item in squashfs image", 0); UINT32 i = 0; auto name = extractor.GetItemsNames()[i]; IFFALSE_RETURN_VALUE(name == ENDLESS_IMG_FILE_NAME, "squashfs item has wrong name", 0); struct ptable pt; auto gotPt = extractor.ExtractBytes(i, &pt, sizeof(pt)); IFFALSE_RETURN_VALUE(gotPt, "Failed to read partition table", 0); if (!is_eos_gpt_valid(&pt, isInstallerImage)) { return 0; } return get_disk_size(&pt); }
BOOL FontDropDown::SetSelection(FontDropItem *TheFont) { ERROR2IF(ParentDlg == NULL, FALSE, "FontDropDown not properly initialised"); INT32 SelectedIndex = -1; TRACEUSER("wuerthne", _T("SetSelection to %s"), (TCHAR*)TheFont->FontName); INT32 Index = 0; INT32 MaxIndex = GetNumberOfItems(); while (Index < MaxIndex) { if ( (TheFont->FontName == ((FontDropItem *) GetItemData(Index))->FontName) && (TheFont->Type == ((FontDropItem *) GetItemData(Index))->Type) ) { SelectedIndex = Index; break; } Index++; } if (Index == MaxIndex) { TRACEUSER("wuerthne", _T("font not in list, Index = %d"), Index); // font was not in the list, so make sure there is a special item at the // end to accomodate it String_64 NewName(TheFont->FontName); NewName += String_64(_R(IDS_FONTMISSING)); if (m_MissingItemAdded) { TRACEUSER("wuerthne", _T("update missing item")); FontDropItem *Item = (FontDropItem*)Fonts.GetTail(); Item->SetInfo(NewName, FC_UNDEFINED); SelectedIndex = Index - 1; } else { TRACEUSER("wuerthne", _T("add missing item")); FontDropItem *Item = new FontDropItem(NewName, FC_UNDEFINED); Fonts.AddTail(Item); AddItem((void*) Item); m_MissingItemAdded = TRUE; SelectedIndex = Index; } } else { // the font was in the list, so if there is a "missing" item at the end remove it // (unless of course, the selected item *is* the "missing" item, but this cannot // normally happen because our item has the added text " (missing)") if (m_MissingItemAdded && SelectedIndex != MaxIndex - 1) { TRACEUSER("wuerthne", _T("remove missing item")); delete( (FontDropItem*)((Fonts.RemoveItem(Fonts.GetTail()))) ); m_MissingItemAdded = FALSE; // delete the item from the combo box DeleteItem(MaxIndex - 1); } } TRACEUSER("wuerthne", _T("setting index to %d"), SelectedIndex); SetSelectedIndex(SelectedIndex); // And set the appropriate selected item TRACEUSER("wuerthne", _T("SetSelection done")); return(TRUE); }
NS_IMETHODIMP DOMSVGLengthList::GetLength(PRUint32 *aNumberOfItems) { return GetNumberOfItems(aNumberOfItems); }
NS_IMETHODIMP DOMSVGStringList::GetLength(PRUint32 *aLength) { return GetNumberOfItems(aLength); }
/* readonly attribute unsigned long length; */ NS_IMETHODIMP DOMSVGTransformList::GetLength(PRUint32 *aLength) { return GetNumberOfItems(aLength); }
NS_IMETHODIMP DOMSVGPointList::GetLength(uint32_t *aNumberOfItems) { return GetNumberOfItems(aNumberOfItems); }