Change FPDFFont_GetFamilyName() to take/return a size_t

Many other APIs in the same header are using size_t already, so switch
to the type that better represents buffer size. Then the implementation
can do 1 fewer cast.

Change-Id: I629f70c84d22a4ea64633cc82b8b625e56f0bb87
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/121894
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
Reviewed-by: Tom Sepez <tsepez@google.com>
diff --git a/fpdfsdk/fpdf_edittext.cpp b/fpdfsdk/fpdf_edittext.cpp
index 56ea16a..6e9a586 100644
--- a/fpdfsdk/fpdf_edittext.cpp
+++ b/fpdfsdk/fpdf_edittext.cpp
@@ -849,8 +849,9 @@
   return FPDFFontFromCPDFFont(pTextObj->GetFont());
 }
 
-FPDF_EXPORT unsigned long FPDF_CALLCONV
-FPDFFont_GetFamilyName(FPDF_FONT font, char* buffer, unsigned long length) {
+FPDF_EXPORT size_t FPDF_CALLCONV FPDFFont_GetFamilyName(FPDF_FONT font,
+                                                        char* buffer,
+                                                        size_t length) {
   auto* cfont = CPDFFontFromFPDFFont(font);
   if (!cfont) {
     return 0;
@@ -861,7 +862,7 @@
   ByteString name = cfont->GetFont()->GetFamilyName();
   pdfium::span<const char> name_span = name.span_with_terminator();
   fxcrt::try_spancpy(result_span, name_span);
-  return static_cast<unsigned long>(name_span.size());
+  return name_span.size();
 }
 
 FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FPDFFont_GetFontData(FPDF_FONT font,
diff --git a/public/fpdf_edit.h b/public/fpdf_edit.h
index 9669b36..2c758f3 100644
--- a/public/fpdf_edit.h
+++ b/public/fpdf_edit.h
@@ -1377,8 +1377,9 @@
 // Regardless of the platform, the |buffer| is always in UTF-8 encoding.
 // If |length| is less than the returned length, or |buffer| is NULL, |buffer|
 // will not be modified.
-FPDF_EXPORT unsigned long FPDF_CALLCONV
-FPDFFont_GetFamilyName(FPDF_FONT font, char* buffer, unsigned long length);
+FPDF_EXPORT size_t FPDF_CALLCONV FPDFFont_GetFamilyName(FPDF_FONT font,
+                                                        char* buffer,
+                                                        size_t length);
 
 // Experimental API.
 // Get the decoded data from the |font| object.