more consts up for libwpd

Change-Id: I20bcd2efb33e72a7bcce4b3e07d47db05758ea6f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/188274
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
This commit is contained in:
Caolán McNamara
2025-07-24 14:39:13 +02:00
parent 4e3be0db74
commit be780967ed
2 changed files with 94 additions and 0 deletions
+91
View File
@@ -0,0 +1,91 @@
From 91de0fb5350ec0760b144c1d36f07947152d5cd9 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= <caolan.mcnamara@collabora.com>
Date: Thu, 24 Jul 2025 09:41:51 +0100
Subject: [PATCH] const up various arrays
which moves them out of the .data section
---
src/lib/WP1FileStructure.cpp | 2 +-
src/lib/WP1FileStructure.h | 2 +-
src/lib/WP42FileStructure.cpp | 2 +-
src/lib/WP42FileStructure.h | 2 +-
src/lib/WP6FontDescriptorPacket.cpp | 4 ++--
5 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/src/lib/WP1FileStructure.cpp b/src/lib/WP1FileStructure.cpp
index 66512355..74b0129f 100644
--- a/src/lib/WP1FileStructure.cpp
+++ b/src/lib/WP1FileStructure.cpp
@@ -29,7 +29,7 @@
// size of the function groups 0xC0 to 0xFE
// -1 means the size is variable
-int WP1_FUNCTION_GROUP_SIZE[63] =
+const int WP1_FUNCTION_GROUP_SIZE[63] =
{
10, //0xC0
4,
diff --git a/src/lib/WP1FileStructure.h b/src/lib/WP1FileStructure.h
index 51045559..6a4c64b9 100644
--- a/src/lib/WP1FileStructure.h
+++ b/src/lib/WP1FileStructure.h
@@ -29,7 +29,7 @@
#define WP1FILESTRUCTURE_H
// size of the functiongroups 0xC0 to 0xF8
-extern int WP1_FUNCTION_GROUP_SIZE[63];
+extern const int WP1_FUNCTION_GROUP_SIZE[63];
#define WP1_ATTRIBUTE_BOLD 0
#define WP1_ATTRIBUTE_ITALICS 1
diff --git a/src/lib/WP42FileStructure.cpp b/src/lib/WP42FileStructure.cpp
index d90bfb28..162bedd0 100644
--- a/src/lib/WP42FileStructure.cpp
+++ b/src/lib/WP42FileStructure.cpp
@@ -29,7 +29,7 @@
// size of the function groups 0xC0 to 0xFE
// -1 means the size is variable
-int WP42_FUNCTION_GROUP_SIZE[63] =
+const int WP42_FUNCTION_GROUP_SIZE[63] =
{
6, // 0xC0
4,
diff --git a/src/lib/WP42FileStructure.h b/src/lib/WP42FileStructure.h
index 7a38f821..9f4fd82b 100644
--- a/src/lib/WP42FileStructure.h
+++ b/src/lib/WP42FileStructure.h
@@ -29,7 +29,7 @@
#define WP42FILESTRUCTURE_H
// size of the functiongroups 0xC0 to 0xF8
-extern int WP42_FUNCTION_GROUP_SIZE[63];
+extern const int WP42_FUNCTION_GROUP_SIZE[63];
#define WP42_ATTRIBUTE_BOLD 0
#define WP42_ATTRIBUTE_ITALICS 1
diff --git a/src/lib/WP6FontDescriptorPacket.cpp b/src/lib/WP6FontDescriptorPacket.cpp
index 3d22de15..4db818ff 100644
--- a/src/lib/WP6FontDescriptorPacket.cpp
+++ b/src/lib/WP6FontDescriptorPacket.cpp
@@ -29,7 +29,7 @@
#include "libwpd_internal.h"
#include <string>
-const char *FONT_WEIGHT_STRINGS [] = { "Bold", "bold", "Demi", "demi", "Extended", "extended",
+const char* const FONT_WEIGHT_STRINGS [] = { "Bold", "bold", "Demi", "demi", "Extended", "extended",
"Extra", "extra", "Headline", "headline", "Light", "light",
"Medium", "medium", "Normal", "normal", "Regular", "regular",
"Standaard", "standaard", "Standard", "standard"
@@ -118,7 +118,7 @@ void WP6FontDescriptorPacket::_readFontName(librevenge::RVNGInputStream *input,
WPD_DEBUG_MSG(("WordPerfect: stripping font name (original: %s)\n", m_fontName.cstr()));
std::string stringValue(m_fontName.cstr());
std::string::size_type pos;
- for (auto &k : FONT_WEIGHT_STRINGS)
+ for (const auto &k : FONT_WEIGHT_STRINGS)
{
if (!stringValue.empty())
while ((pos = stringValue.find(k)) != std::string::npos)
--
2.49.0
+3
View File
@@ -17,6 +17,8 @@ $(eval $(call gb_UnpackedTarball_update_autoconf_configs,libwpd))
# external/libwpd/0001-const-up-tibetanMap1-to-move-out-of-data-section.patch.1
# upstream effort as: https://sourceforge.net/p/libwpd/code/merge-requests/1/
# external/libwpd/0001-const-up-various-arrays.patch.1
# upstream effort as: https://sourceforge.net/p/libwpd/code/merge-requests/2/
$(eval $(call gb_UnpackedTarball_add_patches,libwpd,\
external/libwpd/libwpd-vs2013.patch.1 \
@@ -24,6 +26,7 @@ $(eval $(call gb_UnpackedTarball_add_patches,libwpd,\
$(if $(SYSTEM_REVENGE),,external/libwpd/rpath.patch) \
external/libwpd/include.patch \
external/libwpd/0001-const-up-tibetanMap1-to-move-out-of-data-section.patch.1 \
external/libwpd/0001-const-up-various-arrays.patch.1 \
))
ifneq ($(OS),MACOSX)