From 7c09ef12550b2d3ba32086de3b612308e5c326cd Mon Sep 17 00:00:00 2001 From: "Alexander G. M. Smith" Date: Mon, 28 Feb 2022 16:37:20 -0500 Subject: [PATCH] FAT: Fix 32 bit gcc2 compile. You can't initialize struct fields in the declaration in gcc2, but you can set them up in a constructor. So made one for struct diri, and initialize nested sub-structures too. Change-Id: Ic8b824bc157cca4cdb8c4e41afdca596776c0d55 Reviewed-on: https://review.haiku-os.org/c/haiku/+/4995 Tested-by: Commit checker robot Reviewed-by: waddlesplash --- src/add-ons/kernel/file_systems/fat/iter.cpp | 10 ++++++++++ src/add-ons/kernel/file_systems/fat/iter.h | 5 +++-- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/src/add-ons/kernel/file_systems/fat/iter.cpp b/src/add-ons/kernel/file_systems/fat/iter.cpp index f59e6ab531..93dbecbe0d 100644 --- a/src/add-ons/kernel/file_systems/fat/iter.cpp +++ b/src/add-ons/kernel/file_systems/fat/iter.cpp @@ -306,6 +306,16 @@ diri_init(nspace *vol, uint32 cluster, uint32 index, struct diri *diri) } +diri::diri() +{ + csi.vol = NULL; + csi.cluster = 0; + csi.sector = 0; + + current_block = NULL; +} + + diri::~diri() { if (current_block != NULL) diff --git a/src/add-ons/kernel/file_systems/fat/iter.h b/src/add-ons/kernel/file_systems/fat/iter.h index ea996b6a48..2d11402b81 100644 --- a/src/add-ons/kernel/file_systems/fat/iter.h +++ b/src/add-ons/kernel/file_systems/fat/iter.h @@ -34,11 +34,12 @@ status_t csi_write_block(struct csi *csi, uint8 *buffer); /* directory entry iterator */ struct diri { - struct csi csi = {}; + struct csi csi; uint32 starting_cluster; uint32 current_index; - uint8 *current_block = NULL; + uint8 *current_block; + diri(); ~diri(); };