Remove <string.h> inclusion from {Byte,Wide}String headers.

Note that <string> (C++) contains the char_traits functions
that replace <string.h> (C) functions.

-- Implement GetStringLength() in string_data_template.

Change-Id: Ib07533584bd5cab87d669f83debdee55df43213a
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/118931
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: Tom Sepez <tsepez@chromium.org>
Reviewed-by: Thomas Sepez <tsepez@google.com>
diff --git a/core/fxcrt/bytestring.h b/core/fxcrt/bytestring.h
index d4ba7bb..d8fb28d 100644
--- a/core/fxcrt/bytestring.h
+++ b/core/fxcrt/bytestring.h
@@ -10,7 +10,6 @@
 #include <stdarg.h>
 #include <stddef.h>
 #include <stdint.h>
-#include <string.h>
 
 #include <functional>
 #include <iosfwd>
diff --git a/core/fxcrt/string_data_template.h b/core/fxcrt/string_data_template.h
index 722c4a4..e84ff5c 100644
--- a/core/fxcrt/string_data_template.h
+++ b/core/fxcrt/string_data_template.h
@@ -10,6 +10,8 @@
 #include <stddef.h>
 #include <stdint.h>
 
+#include <string>
+
 #include "core/fxcrt/retain_ptr.h"
 #include "core/fxcrt/span.h"
 
@@ -67,6 +69,11 @@
     return UNSAFE_BUFFERS(pdfium::make_span(m_String, m_nAllocLength + 1));
   }
 
+  // Return length as determined by the location of the first embedded NUL.
+  size_t GetStringLength() const {
+    return std::char_traits<CharType>::length(m_String);
+  }
+
   // Unlike std::string::front(), this is always safe and returns a
   // NUL char when the string is empty.
   CharType Front() const { return !span().empty() ? span().front() : 0; }
diff --git a/core/fxcrt/string_template.h b/core/fxcrt/string_template.h
index 482f5fb..55e0dc7 100644
--- a/core/fxcrt/string_template.h
+++ b/core/fxcrt/string_template.h
@@ -9,7 +9,6 @@
 
 #include <stddef.h>
 
-#include <string>
 #include <type_traits>
 
 #include "core/fxcrt/compiler_specific.h"
@@ -43,7 +42,7 @@
 
   // Return length as determined by the position of the first NUL.
   size_t GetStringLength() const {
-    return m_pData ? std::char_traits<CharType>::length(m_pData->m_String) : 0;
+    return m_pData ? m_pData->GetStringLength() : 0;
   }
 
   // Explicit conversion to UnsignedType*. May return nullptr.
diff --git a/core/fxcrt/widestring.cpp b/core/fxcrt/widestring.cpp
index 944cb82..60e11f1 100644
--- a/core/fxcrt/widestring.cpp
+++ b/core/fxcrt/widestring.cpp
@@ -8,6 +8,7 @@
 
 #include <stddef.h>
 #include <string.h>
+#include <wchar.h>
 
 #include <algorithm>
 #include <sstream>
diff --git a/core/fxcrt/widestring.h b/core/fxcrt/widestring.h
index 616ff4f..4fabdea 100644
--- a/core/fxcrt/widestring.h
+++ b/core/fxcrt/widestring.h
@@ -10,7 +10,6 @@
 #include <stdarg.h>
 #include <stddef.h>
 #include <stdint.h>
-#include <wchar.h>
 
 #include <functional>
 #include <iosfwd>