[geany/geany] fe1da1: Fix sci_get_contents() buffer length parameter name & doc
Nick Treleaven
git-noreply at geany.org
Wed Nov 21 13:34:37 UTC 2012
Branch: refs/heads/master
Author: Nick Treleaven <nick.treleaven at btinternet.com>
Committer: Nick Treleaven <nick.treleaven at btinternet.com>
Date: Wed, 21 Nov 2012 13:34:37 UTC
Commit: fe1da1891a4a21263c477dbd4c9cbc63d32d466d
https://github.com/geany/geany/commit/fe1da1891a4a21263c477dbd4c9cbc63d32d466d
Log Message:
-----------
Fix sci_get_contents() buffer length parameter name & doc
sci_get_contents() takes buffer length as a parameter, not the
number of characters to copy. Buffer length includes a null byte.
Modified Paths:
--------------
src/sciwrappers.c
src/sciwrappers.h
Modified: src/sciwrappers.c
11 files changed, 5 insertions(+), 6 deletions(-)
===================================================================
@@ -590,18 +590,17 @@ void sci_get_text(ScintillaObject *sci, gint len, gchar *text)
}
-/** Gets all text inside a given text length.
+/** Allocates and fills a buffer with text from the start of the document.
* @param sci Scintilla widget.
- * @param len Length of the text to retrieve from the start of the document,
- * usually sci_get_length() + 1.
+ * @param buffer_len Buffer length to allocate, usually sci_get_length() + 1.
* @return A copy of the text. Should be freed when no longer needed.
*
* @since 0.17
*/
-gchar *sci_get_contents(ScintillaObject *sci, gint len)
+gchar *sci_get_contents(ScintillaObject *sci, gint buffer_len)
{
- gchar *text = g_malloc(len);
- SSM(sci, SCI_GETTEXT, (uptr_t) len, (sptr_t) text);
+ gchar *text = g_malloc(buffer_len);
+ SSM(sci, SCI_GETTEXT, (uptr_t) buffer_len, (sptr_t) text);
return text;
}
Modified: src/sciwrappers.h
2 files changed, 1 insertions(+), 1 deletions(-)
===================================================================
@@ -84,7 +84,7 @@
gint sci_get_length (ScintillaObject *sci);
void sci_get_text (ScintillaObject *sci, gint len, gchar *text);
-gchar* sci_get_contents (ScintillaObject *sci, gint len);
+gchar* sci_get_contents (ScintillaObject *sci, gint buffer_len);
void sci_get_selected_text (ScintillaObject *sci, gchar *text);
gint sci_get_selected_text_length(ScintillaObject *sci);
gchar* sci_get_selection_contents (ScintillaObject *sci);
--------------
This E-Mail was brought to you by github_commit_mail.py (Source: TBD).
More information about the Commits
mailing list