Fix assignment operator return values in agg.

PiperOrigin-RevId: 254824941
Change-Id: Ifb1d03692cfb0ffa46f7c67526bef4207da7d45a
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/56890
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
diff --git a/third_party/agg23/0005-assignment-return-values.patch b/third_party/agg23/0005-assignment-return-values.patch
new file mode 100644
index 0000000..4a0006f
--- /dev/null
+++ b/third_party/agg23/0005-assignment-return-values.patch
@@ -0,0 +1,40 @@
+diff --git a/third_party/agg23/agg_array.h b/third_party/agg23/agg_array.h
+index d521b04..8dcb0af 100644
+--- a/third_party/agg23/agg_array.h
++++ b/third_party/agg23/agg_array.h
+@@ -32,7 +32,7 @@
+     pod_array() : m_size(0), m_capacity(0), m_array(0) {}
+     pod_array(unsigned cap, unsigned extra_tail = 0);
+     pod_array(const pod_array<T>&);
+-    const pod_array<T>& operator = (const pod_array<T>&);
++    pod_array<T>& operator = (const pod_array<T>&);
+     void capacity(unsigned cap, unsigned extra_tail = 0);
+     unsigned capacity() const
+     {
+@@ -144,7 +144,7 @@
+ {
+   memcpy(m_array, v.m_array, sizeof(T) * v.m_size);
+ }
+-template<class T> const pod_array<T>&
++template<class T> pod_array<T>&
+ pod_array<T>::operator = (const pod_array<T>&v)
+ {
+     allocate(v.m_size);
+@@ -166,7 +166,7 @@
+     pod_deque();
+     pod_deque(unsigned block_ptr_inc);
+     pod_deque(const pod_deque<T, S>& v);
+-    const pod_deque<T, S>& operator = (const pod_deque<T, S>& v);
++    pod_deque<T, S>& operator = (const pod_deque<T, S>& v);
+     void remove_all()
+     {
+         m_size = 0;
+@@ -323,7 +323,7 @@
+     }
+ }
+ template<class T, unsigned S>
+-const pod_deque<T, S>& pod_deque<T, S>::operator = (const pod_deque<T, S>& v)
++pod_deque<T, S>& pod_deque<T, S>::operator = (const pod_deque<T, S>& v)
+ {
+     unsigned i;
+     for(i = m_num_blocks; i < v.m_num_blocks; ++i) {
diff --git a/third_party/agg23/README.pdfium b/third_party/agg23/README.pdfium
index fa50951..c6212e2 100644
--- a/third_party/agg23/README.pdfium
+++ b/third_party/agg23/README.pdfium
@@ -18,3 +18,5 @@
 0003-ubsan-render-line-error.patch: Fix UBSan overflow error in render_line.
 0004-ubsan-sweep-scanline-error.patch: Fix UBSan left shift of negative value
 error in sweep_scanline.
+0005-assignment-return-values.patch: Fix assignment operator return values in
+agg_array.h.
diff --git a/third_party/agg23/agg_array.h b/third_party/agg23/agg_array.h
index d521b04..8dcb0af 100644
--- a/third_party/agg23/agg_array.h
+++ b/third_party/agg23/agg_array.h
@@ -32,7 +32,7 @@
     pod_array() : m_size(0), m_capacity(0), m_array(0) {}
     pod_array(unsigned cap, unsigned extra_tail = 0);
     pod_array(const pod_array<T>&);
-    const pod_array<T>& operator = (const pod_array<T>&);
+    pod_array<T>& operator = (const pod_array<T>&);
     void capacity(unsigned cap, unsigned extra_tail = 0);
     unsigned capacity() const
     {
@@ -144,7 +144,7 @@
 {
   memcpy(m_array, v.m_array, sizeof(T) * v.m_size);
 }
-template<class T> const pod_array<T>&
+template<class T> pod_array<T>&
 pod_array<T>::operator = (const pod_array<T>&v)
 {
     allocate(v.m_size);
@@ -166,7 +166,7 @@
     pod_deque();
     pod_deque(unsigned block_ptr_inc);
     pod_deque(const pod_deque<T, S>& v);
-    const pod_deque<T, S>& operator = (const pod_deque<T, S>& v);
+    pod_deque<T, S>& operator = (const pod_deque<T, S>& v);
     void remove_all()
     {
         m_size = 0;
@@ -323,7 +323,7 @@
     }
 }
 template<class T, unsigned S>
-const pod_deque<T, S>& pod_deque<T, S>::operator = (const pod_deque<T, S>& v)
+pod_deque<T, S>& pod_deque<T, S>::operator = (const pod_deque<T, S>& v)
 {
     unsigned i;
     for(i = m_num_blocks; i < v.m_num_blocks; ++i) {