From: Graham Percival Date: Wed, 25 Dec 2024 17:35:54 +0000 (-0800) Subject: Remove unnecessary semicolons (#2450) X-Git-Tag: v3.8.0~98 X-Git-Url: http://git.ipfire.org/gitweb/gitweb.cgi?a=commitdiff_plain;h=35da265cc3fc21150e14b3d01bafc57bc82eacdc;p=thirdparty%2Flibarchive.git Remove unnecessary semicolons (#2450) --- diff --git a/libarchive/archive_ppmd7.c b/libarchive/archive_ppmd7.c index 30124f174..f0369835b 100644 --- a/libarchive/archive_ppmd7.c +++ b/libarchive/archive_ppmd7.c @@ -287,9 +287,14 @@ static void *AllocUnits(CPpmd7 *p, unsigned indx) return AllocUnitsRare(p, indx); } -#define MyMem12Cpy(dest, src, num) \ - { UInt32 *d = (UInt32 *)dest; const UInt32 *s = (const UInt32 *)src; UInt32 n = num; \ - do { d[0] = s[0]; d[1] = s[1]; d[2] = s[2]; s += 3; d += 3; } while(--n); } +#define MyMem12Cpy(dest, src, num) do { \ + UInt32 *d = (UInt32 *)dest; \ + const UInt32 *s = (const UInt32 *)src; \ + UInt32 n = num; \ + do { \ + d[0] = s[0]; d[1] = s[1]; d[2] = s[2]; s += 3; d += 3; \ + } while(--n); \ +} while (0) static void *ShrinkUnits(CPpmd7 *p, void *oldPtr, unsigned oldNU, unsigned newNU) { diff --git a/libarchive/archive_ppmd8.c b/libarchive/archive_ppmd8.c index 2fb7f7141..30196d64a 100644 --- a/libarchive/archive_ppmd8.c +++ b/libarchive/archive_ppmd8.c @@ -242,9 +242,14 @@ static void *AllocUnits(CPpmd8 *p, unsigned indx) return AllocUnitsRare(p, indx); } -#define MyMem12Cpy(dest, src, num) \ - { UInt32 *d = (UInt32 *)dest; const UInt32 *z = (const UInt32 *)src; UInt32 n = num; \ - do { d[0] = z[0]; d[1] = z[1]; d[2] = z[2]; z += 3; d += 3; } while (--n); } +#define MyMem12Cpy(dest, src, num) do { \ + UInt32 *d = (UInt32 *)dest; \ + const UInt32 *z = (const UInt32 *)src; \ + UInt32 n = num; \ + do { \ + d[0] = z[0]; d[1] = z[1]; d[2] = z[2]; z += 3; d += 3; \ + } while (--n); \ +} while (0) static void *ShrinkUnits(CPpmd8 *p, void *oldPtr, unsigned oldNU, unsigned newNU) { @@ -341,7 +346,9 @@ static void SetSuccessor(CPpmd_State *p, CPpmd_Void_Ref v) (p)->SuccessorHigh = (UInt16)(((UInt32)(v) >> 16) & 0xFFFF); } -#define RESET_TEXT(offs) { p->Text = p->Base + p->AlignOffset + (offs); } +#define RESET_TEXT(offs) do { \ + p->Text = p->Base + p->AlignOffset + (offs); \ +} while (0) static void RestartModel(CPpmd8 *p) { diff --git a/libarchive/archive_ppmd_private.h b/libarchive/archive_ppmd_private.h index 582803e5f..bc525b47e 100644 --- a/libarchive/archive_ppmd_private.h +++ b/libarchive/archive_ppmd_private.h @@ -109,8 +109,12 @@ typedef struct Byte Count; /* Count to next change of Shift */ } CPpmd_See; -#define Ppmd_See_Update(p) if ((p)->Shift < PPMD_PERIOD_BITS && --(p)->Count == 0) \ - { (p)->Summ <<= 1; (p)->Count = (Byte)(3 << (p)->Shift++); } +#define Ppmd_See_Update(p) do { \ + if ((p)->Shift < PPMD_PERIOD_BITS && --(p)->Count == 0) { \ + (p)->Summ <<= 1; \ + (p)->Count = (Byte)(3 << (p)->Shift++); \ + } \ +} while (0) typedef struct { @@ -144,8 +148,12 @@ typedef #endif CPpmd_Byte_Ref; -#define PPMD_SetAllBitsIn256Bytes(p) \ - { unsigned j; for (j = 0; j < 256 / sizeof(p[0]); j += 8) { \ - p[j+7] = p[j+6] = p[j+5] = p[j+4] = p[j+3] = p[j+2] = p[j+1] = p[j+0] = ~(size_t)0; }} +#define PPMD_SetAllBitsIn256Bytes(p) do { \ + unsigned j; \ + for (j = 0; j < 256 / sizeof(p[0]); j += 8) { \ + p[j+7] = p[j+6] = p[j+5] = p[j+4] = \ + p[j+3] = p[j+2] = p[j+1] = p[j+0] = ~(size_t)0; \ + } \ +} while (0) #endif diff --git a/libarchive/archive_read_disk_entry_from_file.c b/libarchive/archive_read_disk_entry_from_file.c index 3a4915eff..19d049770 100644 --- a/libarchive/archive_read_disk_entry_from_file.c +++ b/libarchive/archive_read_disk_entry_from_file.c @@ -888,7 +888,7 @@ setup_sparse_fiemap(struct archive_read_disk *a, count = (sizeof(buff) - sizeof(*fm))/sizeof(*fe); fm = (struct fiemap *)buff; fm->fm_start = 0; - fm->fm_length = ~0ULL;; + fm->fm_length = ~0ULL; fm->fm_flags = FIEMAP_FLAG_SYNC; fm->fm_extent_count = count; do_fiemap = 1; diff --git a/libarchive/archive_read_support_format_7zip.c b/libarchive/archive_read_support_format_7zip.c index 7bc1c6a31..2a099bb4b 100644 --- a/libarchive/archive_read_support_format_7zip.c +++ b/libarchive/archive_read_support_format_7zip.c @@ -4099,8 +4099,17 @@ sparc_Convert(struct _7zip *zip, uint8_t *buf, size_t size) #define RC_READ_BYTE (*buffer++) #define RC_TEST { if (buffer == bufferLim) return SZ_ERROR_DATA; } -#define RC_INIT2 zip->bcj2_code = 0; zip->bcj2_range = 0xFFFFFFFF; \ - { int ii; for (ii = 0; ii < 5; ii++) { RC_TEST; zip->bcj2_code = (zip->bcj2_code << 8) | RC_READ_BYTE; }} +#define RC_INIT2 do { \ + zip->bcj2_code = 0; \ + zip->bcj2_range = 0xFFFFFFFF; \ + { \ + int ii; \ + for (ii = 0; ii < 5; ii++) { \ + RC_TEST; \ + zip->bcj2_code = (zip->bcj2_code << 8) | RC_READ_BYTE; \ + } \ + } \ +} while (0) #define NORMALIZE if (zip->bcj2_range < kTopValue) { RC_TEST; zip->bcj2_range <<= 8; zip->bcj2_code = (zip->bcj2_code << 8) | RC_READ_BYTE; } diff --git a/libarchive/archive_read_support_format_xar.c b/libarchive/archive_read_support_format_xar.c index 8a2197fdf..8084c5a04 100644 --- a/libarchive/archive_read_support_format_xar.c +++ b/libarchive/archive_read_support_format_xar.c @@ -2061,7 +2061,7 @@ xml_start(struct archive_read *a, const char *name, struct xmlattr_list *list) if (xar->file->link > 0) if (add_link(a, xar, xar->file) != ARCHIVE_OK) { return (ARCHIVE_FATAL); - }; + } } } } diff --git a/libarchive/archive_string.c b/libarchive/archive_string.c index abf7ad669..3ac67f37d 100644 --- a/libarchive/archive_string.c +++ b/libarchive/archive_string.c @@ -504,7 +504,7 @@ archive_wstring_append_from_mbs_in_codepage(struct archive_wstring *dest, count = (int)mbsnbytes(s, length); } u16.s = (char *)dest->s; - u16.length = dest->length << 1;; + u16.length = dest->length << 1; u16.buffer_length = dest->buffer_length; if (sc->flag & SCONV_NORMALIZATION_C) ret = archive_string_normalize_C(&u16, s, count, sc); diff --git a/libarchive/archive_write_set_format_zip.c b/libarchive/archive_write_set_format_zip.c index 28cfefaff..b835695a5 100644 --- a/libarchive/archive_write_set_format_zip.c +++ b/libarchive/archive_write_set_format_zip.c @@ -807,7 +807,7 @@ archive_write_zip_header(struct archive_write *a, struct archive_entry *entry) __archive_write_entry_filetype_unsupported( &a->archive, entry, "zip"); return ARCHIVE_FAILED; - }; + } /* If we're not using Zip64, reject large files. */ if (zip->flags & ZIP_FLAG_AVOID_ZIP64) { diff --git a/libarchive/test/test_read_format_rar5.c b/libarchive/test/test_read_format_rar5.c index 8ea1a3cb2..0345b1bed 100644 --- a/libarchive/test/test_read_format_rar5.c +++ b/libarchive/test/test_read_format_rar5.c @@ -1149,7 +1149,7 @@ DEFINE_TEST(test_read_format_rar5_fileattr) assertEqualString("system", archive_entry_fflags_text(ae)); archive_entry_fflags(ae, &set, &clear); #if defined(__FreeBSD__) - flag = UF_SYSTEM;; + flag = UF_SYSTEM; #elif defined(_WIN32) && !defined(CYGWIN) flag = FILE_ATTRIBUTE_SYSTEM; #endif diff --git a/libarchive/test/test_sparse_basic.c b/libarchive/test/test_sparse_basic.c index 963d5e8be..23cde5670 100644 --- a/libarchive/test/test_sparse_basic.c +++ b/libarchive/test/test_sparse_basic.c @@ -198,7 +198,7 @@ is_sparse_supported_fiemap(const char *path) return (0); fm = (struct fiemap *)buff; fm->fm_start = 0; - fm->fm_length = ~0ULL;; + fm->fm_length = ~0ULL; fm->fm_flags = FIEMAP_FLAG_SYNC; fm->fm_extent_count = (sizeof(buff) - sizeof(*fm))/ sizeof(struct fiemap_extent);