Add comments about ByteString::GetBuffer() and ReleaseBuffer().

Document something that may be useful to other readers, as I'd
forgotten this whilst reading an unrelated CL.

-- Do the same for WideString.

Change-Id: I73098b09a778539aceb59de72b7aa94be648a820
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/114055
Commit-Queue: Lei Zhang <thestig@chromium.org>
Commit-Queue: Tom Sepez <tsepez@chromium.org>
Auto-Submit: Tom Sepez <tsepez@chromium.org>
Reviewed-by: Lei Zhang <thestig@chromium.org>
diff --git a/core/fxcrt/bytestring.h b/core/fxcrt/bytestring.h
index 3c23d62..f863087 100644
--- a/core/fxcrt/bytestring.h
+++ b/core/fxcrt/bytestring.h
@@ -164,9 +164,15 @@
 
   void Reserve(size_t len);
 
+  // Increase the backing store of the string so that it is capable of storing
+  // at least `nMinBufLength` chars. Returns a span to the entire buffer,
+  // which may be larger than `nMinBufLength` due to rounding by allocators.
   // Note: any modification of the string (including ReleaseBuffer()) may
   // invalidate the span, which must not outlive its buffer.
   pdfium::span<char> GetBuffer(size_t nMinBufLength);
+
+  // Sets the size of the string to `nNewLength` chars. Call this after a call
+  // to GetBuffer(), to indicate how much of the buffer was actually used.
   void ReleaseBuffer(size_t nNewLength);
 
   ByteString Substr(size_t offset) const;
diff --git a/core/fxcrt/widestring.h b/core/fxcrt/widestring.h
index 0b8d7aa..543b195 100644
--- a/core/fxcrt/widestring.h
+++ b/core/fxcrt/widestring.h
@@ -184,9 +184,15 @@
 
   void Reserve(size_t len);
 
+  // Increase the backing store of the string so that it is capable of storing
+  // at least `nMinBufLength` wchars. Returns a span to the entire buffer,
+  // which may be larger than `nMinBufLength` due to rounding by allocators.
   // Note: any modification of the string (including ReleaseBuffer()) may
   // invalidate the span, which must not outlive its buffer.
   pdfium::span<wchar_t> GetBuffer(size_t nMinBufLength);
+
+  // Sets the size of the string to `nNewLength` wchars. Call this after a call
+  // to GetBuffer(), to indicate how much of the buffer was actually used.
   void ReleaseBuffer(size_t nNewLength);
 
   int GetInteger() const;