};
-static inline int test_root(fsw_u32 a, int b)
+static __inline int test_root(fsw_u32 a, int b)
{
- int num = b;
+ fsw_u32 num = b;
while (a > num)
num *= b;
}
/* calculate the first block number of the group */
-static inline fsw_u32
+static __inline fsw_u32
fsw_ext4_group_first_block_no(struct ext4_super_block *sb, fsw_u32 group_no)
{
return group_no * (fsw_u32)EXT4_BLOCKS_PER_GROUP(sb) +
return status;
// Get group descriptor table and block number of inode table...
- gdesc = (struct ext4_group_desc *)(buffer + gdesc_index * vol->sb->s_desc_size);
+ gdesc = (struct ext4_group_desc *)((char *)buffer + gdesc_index * vol->sb->s_desc_size);
vol->inotab_bno[groupno] = gdesc->bg_inode_table_lo;
fsw_block_release(vol, gdesc_bno, buffer);
buffer = (void *)dno->raw->i_block;
buf_offset = 0;
while(1) {
- ext4_extent_header = (struct ext4_extent_header *)buffer + buf_offset;
+ ext4_extent_header = (struct ext4_extent_header *)((char *)buffer + buf_offset);
buf_offset += sizeof(struct ext4_extent_header);
FSW_MSG_DEBUG((FSW_MSGSTR("fsw_ext4_get_by_extent: extent header with %d entries\n"),
ext4_extent_header->eh_entries));
if(ext4_extent_header->eh_depth == 0)
{
// Leaf node, the header follows actual extents
- ext4_extent = (struct ext4_extent *)(buffer + buf_offset);
+ ext4_extent = (struct ext4_extent *)((char *)buffer + buf_offset);
buf_offset += sizeof(struct ext4_extent);
FSW_MSG_DEBUG((FSW_MSGSTR("fsw_ext4_get_by_extent: extent node cover %d...\n"), ext4_extent->ee_block));
{
FSW_MSG_DEBUG((FSW_MSGSTR("fsw_ext4_get_by_extent: index extents, depth %d\n"),
ext4_extent_header->eh_depth));
- ext4_extent_idx = (struct ext4_extent_idx *)(buffer + buf_offset);
+ ext4_extent_idx = (struct ext4_extent_idx *)((char *)buffer + buf_offset);
buf_offset += sizeof(struct ext4_extent_idx);
FSW_MSG_DEBUG((FSW_MSGSTR("fsw_ext4_get_by_extent: index node covers block %d...\n"),
return NewImage;
} // EG_IMAGE *egLoadIcon()
+// Returns an icon of any type from the specified subdirectory using the specified
+// base name. All directory references are relative to BaseDir. For instance, if
+// SubdirName is "myicons" and BaseName is "os_linux", this function will return
+// an image based on "myicons/os_linux.icns" or "myicons/os_linux.png", in that
+// order of preference. Returns NULL if no such file is a valid icon file.
+EG_IMAGE * egLoadIconAnyType(IN EFI_FILE *BaseDir, IN CHAR16 *SubdirName, IN CHAR16 *BaseName, IN UINTN IconSize) {
+ EG_IMAGE *Image = NULL;
+ CHAR16 *Extension;
+ CHAR16 FileName[256];
+ UINTN i = 0;
+
+ while (((Extension = FindCommaDelimited(ICON_EXTENSIONS, i++)) != NULL) && (Image == NULL)) {
+ SPrint(FileName, 255, L"%s\\%s.%s", SubdirName, BaseName, Extension);
+ Image = egLoadIcon(BaseDir, FileName, IconSize);
+ MyFreePool(Extension);
+ } // while()
+
+ return Image;
+} // EG_IMAGE *egLoadIconAnyType()
+
// Returns an icon with any extension in ICON_EXTENSIONS from either the directory
// specified by GlobalConfig.IconsDir or DEFAULT_ICONS_DIR. The input BaseName
// should be the icon name without an extension. For instance, if BaseName is
// order of preference. Returns NULL if no such icon can be found. All file
// references are relative to SelfDir.
EG_IMAGE * egFindIcon(IN CHAR16 *BaseName, IN UINTN IconSize) {
- CHAR16 *LoadDir, *Extension;
- CHAR16 FileName[256];
- UINTN i;
EG_IMAGE *Image = NULL;
- if (GlobalConfig.IconsDir != NULL)
- LoadDir = GlobalConfig.IconsDir;
- else
- LoadDir = StrDuplicate(DEFAULT_ICONS_DIR);
-
- while ((LoadDir != NULL) && (Image == NULL)) {
- i = 0;
- while (((Extension = FindCommaDelimited(ICON_EXTENSIONS, i++)) != NULL) && (Image == NULL)) {
- SPrint(FileName, 255, L"%s\\%s.%s", LoadDir, BaseName, Extension);
- Image = egLoadIcon(SelfDir, FileName, IconSize);
- MyFreePool(Extension);
- } // while()
- if (LoadDir == GlobalConfig.IconsDir) {
- LoadDir = StrDuplicate(DEFAULT_ICONS_DIR);
- } else {
- MyFreePool(LoadDir);
- LoadDir = NULL;
- } // if/else
- } // while()
+ if (GlobalConfig.IconsDir != NULL) {
+ Image = egLoadIconAnyType(SelfDir, GlobalConfig.IconsDir, BaseName, IconSize);
+ }
+
+ if (Image == NULL) {
+ Image = egLoadIconAnyType(SelfDir, DEFAULT_ICONS_DIR, BaseName, IconSize);
+ }
+
return Image;
} // EG_IMAGE * egFindIcon()
EG_IMAGE * egLoadImage(IN EFI_FILE* BaseDir, IN CHAR16 *FileName, IN BOOLEAN WantAlpha);
EG_IMAGE * egLoadIcon(IN EFI_FILE* BaseDir, IN CHAR16 *FileName, IN UINTN IconSize);
+EG_IMAGE * egLoadIconAnyType(IN EFI_FILE *BaseDir, IN CHAR16 *SubdirName, IN CHAR16 *BaseName, IN UINTN IconSize);
EG_IMAGE * egFindIcon(IN CHAR16 *BaseName, IN UINTN IconSize);
EG_IMAGE * egPrepareEmbeddedImage(IN EG_EMBEDDED_IMAGE *EmbeddedImage, IN BOOLEAN WantAlpha);
} else if ((StriCmp(TokenList[0], L"icon") == 0) && (TokenCount > 1)) {
MyFreePool(Entry->me.Image);
-// Entry->me.Image = LoadIcns(CurrentVolume->RootDir, TokenList[1], 128);
Entry->me.Image = egLoadIcon(CurrentVolume->RootDir, TokenList[1], 128);
if (Entry->me.Image == NULL) {
Entry->me.Image = DummyImage(128);
} /* EG_IMAGE * LoadOSIcon() */
-// Load an image from a .icns or .png file. FileNames contains a comma-delimited
-// list of potential filanems; the function tries each in turn until it finds
-// a loadable icon. If no file has a valid icon, it returns NULL.
-EG_IMAGE * LoadIcns(IN EFI_FILE_HANDLE BaseDir, IN CHAR16 *FileNames, IN UINTN PixelSize) {
- CHAR16 *FileName;
- EG_IMAGE *Image = NULL;
- UINTN Index = 0;
-
- if (GlobalConfig.TextOnly) // skip loading if it's not used anyway
- return NULL;
-
- while (((FileName = FindCommaDelimited(FileNames, Index++)) != NULL) && (Image == NULL)) {
- Image = egLoadIcon(BaseDir, FileName, PixelSize);
- }
- return Image;
-} // EG_IMAGE * LoadIcns()
-
static EG_PIXEL BlackPixel = { 0x00, 0x00, 0x00, 0 };
//static EG_PIXEL YellowPixel = { 0x00, 0xff, 0xff, 0 };
EG_IMAGE * LoadOSIcon(IN CHAR16 *OSIconName OPTIONAL, IN CHAR16 *FallbackIconName, BOOLEAN BootLogo);
-EG_IMAGE * LoadIcns(IN EFI_FILE_HANDLE BaseDir, IN CHAR16 *FileName, IN UINTN PixelSize);
EG_IMAGE * DummyImage(IN UINTN PixelSize);
EG_IMAGE * BuiltinIcon(IN UINTN Id);
// get custom volume icon if present
if (!Volume->VolBadgeImage)
- Volume->VolBadgeImage = LoadIcns(Volume->RootDir, VOLUME_BADGE_NAMES, 32);
+ Volume->VolBadgeImage = egLoadIconAnyType(Volume->RootDir, L"", L".VolumeBadge", 32);
if (!Volume->VolIconImage)
- Volume->VolIconImage = LoadIcns(Volume->RootDir, VOLUME_ICON_NAMES, 128);
+ Volume->VolIconImage = egLoadIconAnyType(Volume->RootDir, L"", L".VolumeIcon", 128);
} // ScanVolume()
static VOID ScanExtendedPartition(REFIT_VOLUME *WholeDiskVolume, MBR_PARTITION_INFO *MbrEntry)
if (AboutMenu.EntryCount == 0) {
AboutMenu.TitleImage = BuiltinIcon(BUILTIN_ICON_FUNC_ABOUT);
- AddMenuInfoLine(&AboutMenu, L"rEFInd Version 0.6.6.4");
+ AddMenuInfoLine(&AboutMenu, L"rEFInd Version 0.6.6.5");
AddMenuInfoLine(&AboutMenu, L"");
AddMenuInfoLine(&AboutMenu, L"Copyright (c) 2006-2010 Christoph Pfisterer");
AddMenuInfoLine(&AboutMenu, L"Copyright (c) 2012 Roderick W. Smith");
struct LOADER_LIST *LoaderList = NULL, *NewLoader;
BOOLEAN FoundFallbackDuplicate = FALSE;
-// Print(L"Entering ScanLoaderDir(), scanning '%s' for pattern '%s'\n", Path, Pattern);
if ((!SelfDirPath || !Path || ((StriCmp(Path, SelfDirPath) == 0) && (Volume->DeviceHandle != SelfVolume->DeviceHandle)) ||
(StriCmp(Path, SelfDirPath) != 0)) &&
(ShouldScan(Volume, Path))) {
CheckError(Status, FileName);
} // if (Status != EFI_NOT_FOUND)
} // if not scanning our own directory
-// PauseForKey();
+
return FoundFallbackDuplicate;
} /* static VOID ScanLoaderDir() */
CHAR16 ShortcutLetter = 0;
CHAR16 *LegacyDescription = BdsOption->Description;
-// ScanVolume(Volume);
-
// prepare the menu entry
Entry = AllocateZeroPool(sizeof(LEGACY_ENTRY));
Entry->me.Title = AllocateZeroPool(256 * sizeof(CHAR16));
Entry->LoadOptions = (DiskType == BBS_CDROM) ? L"CD" :
((DiskType == BBS_USB) ? L"USB" : L"HD");
Entry->me.BadgeImage = GetDiskBadge(DiskType);
-// Entry->me.BadgeImage = Volume->VolBadgeImage;
Entry->BdsOption = BdsOption;
Entry->Enabled = TRUE;
// check for other bootable entries on the same disk
for (VolumeIndex2 = 0; VolumeIndex2 < VolumesCount; VolumeIndex2++) {
if (VolumeIndex2 != VolumeIndex && Volumes[VolumeIndex2]->HasBootCode &&
- Volumes[VolumeIndex2]->WholeDiskBlockIO == Volume->WholeDiskBlockIO)
+ Volumes[VolumeIndex2]->WholeDiskBlockIO == Volume->WholeDiskBlockIO)
ShowVolume = FALSE;
}
}