Commit 05fd1613 for tesseract

commit 05fd1613f74422e8c1ec5f318899fd46981605ad
Author: Stefan Weil <sw@weilnetz.de>
Date:   Sat Jun 20 23:25:59 2026 +0200

    Remove more unused function parameters

    Signed-off-by: Stefan Weil <sw@weilnetz.de>

diff --git a/src/classify/adaptive.cpp b/src/classify/adaptive.cpp
index 1b7bf5fb..e3297c0e 100644
--- a/src/classify/adaptive.cpp
+++ b/src/classify/adaptive.cpp
@@ -45,7 +45,7 @@ void AddAdaptedClass(ADAPT_TEMPLATES_STRUCT *Templates, ADAPT_CLASS_STRUCT *Clas
   assert(UnusedClassIdIn(Templates->Templates, ClassId));
   assert(Class->NumPermConfigs == 0);

-  auto IntClass = new INT_CLASS_STRUCT(1, 1);
+  auto IntClass = new INT_CLASS_STRUCT(1);
   AddIntClass(Templates->Templates, ClassId, IntClass);

   assert(Templates->Class[ClassId] == nullptr);
diff --git a/src/classify/adaptmatch.cpp b/src/classify/adaptmatch.cpp
index 7195dacd..09e9d311 100644
--- a/src/classify/adaptmatch.cpp
+++ b/src/classify/adaptmatch.cpp
@@ -1036,7 +1036,7 @@ void Classify::AddNewResult(const UnicharRating &new_result, ADAPT_RESULTS *resu
  */
 void Classify::AmbigClassifier(const std::vector<INT_FEATURE_STRUCT> &int_features,
                                const INT_FX_RESULT_STRUCT &fx_info, const TBLOB *blob,
-                               INT_TEMPLATES_STRUCT *templates, ADAPT_CLASS_STRUCT **classes,
+                               INT_TEMPLATES_STRUCT *templates,
                                UNICHAR_ID *ambiguities, ADAPT_RESULTS *results) {
   if (int_features.empty()) {
     return;
@@ -1499,7 +1499,7 @@ void Classify::DoAdaptiveMatch(TBLOB *Blob, ADAPT_RESULTS *Results) {
         Results->match.empty()) {
       CharNormClassifier(Blob, *sample, Results);
     } else if (Ambiguities && *Ambiguities >= 0 && !tess_bn_matching) {
-      AmbigClassifier(bl_features, fx_info, Blob, PreTrainedTemplates, AdaptedTemplates->Class,
+      AmbigClassifier(bl_features, fx_info, Blob, PreTrainedTemplates,
                       Ambiguities, Results);
     }
   }
diff --git a/src/classify/blobclass.cpp b/src/classify/blobclass.cpp
index 86663b6a..13759bc9 100644
--- a/src/classify/blobclass.cpp
+++ b/src/classify/blobclass.cpp
@@ -83,7 +83,7 @@ void Classify::LearnBlob(const std::string &fontname, TBLOB *blob, const DENORM
   CharDesc->FeatureSets[2] = ExtractIntCNFeatures(*blob, fx_info);
   CharDesc->FeatureSets[3] = ExtractIntGeoFeatures(*blob, fx_info);

-  if (ValidCharDescription(feature_defs_, CharDesc.get())) {
+  if (ValidCharDescription(CharDesc.get())) {
     // Label the features with a class name and font name.
     tr_file_data_ += "\n";
     tr_file_data_ += fontname;
diff --git a/src/classify/classify.h b/src/classify/classify.h
index 15ab9f67..d54c2bf9 100644
--- a/src/classify/classify.h
+++ b/src/classify/classify.h
@@ -169,7 +169,7 @@ public:
                         ADAPT_TEMPLATES_STRUCT *Templates);
   void AmbigClassifier(const std::vector<INT_FEATURE_STRUCT> &int_features,
                        const INT_FX_RESULT_STRUCT &fx_info, const TBLOB *blob,
-                       INT_TEMPLATES_STRUCT *templates, ADAPT_CLASS_STRUCT **classes, UNICHAR_ID *ambiguities,
+                       INT_TEMPLATES_STRUCT *templates, UNICHAR_ID *ambiguities,
                        ADAPT_RESULTS *results);
   void MasterMatcher(INT_TEMPLATES_STRUCT *templates, int16_t num_features,
                      const INT_FEATURE_STRUCT *features, const uint8_t *norm_factors,
diff --git a/src/classify/cluster.cpp b/src/classify/cluster.cpp
index ed5a8b5d..adce2135 100644
--- a/src/classify/cluster.cpp
+++ b/src/classify/cluster.cpp
@@ -1392,7 +1392,7 @@ static PROTOTYPE *NewEllipticalProto(int16_t N, CLUSTER *Cluster, STATISTICS *St

 static PROTOTYPE *NewMixedProto(int16_t N, CLUSTER *Cluster, STATISTICS *Statistics);

-static PROTOTYPE *NewSimpleProto(int16_t N, CLUSTER *Cluster);
+static PROTOTYPE *NewSimpleProto(CLUSTER *Cluster);

 static bool Independent(PARAM_DESC *ParamDesc, int16_t N, float *CoVariance, float Independence);

@@ -1814,7 +1814,7 @@ static CLUSTER *FindNearestNeighbor(KDTREE *Tree, CLUSTER *Cluster, float *Dista
   CLUSTER *BestNeighbor;

   // find the 2 nearest neighbors of the cluster
-  KDNearestNeighborSearch(Tree, &Cluster->Mean[0], MAXNEIGHBORS, MAXDISTANCE, &NumberOfNeighbors,
+  KDNearestNeighborSearch(Tree, &Cluster->Mean[0], MAXNEIGHBORS, &NumberOfNeighbors,
                           reinterpret_cast<void **>(Neighbor), Dist);

   // search for the nearest neighbor that is not the cluster itself
@@ -2449,7 +2449,7 @@ static STATISTICS *ComputeStatistics(int16_t N, PARAM_DESC ParamDesc[], CLUSTER
 static PROTOTYPE *NewSphericalProto(uint16_t N, CLUSTER *Cluster, STATISTICS *Statistics) {
   PROTOTYPE *Proto;

-  Proto = NewSimpleProto(N, Cluster);
+  Proto = NewSimpleProto(Cluster);

   Proto->Variance.Spherical = Statistics->AvgVariance;
   if (Proto->Variance.Spherical < MINVARIANCE) {
@@ -2479,7 +2479,7 @@ static PROTOTYPE *NewEllipticalProto(int16_t N, CLUSTER *Cluster, STATISTICS *St
   PROTOTYPE *Proto;
   int i;

-  Proto = NewSimpleProto(N, Cluster);
+  Proto = NewSimpleProto(Cluster);
   Proto->Variance.Elliptical = new float[N];
   Proto->Magnitude.Elliptical = new float[N];
   Proto->Weight.Elliptical = new float[N];
@@ -2526,11 +2526,10 @@ static PROTOTYPE *NewMixedProto(int16_t N, CLUSTER *Cluster, STATISTICS *Statist
  * This routine allocates memory to hold a simple prototype
  * data structure, i.e. one without independent distributions
  * and variances for each dimension.
- * @param N number of dimensions
  * @param Cluster cluster to be made into a prototype
  * @return  Pointer to new simple prototype
  */
-static PROTOTYPE *NewSimpleProto(int16_t N, CLUSTER *Cluster) {
+static PROTOTYPE *NewSimpleProto(CLUSTER *Cluster) {
   auto Proto = new PROTOTYPE;
   Proto->Mean = Cluster->Mean;
   Proto->Distrib.clear();
diff --git a/src/classify/featdefs.cpp b/src/classify/featdefs.cpp
index d051faf4..28480c5a 100644
--- a/src/classify/featdefs.cpp
+++ b/src/classify/featdefs.cpp
@@ -128,7 +128,7 @@ void WriteCharDescription(const FEATURE_DEFS_STRUCT &FeatureDefs, CHAR_DESC_STRU

 // Return whether all of the fields of the given feature set
 // are well defined (not inf or nan).
-bool ValidCharDescription(const FEATURE_DEFS_STRUCT &FeatureDefs, CHAR_DESC_STRUCT *CharDesc) {
+bool ValidCharDescription(CHAR_DESC_STRUCT *CharDesc) {
   bool anything_written = false;
   bool well_formed = true;
   for (size_t Type = 0; Type < CharDesc->NumFeatureSets; Type++) {
diff --git a/src/classify/featdefs.h b/src/classify/featdefs.h
index fdfbd08e..b3f60b15 100644
--- a/src/classify/featdefs.h
+++ b/src/classify/featdefs.h
@@ -69,7 +69,7 @@ struct CHAR_DESC_STRUCT {
 TESS_API
 void InitFeatureDefs(FEATURE_DEFS_STRUCT *featuredefs);

-bool ValidCharDescription(const FEATURE_DEFS_STRUCT &FeatureDefs, CHAR_DESC_STRUCT *CharDesc);
+bool ValidCharDescription(CHAR_DESC_STRUCT *CharDesc);

 void WriteCharDescription(const FEATURE_DEFS_STRUCT &FeatureDefs, CHAR_DESC_STRUCT *CharDesc, std::string &str);

diff --git a/src/classify/intproto.cpp b/src/classify/intproto.cpp
index ced6263c..fbd9fe94 100644
--- a/src/classify/intproto.cpp
+++ b/src/classify/intproto.cpp
@@ -506,7 +506,7 @@ INT_TEMPLATES_STRUCT *Classify::CreateIntTemplates(CLASSES FloatProtos,
               target_unicharset.id_to_unichar(ClassId));
     }
     assert(UnusedClassIdIn(IntTemplates, ClassId));
-    IClass = new INT_CLASS_STRUCT(FClass->NumProtos, FClass->NumConfigs);
+    IClass = new INT_CLASS_STRUCT(FClass->NumProtos);
     unsigned fs_size = FClass->font_set.size();
     FontSet fs;
     fs.reserve(fs_size);
@@ -574,13 +574,12 @@ void DisplayIntProto(INT_CLASS_STRUCT *Class, PROTO_ID ProtoId, float Evidence)
 /// to handle the specified number of protos and configs.
 /// @param MaxNumProtos  number of protos to allocate space for
 /// @param MaxNumConfigs number of configs to allocate space for
-INT_CLASS_STRUCT::INT_CLASS_STRUCT(int MaxNumProtos, int MaxNumConfigs) :
+INT_CLASS_STRUCT::INT_CLASS_STRUCT(int MaxNumProtos) :
   NumProtos(0),
   NumProtoSets((MaxNumProtos + PROTOS_PER_PROTO_SET - 1) / PROTOS_PER_PROTO_SET),
   NumConfigs(0),
   ProtoLengths(MaxNumIntProtosIn(this))
 {
-  assert(MaxNumConfigs <= MAX_NUM_CONFIGS);
   assert(NumProtoSets <= MAX_NUM_PROTO_SETS);

   for (int i = 0; i < NumProtoSets; i++) {
@@ -827,7 +826,7 @@ INT_TEMPLATES_STRUCT *Classify::ReadIntTemplates(TFile *fp) {
   if (version_id < 2) {
     /* add an empty nullptr class with class id 0 */
     assert(UnusedClassIdIn(Templates, 0));
-    ClassForClassId(Templates, 0) = new INT_CLASS_STRUCT(1, 1);
+    ClassForClassId(Templates, 0) = new INT_CLASS_STRUCT(1);
     ClassForClassId(Templates, 0)->font_set_id = -1;
     Templates->NumClasses++;
     /* make sure the classes are contiguous */
diff --git a/src/classify/intproto.h b/src/classify/intproto.h
index ef1bd73e..a38d6fe0 100644
--- a/src/classify/intproto.h
+++ b/src/classify/intproto.h
@@ -94,7 +94,7 @@ typedef uint32_t CONFIG_PRUNER[NUM_PP_PARAMS][NUM_PP_BUCKETS][4];

 struct INT_CLASS_STRUCT {
   INT_CLASS_STRUCT() = default;
-  INT_CLASS_STRUCT(int MaxNumProtos, int MaxNumConfigs);
+  INT_CLASS_STRUCT(int MaxNumProtos);
   ~INT_CLASS_STRUCT();
   uint16_t NumProtos = 0;
   uint8_t NumProtoSets = 0;
diff --git a/src/classify/kdtree.cpp b/src/classify/kdtree.cpp
index d5fe1509..f514fb52 100644
--- a/src/classify/kdtree.cpp
+++ b/src/classify/kdtree.cpp
@@ -296,13 +296,12 @@ void KDDelete(KDTREE *Tree, float Key[], void *Data) {
  * @param Tree    ptr to K-D tree to be searched
  * @param Query    ptr to query key (point in D-space)
  * @param QuerySize  number of nearest neighbors to be found
- * @param MaxDistance  all neighbors must be within this distance
  * @param NBuffer ptr to QuerySize buffer to hold nearest neighbors
  * @param DBuffer ptr to QuerySize buffer to hold distances
  *          from nearest neighbor to query point
  * @param NumberOfResults [out] Number of nearest neighbors actually found
  */
-void KDNearestNeighborSearch(KDTREE *Tree, float Query[], int QuerySize, float MaxDistance,
+void KDNearestNeighborSearch(KDTREE *Tree, float Query[], int QuerySize,
                              int *NumberOfResults, void **NBuffer, float DBuffer[]) {
   KDTreeSearch search(Tree, Query, QuerySize);
   search.Search(NumberOfResults, DBuffer, NBuffer);
diff --git a/src/classify/kdtree.h b/src/classify/kdtree.h
index 5a54f9b1..c15ec9ac 100644
--- a/src/classify/kdtree.h
+++ b/src/classify/kdtree.h
@@ -106,7 +106,7 @@ void KDStore(KDTREE *Tree, float *Key, CLUSTER *Data);

 void KDDelete(KDTREE *Tree, float Key[], void *Data);

-void KDNearestNeighborSearch(KDTREE *Tree, float Query[], int QuerySize, float MaxDistance,
+void KDNearestNeighborSearch(KDTREE *Tree, float Query[], int QuerySize,
                              int *NumberOfResults, void **NBuffer, float DBuffer[]);

 void KDWalk(KDTREE *Tree, kdwalk_proc Action, ClusteringContext *context);
diff --git a/src/classify/mfoutline.cpp b/src/classify/mfoutline.cpp
index 219fe501..b3740020 100644
--- a/src/classify/mfoutline.cpp
+++ b/src/classify/mfoutline.cpp
@@ -28,12 +28,32 @@

 namespace tesseract {

+/*---------------------------------------------------------------------------*/
+/**
+ * Convert a tree of outlines to a list of MFOUTLINEs (lists of MFEDGEPTs).
+ *
+ * @param outline      first outline to be converted
+ * @param mf_outlines  list to add converted outlines to
+ */
+static LIST ConvertOutlines(TESSLINE *outline, LIST mf_outlines) {
+  MFOUTLINE mf_outline;
+
+  while (outline != nullptr) {
+    mf_outline = ConvertOutline(outline);
+    if (mf_outline != nullptr) {
+      mf_outlines = push(mf_outlines, mf_outline);
+    }
+    outline = outline->next;
+  }
+  return mf_outlines;
+}
+
 /*---------------------------------------------------------------------------*/
 /** Convert a blob into a list of MFOUTLINEs (float-based microfeature format).
  */
 LIST ConvertBlob(TBLOB *blob) {
   LIST outlines = NIL_LIST;
-  return (blob == nullptr) ? NIL_LIST : ConvertOutlines(blob->outlines, outlines, OUTLINETYPE::outer);
+  return (blob == nullptr) ? NIL_LIST : ConvertOutlines(blob->outlines, outlines);
 }

 /*---------------------------------------------------------------------------*/
@@ -68,27 +88,6 @@ MFOUTLINE ConvertOutline(TESSLINE *outline) {
   return MFOutline;
 }

-/*---------------------------------------------------------------------------*/
-/**
- * Convert a tree of outlines to a list of MFOUTLINEs (lists of MFEDGEPTs).
- *
- * @param outline      first outline to be converted
- * @param mf_outlines  list to add converted outlines to
- * @param outline_type  are the outlines outer or holes?
- */
-LIST ConvertOutlines(TESSLINE *outline, LIST mf_outlines, OUTLINETYPE outline_type) {
-  MFOUTLINE mf_outline;
-
-  while (outline != nullptr) {
-    mf_outline = ConvertOutline(outline);
-    if (mf_outline != nullptr) {
-      mf_outlines = push(mf_outlines, mf_outline);
-    }
-    outline = outline->next;
-  }
-  return mf_outlines;
-}
-
 /*---------------------------------------------------------------------------*/
 /**
  * This routine searches through the specified outline, computes
diff --git a/src/classify/mfoutline.h b/src/classify/mfoutline.h
index 3aa318e7..7201c225 100644
--- a/src/classify/mfoutline.h
+++ b/src/classify/mfoutline.h
@@ -48,8 +48,6 @@ struct MFEDGEPT {
   DIRECTION PreviousDirection;
 };

-enum class OUTLINETYPE { outer, hole };
-
 enum NORM_METHOD { baseline, character };

 /**----------------------------------------------------------------------------
@@ -90,8 +88,6 @@ LIST ConvertBlob(TBLOB *Blob);

 MFOUTLINE ConvertOutline(TESSLINE *Outline);

-LIST ConvertOutlines(TESSLINE *Outline, LIST ConvertedOutlines, OUTLINETYPE OutlineType);
-
 void FilterEdgeNoise(MFOUTLINE Outline, float NoiseSegmentLength);

 void FindDirectionChanges(MFOUTLINE Outline, float MinSlope, float MaxSlope);
diff --git a/src/classify/shapeclassifier.cpp b/src/classify/shapeclassifier.cpp
index 6e34c20d..5e03eaf6 100644
--- a/src/classify/shapeclassifier.cpp
+++ b/src/classify/shapeclassifier.cpp
@@ -55,8 +55,10 @@ int ShapeClassifier::UnicharClassifySample(const TrainingSample &sample, Image p
 // Classifies the given [training] sample, writing to results.
 // See shapeclassifier.h for a full description.
 // Default implementation aborts.
-int ShapeClassifier::ClassifySample(const TrainingSample &sample, Image page_pix, int debug,
-                                    int keep_this, std::vector<ShapeRating> *results) {
+int ShapeClassifier::ClassifySample(const TrainingSample &/*sample*/,
+                                    Image /*page_pix*/, int /*debug*/,
+                                    int /*keep_this*/,
+                                    std::vector<ShapeRating> */*results*/) {
   ASSERT_HOST("Must implement ClassifySample!" == nullptr);
   return 0;
 }
@@ -121,7 +123,7 @@ void ShapeClassifier::DebugDisplay(const TrainingSample &sample, Image page_pix,
     if (unichar_id >= 0) {
       tprintf("Debugging class %d = %s\n", unichar_id, unicharset.id_to_unichar(unichar_id));
       UnicharClassifySample(sample, page_pix, 1, unichar_id, &results);
-      DisplayClassifyAs(sample, page_pix, unichar_id, 1, windows);
+      DisplayClassifyAs(sample, page_pix, unichar_id, 1);
     } else {
       tprintf("Invalid unichar_id: %d\n", unichar_id);
       UnicharClassifySample(sample, page_pix, 1, -1, &results);
@@ -158,9 +160,9 @@ void ShapeClassifier::DebugDisplay(const TrainingSample &sample, Image page_pix,
 // windows to the windows output and returns a new index that may be used
 // by any subsequent classifiers. Caller waits for the user to view and
 // then destroys the windows by clearing the vector.
-int ShapeClassifier::DisplayClassifyAs(const TrainingSample &sample, Image page_pix,
-                                       UNICHAR_ID unichar_id, int index,
-                                       std::vector<ScrollView *> &windows) {
+int ShapeClassifier::DisplayClassifyAs(const TrainingSample &/*sample*/,
+                                       Image /*page_pix*/,
+                                       UNICHAR_ID /*unichar_id*/, int index) {
   // Does nothing in the default implementation.
   return index;
 }
diff --git a/src/classify/shapeclassifier.h b/src/classify/shapeclassifier.h
index 63988b2d..1412765b 100644
--- a/src/classify/shapeclassifier.h
+++ b/src/classify/shapeclassifier.h
@@ -99,7 +99,7 @@ public:
   // by any subsequent classifiers. Caller waits for the user to view and
   // then destroys the windows by clearing the vector.
   virtual int DisplayClassifyAs(const TrainingSample &sample, Image page_pix, UNICHAR_ID unichar_id,
-                                int index, std::vector<ScrollView *> &windows);
+                                int index);

   // Prints debug information on the results. context is some introductory/title
   // message.
diff --git a/src/classify/tessclassifier.cpp b/src/classify/tessclassifier.cpp
index 6bdd8e70..84303d6b 100644
--- a/src/classify/tessclassifier.cpp
+++ b/src/classify/tessclassifier.cpp
@@ -25,7 +25,7 @@ namespace tesseract {

 // Classifies the given [training] sample, writing to results.
 // See ShapeClassifier for a full description.
-int TessClassifier::UnicharClassifySample(const TrainingSample &sample, Image page_pix, int debug,
+int TessClassifier::UnicharClassifySample(const TrainingSample &sample, Image /*page_pix*/, int debug,
                                           UNICHAR_ID keep_this,
                                           std::vector<UnicharRating> *results) {
   const int old_matcher_level = classify_->matcher_debug_level;
@@ -62,8 +62,8 @@ const UNICHARSET &TessClassifier::GetUnicharset() const {
 // windows to the windows output and returns a new index that may be used
 // by any subsequent classifiers. Caller waits for the user to view and
 // then destroys the windows by clearing the vector.
-int TessClassifier::DisplayClassifyAs(const TrainingSample &sample, Image page_pix, int unichar_id,
-                                      int index, std::vector<ScrollView *> &windows) {
+int TessClassifier::DisplayClassifyAs(const TrainingSample &sample, Image /*page_pix*/,
+                                      int unichar_id, int index) {
   int shape_id = unichar_id;
   // TODO(rays) Fix this so it works with both flat and real shapetables.
   //  if (GetShapeTable() != nullptr)
diff --git a/src/classify/tessclassifier.h b/src/classify/tessclassifier.h
index e72d1841..d88d20ef 100644
--- a/src/classify/tessclassifier.h
+++ b/src/classify/tessclassifier.h
@@ -53,8 +53,8 @@ public:
   // windows to the windows output and returns a new index that may be used
   // by any subsequent classifiers. Caller waits for the user to view and
   // then destroys the windows by clearing the vector.
-  int DisplayClassifyAs(const TrainingSample &sample, Image page_pix, int unichar_id, int index,
-                        std::vector<ScrollView *> &windows) override;
+  int DisplayClassifyAs(const TrainingSample &sample, Image page_pix,
+                        int unichar_id, int index) override;

 private:
   // Indicates that this classifier is to use just the ClassPruner, or the