diff options
author | nyamatongwe <unknown> | 2004-01-21 09:08:35 +0000 |
---|---|---|
committer | nyamatongwe <unknown> | 2004-01-21 09:08:35 +0000 |
commit | b6249fbd78a4baf646d21d539b7980b9c19dd2b5 (patch) | |
tree | c0091f20ce42680a4e7b9d37e30fd6e8b32e675f | |
parent | ea2e7c10cc227cee9f939d38116c1cd3608d7a1b (diff) | |
download | scintilla-mirror-b6249fbd78a4baf646d21d539b7980b9c19dd2b5.tar.gz |
Implementation of Allocate.
-rw-r--r-- | doc/ScintillaDoc.html | 5 | ||||
-rw-r--r-- | src/CellBuffer.cxx | 4 |
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(<unused>, TextRange *tr)</a><br /> + <a class="message" href="#SCI_ALLOCATE">SCI_ALLOCATE(int bytes, <unused>)</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, <unused>)</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; |