aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--src/Document.cxx29
-rw-r--r--src/Document.h1
-rw-r--r--src/Editor.h19
3 files changed, 6 insertions, 43 deletions
diff --git a/src/Document.cxx b/src/Document.cxx
index c290c9226..7911ffc58 100644
--- a/src/Document.cxx
+++ b/src/Document.cxx
@@ -1203,35 +1203,6 @@ void Document::Indent(bool forwards, int lineBottom, int lineTop) {
// Convert line endings for a piece of text to a particular mode.
// Stop at len or when a NUL is found.
-// Caller must delete the returned pointer.
-char *Document::TransformLineEnds(int *pLenOut, const char *s, size_t len, int eolModeWanted) {
- char *dest = new char[2 * len + 1];
- const char *sptr = s;
- char *dptr = dest;
- for (size_t i = 0; (i < len) && (*sptr != '\0'); i++) {
- if (*sptr == '\n' || *sptr == '\r') {
- if (eolModeWanted == SC_EOL_CR) {
- *dptr++ = '\r';
- } else if (eolModeWanted == SC_EOL_LF) {
- *dptr++ = '\n';
- } else { // eolModeWanted == SC_EOL_CRLF
- *dptr++ = '\r';
- *dptr++ = '\n';
- }
- if ((*sptr == '\r') && (i+1 < len) && (*(sptr+1) == '\n')) {
- i++;
- sptr++;
- }
- sptr++;
- } else {
- *dptr++ = *sptr++;
- }
- }
- *dptr++ = '\0';
- *pLenOut = (dptr - dest) - 1;
- return dest;
-}
-
std::string Document::TransformLineEnds(const char *s, size_t len, int eolModeWanted) {
std::string dest;
for (size_t i = 0; (i < len) && (s[i]); i++) {
diff --git a/src/Document.h b/src/Document.h
index b14375acc..e6e225e8f 100644
--- a/src/Document.h
+++ b/src/Document.h
@@ -315,7 +315,6 @@ public:
int CountCharacters(int startPos, int endPos);
int FindColumn(int line, int column);
void Indent(bool forwards, int lineBottom, int lineTop);
- static char *TransformLineEnds(int *pLenOut, const char *s, size_t len, int eolModeWanted);
static std::string TransformLineEnds(const char *s, size_t len, int eolModeWanted);
void ConvertLineEnds(int eolModeSet);
void SetReadOnly(bool set) { cb.SetReadOnly(set); }
diff --git a/src/Editor.h b/src/Editor.h
index 51420cf1e..328bed8d0 100644
--- a/src/Editor.h
+++ b/src/Editor.h
@@ -91,20 +91,13 @@ public:
Free();
}
void Free() {
- Set(0, 0, 0, 0, false, false);
- }
- void Set(char *s_, int len_, int codePage_, int characterSet_, bool rectangular_, bool lineCopy_) {
delete []s;
- s = s_;
- if (s)
- len = len_;
- else
- len = 0;
- codePage = codePage_;
- characterSet = characterSet_;
- rectangular = rectangular_;
- lineCopy = lineCopy_;
- FixSelectionForClipboard();
+ s = 0;
+ len = 0;
+ rectangular = false;
+ lineCopy = false;
+ codePage = 0;
+ characterSet = 0;
}
void Copy(const char *s_, int len_, int codePage_, int characterSet_, bool rectangular_, bool lineCopy_) {
delete []s;