aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--doc/ScintillaDoc.html5
-rw-r--r--src/CellBuffer.cxx4
2 files changed, 7 insertions, 2 deletions
diff --git a/doc/ScintillaDoc.html b/doc/ScintillaDoc.html
index eba597118..02aae7c9b 100644
--- a/doc/ScintillaDoc.html
+++ b/doc/ScintillaDoc.html
@@ -292,6 +292,7 @@
<a class="message" href="#SCI_GETREADONLY">SCI_GETREADONLY</a><br />
<a class="message" href="#SCI_GETTEXTRANGE">SCI_GETTEXTRANGE(&lt;unused&gt;, TextRange
*tr)</a><br />
+ <a class="message" href="#SCI_ALLOCATE">SCI_ALLOCATE(int bytes, &lt;unused&gt;)</a><br />
<a class="message" href="#SCI_ADDTEXT">SCI_ADDTEXT(int length, char *s)</a><br />
<a class="message" href="#SCI_ADDSTYLEDTEXT">SCI_ADDSTYLEDTEXT(int length, cell *s)</a><br />
<a class="message" href="#SCI_APPENDTEXT">SCI_APPENDTEXT(int length, const char *s)</a><br />
@@ -396,6 +397,10 @@
href="#SCI_GETTEXTRANGE">SCI_GETTEXTRANGE</a>, <a class="message"
href="#SCI_GETTEXT">SCI_GETTEXT</a></code></p>
+ <p><b id="SCI_ALLOCATE">SCI_ALLOCATE(int bytes, &lt;unused&gt;)</b><br />
+ Allocate a document buffer large enough to store a given number of bytes.
+ The document will not be made smaller than its current contents.</p>
+
<p><b id="SCI_ADDTEXT">SCI_ADDTEXT(int length, const char *s)</b><br />
This inserts the first <code>length</code> characters from the string <code>s</code>
at the current position. This will include any 0's in the string that you might have expected
diff --git a/src/CellBuffer.cxx b/src/CellBuffer.cxx
index f6c1f7b17..27e62ac61 100644
--- a/src/CellBuffer.cxx
+++ b/src/CellBuffer.cxx
@@ -782,10 +782,10 @@ int CellBuffer::Length() {
}
void CellBuffer::Allocate(int newSize) {
- if (newSize > size) {
+ if (newSize > length) {
GapTo(length);
char *newBody = new char[newSize];
- memcpy(newBody, body, size);
+ memcpy(newBody, body, length);
delete []body;
body = newBody;
gaplen += newSize - size;