[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[no subject]
From: |
Patrice Dumas |
Date: |
Fri, 4 Oct 2024 06:24:40 -0400 (EDT) |
branch: master
commit 02f6f222519a93fa4fb445358365f66bce83642a
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Mon Aug 12 08:16:01 2024 +0200
* tp/Texinfo/XS/convert/converter.c (retrieve_converter)
(unregister_converter_descriptor),
tp/Texinfo/XS/convert/get_converter_perl_info.c (get_sv_converter),
tp/Texinfo/XS/main/build_perl_info.c: use size_t for converter
descriptor consistently.
* tp/Texinfo/XS/convert/ConvertXS.xs (html_get_target),
tp/Texinfo/XS/convert/convert_html.c (prepare_special_units)
(html_prepare_conversion_units)
(html_prepare_output_units_global_targets)
(html_prepare_units_directions_files),
tp/Texinfo/XS/convert/get_html_perl_info.c (html_find_element_from_sv)
(get_output_units_descriptor_converter_sv)
(element_converter_from_sv), tp/Texinfo/XS/main/build_perl_info.c,
tp/Texinfo/XS/main/converter_types.h (CONVERTER),
tp/Texinfo/XS/main/get_perl_info.c (get_sv_output_units_descriptor)
(get_sv_output_units, find_root_command, find_element_from_sv),
tp/Texinfo/XS/main/output_unit.c (retrieve_output_units)
(split_by_node, split_by_section),
tp/Texinfo/XS/structuring_transfo/StructuringTransfoXS.xs
(split_by_node, split_by_section, rebuild_output_units): use size_t
for output units descriptor consistently.
* tp/Texinfo/XS/convert/converter.c (new_converter, id_to_filename)
(free_comma_index_subentries_tree, find_output_unit_file)
(free_output_unit_files_file), tp/Texinfo/XS/main/output_unit.c
(unsplit, split_pages, units_directions, units_file_directions): use
size_t instead of int where the variable could reach a value outside
of the int range and also when the index is better represented by a
size_t. Cast to/from int and size_t when needed.
---
ChangeLog | 33 ++++++++++++++++++
tp/Texinfo/XS/convert/ConvertXS.xs | 2 +-
tp/Texinfo/XS/convert/convert_html.c | 17 +++++-----
tp/Texinfo/XS/convert/converter.c | 16 ++++-----
tp/Texinfo/XS/convert/converter.h | 4 +--
tp/Texinfo/XS/convert/get_converter_perl_info.c | 6 ++--
tp/Texinfo/XS/convert/get_html_perl_info.c | 8 ++---
tp/Texinfo/XS/convert/get_html_perl_info.h | 6 ++--
tp/Texinfo/XS/main/build_perl_info.c | 6 +++-
tp/Texinfo/XS/main/converter_types.h | 2 +-
tp/Texinfo/XS/main/get_perl_info.c | 19 ++++++-----
tp/Texinfo/XS/main/get_perl_info.h | 6 ++--
tp/Texinfo/XS/main/output_unit.c | 39 +++++++++++-----------
tp/Texinfo/XS/main/output_unit.h | 6 ++--
.../XS/structuring_transfo/StructuringTransfoXS.xs | 6 ++--
15 files changed, 110 insertions(+), 66 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index ec7359bbcb..73462f25fb 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,36 @@
+2024-08-12 Patrice Dumas <pertusus@free.fr>
+
+ * tp/Texinfo/XS/convert/converter.c (retrieve_converter)
+ (unregister_converter_descriptor),
+ tp/Texinfo/XS/convert/get_converter_perl_info.c (get_sv_converter),
+ tp/Texinfo/XS/main/build_perl_info.c: use size_t for converter
+ descriptor consistently.
+
+ * tp/Texinfo/XS/convert/ConvertXS.xs (html_get_target),
+ tp/Texinfo/XS/convert/convert_html.c (prepare_special_units)
+ (html_prepare_conversion_units)
+ (html_prepare_output_units_global_targets)
+ (html_prepare_units_directions_files),
+ tp/Texinfo/XS/convert/get_html_perl_info.c (html_find_element_from_sv)
+ (get_output_units_descriptor_converter_sv)
+ (element_converter_from_sv), tp/Texinfo/XS/main/build_perl_info.c,
+ tp/Texinfo/XS/main/converter_types.h (CONVERTER),
+ tp/Texinfo/XS/main/get_perl_info.c (get_sv_output_units_descriptor)
+ (get_sv_output_units, find_root_command, find_element_from_sv),
+ tp/Texinfo/XS/main/output_unit.c (retrieve_output_units)
+ (split_by_node, split_by_section),
+ tp/Texinfo/XS/structuring_transfo/StructuringTransfoXS.xs
+ (split_by_node, split_by_section, rebuild_output_units): use size_t
+ for output units descriptor consistently.
+
+ * tp/Texinfo/XS/convert/converter.c (new_converter, id_to_filename)
+ (free_comma_index_subentries_tree, find_output_unit_file)
+ (free_output_unit_files_file), tp/Texinfo/XS/main/output_unit.c
+ (unsplit, split_pages, units_directions, units_file_directions): use
+ size_t instead of int where the variable could reach a value outside
+ of the int range and also when the index is better represented by a
+ size_t. Cast to/from int and size_t when needed.
+
2024-08-11 Patrice Dumas <pertusus@free.fr>
* tp/Texinfo/XS/convert/build_html_perl_state.c
diff --git a/tp/Texinfo/XS/convert/ConvertXS.xs
b/tp/Texinfo/XS/convert/ConvertXS.xs
index 3f54463d33..23f1ddd23b 100644
--- a/tp/Texinfo/XS/convert/ConvertXS.xs
+++ b/tp/Texinfo/XS/convert/ConvertXS.xs
@@ -1764,7 +1764,7 @@ html_get_target (SV *converter_in, SV *element_sv)
"html_get_target");
if (self)
{
- int output_units_descriptor
+ size_t output_units_descriptor
= get_output_units_descriptor_converter_sv (converter_in);
const ELEMENT *element;
element = html_find_element_from_sv (self, element_sv,
diff --git a/tp/Texinfo/XS/convert/convert_html.c
b/tp/Texinfo/XS/convert/convert_html.c
index aa7377034f..c4382bc6ac 100644
--- a/tp/Texinfo/XS/convert/convert_html.c
+++ b/tp/Texinfo/XS/convert/convert_html.c
@@ -1564,15 +1564,16 @@ compare_special_units (const void *a, const void *b)
}
void
-prepare_special_units (CONVERTER *self, int output_units_descriptor)
+prepare_special_units (CONVERTER *self, size_t output_units_descriptor)
{
size_t i;
STRING_LIST *special_unit_varieties = &self->special_unit_varieties;
SPECIAL_UNIT_ORDER *special_units_order;
OUTPUT_UNIT *previous_output_unit = 0;
- int special_units_descriptor = new_output_units_descriptor (self->document);
- int associated_special_units_descriptor
+ size_t special_units_descriptor
+ = new_output_units_descriptor (self->document);
+ size_t associated_special_units_descriptor
= new_output_units_descriptor (self->document);
/* retrieve after reallocating */
@@ -1832,7 +1833,7 @@ static const enum command_id conf_for_documentlanguage[]
void
html_prepare_conversion_units (CONVERTER *self)
{
- int output_units_descriptor;
+ size_t output_units_descriptor;
if (self->conf->USE_NODES.o.integer > 0)
output_units_descriptor = split_by_node (self->document);
@@ -5442,7 +5443,7 @@ html_prepare_output_units_global_targets (CONVERTER *self)
const OUTPUT_UNIT *top_output_unit = get_top_unit (self->document,
output_units);
- int special_output_units_lists[2] = {
+ size_t special_output_units_lists[2] = {
self->output_units_descriptors[OUDT_special_units],
self->output_units_descriptors[OUDT_associated_special_units]};
@@ -5529,7 +5530,7 @@ html_prepare_output_units_global_targets (CONVERTER *self)
directions */
for (i = 0; i < 2; i++)
{
- int special_units_descriptor = special_output_units_lists[i];
+ size_t special_units_descriptor = special_output_units_lists[i];
const OUTPUT_UNIT_LIST *units_list
= retrieve_output_units (self->document, special_units_descriptor);
if (units_list && units_list->number)
@@ -5544,7 +5545,7 @@ html_prepare_output_units_global_targets (CONVERTER *self)
s = 0;
for (i = 0; i < 2; i++)
{
- int special_units_descriptor = special_output_units_lists[i];
+ size_t special_units_descriptor = special_output_units_lists[i];
const OUTPUT_UNIT_LIST *units_list
= retrieve_output_units (self->document, special_units_descriptor);
if (units_list && units_list->number)
@@ -6291,7 +6292,7 @@ html_prepare_units_directions_files (CONVERTER *self,
{
size_t i;
FILE_SOURCE_INFO_LIST *files_source_info = 0;
- int external_nodes_units_descriptor
+ size_t external_nodes_units_descriptor
= new_output_units_descriptor (self->document);
OUTPUT_UNIT_LIST *external_node_target_units
= retrieve_output_units (self->document, external_nodes_units_descriptor);
diff --git a/tp/Texinfo/XS/convert/converter.c
b/tp/Texinfo/XS/convert/converter.c
index b643a4fc6b..8222dd4a02 100644
--- a/tp/Texinfo/XS/convert/converter.c
+++ b/tp/Texinfo/XS/convert/converter.c
@@ -183,7 +183,7 @@ find_format_data_index (const char *format)
}
CONVERTER *
-retrieve_converter (int converter_descriptor)
+retrieve_converter (size_t converter_descriptor)
{
if (converter_descriptor <= converter_number
&& converter_list[converter_descriptor -1] != 0)
@@ -221,13 +221,13 @@ init_generic_converter (CONVERTER *self)
/* descriptor starts at 1, 0 is not found or an error */
/* flags set low-level implementation choices, currently using Perl hash
- * map or (slower) string lists */
+ map or (slower) string lists */
size_t
new_converter (enum converter_format format, unsigned long flags)
{
size_t converter_index;
int slot_found = 0;
- int i;
+ size_t i;
CONVERTER *registered_converter;
for (i = 0; i < converter_number; i++)
@@ -372,7 +372,7 @@ destroy_converter_initialization_info
(CONVERTER_INITIALIZATION_INFO *init_info)
}
void
-unregister_converter_descriptor (int converter_descriptor)
+unregister_converter_descriptor (size_t converter_descriptor)
{
CONVERTER *converter = retrieve_converter (converter_descriptor);
if (converter)
@@ -849,7 +849,7 @@ id_to_filename (CONVERTER *self, char **id_ref)
if (self->conf->BASEFILENAME_LENGTH.o.integer < 0)
return;
char *id = *id_ref;
- if (strlen (id) > self->conf->BASEFILENAME_LENGTH.o.integer)
+ if (strlen (id) > (size_t) self->conf->BASEFILENAME_LENGTH.o.integer)
{
id[self->conf->BASEFILENAME_LENGTH.o.integer] = '\0';
}
@@ -1288,7 +1288,7 @@ void
free_comma_index_subentries_tree (ELEMENT_LIST *element_list)
{
/* destroy separator elements */
- int i;
+ size_t i;
for (i = 0; i < element_list->number; i++)
{
ELEMENT *content = element_list->list[i];
@@ -1392,7 +1392,7 @@ find_output_unit_file (const CONVERTER *self, const char
*filename, int *status)
{
const FILE_NAME_PATH_COUNTER_LIST *output_unit_files
= &self->output_unit_files;
- int i;
+ size_t i;
*status = 0;
for (i = 0; i < output_unit_files->number; i++)
@@ -1558,7 +1558,7 @@ set_file_path (CONVERTER *self, const char *filename,
const char *filepath,
static void
free_output_unit_files_file (FILE_NAME_PATH_COUNTER_LIST *output_unit_files)
{
- int i;
+ size_t i;
for (i = 0; i < output_unit_files->number; i++)
{
FILE_NAME_PATH_COUNTER *output_unit_file = &output_unit_files->list[i];
diff --git a/tp/Texinfo/XS/convert/converter.h
b/tp/Texinfo/XS/convert/converter.h
index 18b038de8e..e64374bf93 100644
--- a/tp/Texinfo/XS/convert/converter.h
+++ b/tp/Texinfo/XS/convert/converter.h
@@ -122,9 +122,9 @@ void converter_setup (int texinfo_uninstalled, const char
*tp_builddir,
enum converter_format find_format_data_index (const char *format);
-CONVERTER *retrieve_converter (int converter_descriptor);
+CONVERTER *retrieve_converter (size_t converter_descriptor);
size_t new_converter (enum converter_format format, unsigned long flags);
-void unregister_converter_descriptor (int converter_descriptor);
+void unregister_converter_descriptor (size_t converter_descriptor);
void set_converter_init_information (CONVERTER *converter,
enum converter_format converter_format,
diff --git a/tp/Texinfo/XS/convert/get_converter_perl_info.c
b/tp/Texinfo/XS/convert/get_converter_perl_info.c
index fb490e3ff1..1a1d88f07c 100644
--- a/tp/Texinfo/XS/convert/get_converter_perl_info.c
+++ b/tp/Texinfo/XS/convert/get_converter_perl_info.c
@@ -46,7 +46,7 @@
CONVERTER *
get_sv_converter (SV *sv_in, const char *warn_string)
{
- int converter_descriptor = 0;
+ size_t converter_descriptor = 0;
CONVERTER *converter = 0;
SV** converter_descriptor_sv;
HV *hv_in;
@@ -58,7 +58,7 @@ get_sv_converter (SV *sv_in, const char *warn_string)
converter_descriptor_sv = hv_fetch (hv_in, key, strlen (key), 0);
if (converter_descriptor_sv)
{
- converter_descriptor = SvIV (*converter_descriptor_sv);
+ converter_descriptor = (size_t) SvIV (*converter_descriptor_sv);
converter = retrieve_converter (converter_descriptor);
}
else if (warn_string)
@@ -68,7 +68,7 @@ get_sv_converter (SV *sv_in, const char *warn_string)
}
if (! converter && warn_string)
{
- fprintf (stderr, "ERROR: %s: no converter %d\n", warn_string,
+ fprintf (stderr, "ERROR: %s: no converter %zu\n", warn_string,
converter_descriptor);
}
return converter;
diff --git a/tp/Texinfo/XS/convert/get_html_perl_info.c
b/tp/Texinfo/XS/convert/get_html_perl_info.c
index 54d1814814..ba7a8474ba 100644
--- a/tp/Texinfo/XS/convert/get_html_perl_info.c
+++ b/tp/Texinfo/XS/convert/get_html_perl_info.c
@@ -1558,7 +1558,7 @@ html_get_jslicenses_sv (SV *jslicenses_sv, CONVERTER
*converter)
Only for elements that can be targets of links. */
const ELEMENT *
html_find_element_from_sv (CONVERTER *converter, const SV *element_sv,
- int output_units_descriptor)
+ size_t output_units_descriptor)
{
HV *element_hv;
SV **type_sv;
@@ -1610,7 +1610,7 @@ html_find_element_from_sv (CONVERTER *converter, const SV
*element_sv,
#undef FETCH
/* Not sure if it is generic or HTML specific */
-int
+size_t
get_output_units_descriptor_converter_sv (SV *converter_in)
{
HV *converter_hv;
@@ -1618,7 +1618,7 @@ get_output_units_descriptor_converter_sv (SV
*converter_in)
dTHX;
- int output_units_descriptor = 0;
+ size_t output_units_descriptor = 0;
converter_hv = (HV *) SvRV (converter_in);
@@ -1637,7 +1637,7 @@ const ELEMENT *
element_converter_from_sv (SV *converter_in, const SV *element_sv,
const char *warn_string, CONVERTER **converter_out)
{
- int output_units_descriptor;
+ size_t output_units_descriptor;
*converter_out = get_sv_converter (converter_in, warn_string);
diff --git a/tp/Texinfo/XS/convert/get_html_perl_info.h
b/tp/Texinfo/XS/convert/get_html_perl_info.h
index 36503b10da..f4f4f8fa64 100644
--- a/tp/Texinfo/XS/convert/get_html_perl_info.h
+++ b/tp/Texinfo/XS/convert/get_html_perl_info.h
@@ -2,12 +2,14 @@
#ifndef GET_HTML_PERL_INFO_H
#define GET_HTML_PERL_INFO_H
+#include <stddef.h>
+
#include "EXTERN.h"
#include "perl.h"
#include "convert_html.h"
-int get_output_units_descriptor_converter_sv (SV *converter_in);
+size_t get_output_units_descriptor_converter_sv (SV *converter_in);
void html_converter_init_special_unit_sv (SV *converter_sv,
SV *customized_special_unit_info);
@@ -35,7 +37,7 @@ void html_conversion_initialization_sv (SV *converter_sv,
const ELEMENT *html_find_element_from_sv (CONVERTER *converter,
const SV *element_sv,
- int output_units_descriptor);
+ size_t output_units_descriptor);
const ELEMENT *element_converter_from_sv (SV *converter_in,
const SV *element_sv,
diff --git a/tp/Texinfo/XS/main/build_perl_info.c
b/tp/Texinfo/XS/main/build_perl_info.c
index 5f3bc4e60f..e80eb5e3d8 100644
--- a/tp/Texinfo/XS/main/build_perl_info.c
+++ b/tp/Texinfo/XS/main/build_perl_info.c
@@ -2616,9 +2616,11 @@ fill_output_units_descriptor_av (const DOCUMENT
*document,
}
/* store in the first perl output unit of the list */
+ /* FIXME output_units_descriptor is size_t, there will be an overflow
+ if > max of IV */
hv_store (output_units->list[0]->hv, "output_units_descriptor",
strlen ("output_units_descriptor"),
- newSViv (output_units_descriptor), 0);
+ newSViv ((IV)output_units_descriptor), 0);
return 1;
}
@@ -3120,6 +3122,8 @@ pass_generic_converter_to_converter_sv (SV *converter_sv,
STORE("translated_commands", newRV_noinc ((SV *) translated_commands_hv));
/* store converter_descriptor in perl converter */
+ /* FIXME converter->converter_descriptor is size_t, there will be an overflow
+ if > max of IV */
STORE("converter_descriptor", newSViv ((IV)converter->converter_descriptor));
#undef STORE
diff --git a/tp/Texinfo/XS/main/converter_types.h
b/tp/Texinfo/XS/main/converter_types.h
index f25ed821fd..7c0b069cea 100644
--- a/tp/Texinfo/XS/main/converter_types.h
+++ b/tp/Texinfo/XS/main/converter_types.h
@@ -855,7 +855,7 @@ typedef struct CONVERTER {
const char **direction_unit_direction_name;
/* set for a document */
- int output_units_descriptors[OUDT_external_nodes_units+1];
+ size_t output_units_descriptors[OUDT_external_nodes_units+1];
enum htmlxref_split_type document_htmlxref_split_type;
const OUTPUT_UNIT **global_units_directions;
SPECIAL_UNIT_DIRECTION *special_units_direction_name;
diff --git a/tp/Texinfo/XS/main/get_perl_info.c
b/tp/Texinfo/XS/main/get_perl_info.c
index 1bbce52d04..42ed7cf7c4 100644
--- a/tp/Texinfo/XS/main/get_perl_info.c
+++ b/tp/Texinfo/XS/main/get_perl_info.c
@@ -163,10 +163,10 @@ get_sv_document_document (SV *document_in, char
*warn_string)
}
/* caller should ensure that OUTPUT_UNIT_IN is defined */
-int
+size_t
get_sv_output_units_descriptor (SV *output_units_in, char *warn_string)
{
- int output_units_descriptor = 0;
+ size_t output_units_descriptor = 0;
AV *av_in;
SSize_t output_units_nr;
SV** first_output_unit_sv;
@@ -194,10 +194,11 @@ get_sv_output_units_descriptor (SV *output_units_in, char
*warn_string)
= hv_fetch (hv_in, key, strlen (key), 0);
if (output_units_descriptor_sv)
{
- output_units_descriptor = SvIV (*output_units_descriptor_sv);
+ output_units_descriptor
+ = (size_t) SvIV (*output_units_descriptor_sv);
if (!output_units_descriptor && warn_string)
- fprintf (stderr, "ERROR: %s: units descriptor %d\n",
+ fprintf (stderr, "ERROR: %s: units descriptor %zu\n",
warn_string, output_units_descriptor);
}
else if (warn_string)
@@ -220,13 +221,13 @@ get_sv_output_units (const DOCUMENT *document, SV
*output_units_in,
char *warn_string)
{
OUTPUT_UNIT_LIST *output_units = 0;
- int output_units_descriptor
+ size_t output_units_descriptor
= get_sv_output_units_descriptor (output_units_in, warn_string);
if (output_units_descriptor)
{
output_units = retrieve_output_units (document, output_units_descriptor);
if (!output_units && warn_string)
- fprintf (stderr, "ERROR: %s: no units %d\n", warn_string,
+ fprintf (stderr, "ERROR: %s: no units %zu\n", warn_string,
output_units_descriptor);
}
return output_units;
@@ -1233,9 +1234,9 @@ find_element_extra_index_entry_sv (const DOCUMENT
*document,
#define FETCH(key) key##_sv = hv_fetch (element_hv, #key, strlen (#key), 0);
/* find C tree root element corresponding to perl tree element element_hv */
-const ELEMENT *
+static const ELEMENT *
find_root_command (const DOCUMENT *document, HV *element_hv,
- int output_units_descriptor)
+ size_t output_units_descriptor)
{
SV **associated_unit_sv;
const ELEMENT *root;
@@ -1406,7 +1407,7 @@ find_index_entry_associated_hv (const INDEX_ENTRY
*index_entry,
*/
const ELEMENT *
find_element_from_sv (const CONVERTER *converter, const DOCUMENT *document_in,
- const SV *element_sv, int output_units_descriptor)
+ const SV *element_sv, size_t output_units_descriptor)
{
enum command_id cmd = 0;
HV *element_hv;
diff --git a/tp/Texinfo/XS/main/get_perl_info.h
b/tp/Texinfo/XS/main/get_perl_info.h
index 726579e878..b90c9cc921 100644
--- a/tp/Texinfo/XS/main/get_perl_info.h
+++ b/tp/Texinfo/XS/main/get_perl_info.h
@@ -2,6 +2,8 @@
#ifndef GET_PERL_INFO_H
#define GET_PERL_INFO_H
+#include <stddef.h>
+
#include "EXTERN.h"
#include "perl.h"
@@ -29,7 +31,7 @@ int get_sorted_options_key_sv_option (OPTIONS *options,
OPTION **sorted_options,
DOCUMENT *get_sv_tree_document (SV *tree_in, char *warn_string);
DOCUMENT *get_sv_document_document (SV *document_in, char *warn_string);
-int get_sv_output_units_descriptor (SV *output_units_in, char *warn_string);
+size_t get_sv_output_units_descriptor (SV *output_units_in, char *warn_string);
OUTPUT_UNIT_LIST *get_sv_output_units (const DOCUMENT *document,
SV *output_units_in,
char *warn_string);
@@ -67,7 +69,7 @@ void html_get_direction_icons_sv (const CONVERTER *converter,
const ELEMENT *find_element_from_sv (const CONVERTER *converter,
const DOCUMENT *document_in,
- const SV *element_sv, int output_units_descriptor);
+ const SV *element_sv, size_t
output_units_descriptor);
SV *get_language_document_hv_sorted_indices (HV *document_hv, const char *key,
const char *language, HV **out_sorted_indices_hv);
diff --git a/tp/Texinfo/XS/main/output_unit.c b/tp/Texinfo/XS/main/output_unit.c
index ca81cda113..1dba163069 100644
--- a/tp/Texinfo/XS/main/output_unit.c
+++ b/tp/Texinfo/XS/main/output_unit.c
@@ -50,7 +50,7 @@ const char *relative_unit_direction_name[] = {
OUTPUT_UNIT_LIST *
-retrieve_output_units (const DOCUMENT *document, int output_units_descriptor)
+retrieve_output_units (const DOCUMENT *document, size_t
output_units_descriptor)
{
const OUTPUT_UNIT_LISTS *output_units_lists = &document->output_units_lists;
@@ -79,7 +79,7 @@ new_output_units_descriptor (DOCUMENT *document)
{
size_t output_units_index;
int slot_found = 0;
- int i;
+ size_t i;
OUTPUT_UNIT_LISTS *output_units_lists = &document->output_units_lists;
for (i = 0; i < output_units_lists->number; i++)
@@ -139,16 +139,16 @@ add_to_output_unit_list (OUTPUT_UNIT_LIST *list,
OUTPUT_UNIT *output_unit)
}
/* in addition to splitting, register the output_units list */
-int
+size_t
split_by_node (DOCUMENT *document)
{
const ELEMENT *root = document->tree;
- int output_units_descriptor = new_output_units_descriptor (document);
+ size_t output_units_descriptor = new_output_units_descriptor (document);
OUTPUT_UNIT_LIST *output_units
= retrieve_output_units (document, output_units_descriptor);
OUTPUT_UNIT *current = new_output_unit (OU_unit);
ELEMENT_LIST *pending_parts = new_list ();
- int i;
+ size_t i;
add_to_output_unit_list (output_units, current);
@@ -181,7 +181,7 @@ split_by_node (DOCUMENT *document)
}
if (pending_parts->number > 0)
{
- int j;
+ size_t j;
for (j = 0; j < pending_parts->number; j++)
{
ELEMENT *part = pending_parts->list[j];
@@ -196,7 +196,7 @@ split_by_node (DOCUMENT *document)
if (pending_parts->number > 0)
{
- int j;
+ size_t j;
for (j = 0; j < pending_parts->number; j++)
{
ELEMENT *part = pending_parts->list[j];
@@ -212,15 +212,15 @@ split_by_node (DOCUMENT *document)
}
/* in addition to splitting, register the output_units list */
-int
+size_t
split_by_section (DOCUMENT *document)
{
const ELEMENT *root = document->tree;
- int output_units_descriptor = new_output_units_descriptor (document);
+ size_t output_units_descriptor = new_output_units_descriptor (document);
OUTPUT_UNIT_LIST *output_units
= retrieve_output_units (document, output_units_descriptor);
OUTPUT_UNIT *current = new_output_unit (OU_unit);
- int i;
+ size_t i;
if (root->e.c->contents.number > 0)
document->modified_information |= F_DOCM_tree;
@@ -280,7 +280,7 @@ unsplit (DOCUMENT *document)
{
const ELEMENT *root = document->tree;
int unsplit_needed = 0;
- int i;
+ size_t i;
if (root->type != ET_document_root || root->e.c->contents.number <= 0)
return 0;
@@ -409,6 +409,7 @@ split_pages (OUTPUT_UNIT_LIST *output_units, const char
*split)
{
int split_level = -2;
int i;
+ size_t j;
OUTPUT_UNIT *current_first_in_page = 0;
if (!output_units || !output_units->number)
@@ -416,9 +417,9 @@ split_pages (OUTPUT_UNIT_LIST *output_units, const char
*split)
if (!split || !strlen (split))
{
- for (i = 0; i < output_units->number; i++)
+ for (j = 0; j < output_units->number; j++)
{
- OUTPUT_UNIT *output_unit = output_units->list[i];
+ OUTPUT_UNIT *output_unit = output_units->list[j];
output_unit->first_in_page = output_units->list[0];
}
return;
@@ -438,9 +439,9 @@ split_pages (OUTPUT_UNIT_LIST *output_units, const char
*split)
split_level = -1; /* split by node */
}
- for (i = 0; i < output_units->number; i++)
+ for (j = 0; j < output_units->number; j++)
{
- OUTPUT_UNIT *output_unit = output_units->list[i];
+ OUTPUT_UNIT *output_unit = output_units->list[j];
const ELEMENT *section = output_unit_section (output_unit);
int level = -3;
if (section)
@@ -574,7 +575,7 @@ units_directions (const LABEL_LIST *identifiers_target,
OUTPUT_UNIT_LIST *external_node_target_units,
int print_debug)
{
- int i;
+ size_t i;
ELEMENT_STACK up_list;
ELEMENT *node_top;
@@ -656,7 +657,7 @@ units_directions (const LABEL_LIST *identifiers_target,
while (1)
{
const ELEMENT * const *up_node_directions;
- int i;
+ size_t i;
int in_up = 0;
for (i = 0; i < up_list.top; i++)
if (up == up_list.stack[i])
@@ -841,7 +842,7 @@ units_directions (const LABEL_LIST *identifiers_target,
free (up_list.stack);
if (print_debug > 0)
{
- int i;
+ size_t i;
for (i = 0; i < output_units->number; i++)
{
const OUTPUT_UNIT *output_unit = output_units->list[i];
@@ -856,7 +857,7 @@ units_directions (const LABEL_LIST *identifiers_target,
void
units_file_directions (OUTPUT_UNIT_LIST *output_units)
{
- int i;
+ size_t i;
char *current_filename = 0;
OUTPUT_UNIT *first_unit_in_file = 0;
diff --git a/tp/Texinfo/XS/main/output_unit.h b/tp/Texinfo/XS/main/output_unit.h
index 60362a0864..758812a112 100644
--- a/tp/Texinfo/XS/main/output_unit.h
+++ b/tp/Texinfo/XS/main/output_unit.h
@@ -10,11 +10,11 @@
extern const char *relative_unit_direction_name[];
OUTPUT_UNIT_LIST *retrieve_output_units (const DOCUMENT *document,
- int output_units_descriptor);
+ size_t output_units_descriptor);
size_t new_output_units_descriptor (DOCUMENT *document);
-int split_by_node (DOCUMENT *document);
-int split_by_section (DOCUMENT *document);
+size_t split_by_node (DOCUMENT *document);
+size_t split_by_section (DOCUMENT *document);
int unsplit (DOCUMENT *document);
void split_pages (OUTPUT_UNIT_LIST *output_units, const char *split);
diff --git a/tp/Texinfo/XS/structuring_transfo/StructuringTransfoXS.xs
b/tp/Texinfo/XS/structuring_transfo/StructuringTransfoXS.xs
index 20dbcf1f80..eb984b2db2 100644
--- a/tp/Texinfo/XS/structuring_transfo/StructuringTransfoXS.xs
+++ b/tp/Texinfo/XS/structuring_transfo/StructuringTransfoXS.xs
@@ -392,7 +392,7 @@ split_by_node (SV *document_in)
document = get_sv_document_document (document_in, "split_by_node");
if (document)
{
- int output_units_descriptor = split_by_node (document);
+ size_t output_units_descriptor = split_by_node (document);
RETVAL = build_output_units_list (document,
output_units_descriptor);
}
@@ -409,7 +409,7 @@ split_by_section (SV *document_in)
document = get_sv_document_document (document_in, "split_by_section");
if (document)
{
- int output_units_descriptor = split_by_section (document);
+ size_t output_units_descriptor = split_by_section (document);
RETVAL = build_output_units_list (document,
output_units_descriptor);
}
@@ -436,7 +436,7 @@ void
rebuild_output_units (SV *document_in, SV *output_units_in)
PREINIT:
DOCUMENT *document = 0;
- int output_units_descriptor = 0;
+ size_t output_units_descriptor = 0;
CODE:
document = get_sv_document_document (document_in,
"rebuild_output_units");
- master updated (70e1ef8c5c -> 02f6f22251), Patrice Dumas, 2024/10/04
- [no subject], Patrice Dumas, 2024/10/04
- [no subject], Patrice Dumas, 2024/10/04
- [no subject], Patrice Dumas, 2024/10/04
- [no subject], Patrice Dumas, 2024/10/04
- [no subject],
Patrice Dumas <=
- [no subject], Patrice Dumas, 2024/10/04