]> git.saurik.com Git - wxWidgets.git/commitdiff
Ensure that endPos > startPos in a couple methods
authorRobin Dunn <robin@alldunn.com>
Thu, 24 Jan 2002 22:47:42 +0000 (22:47 +0000)
committerRobin Dunn <robin@alldunn.com>
Thu, 24 Jan 2002 22:47:42 +0000 (22:47 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@13785 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

contrib/src/stc/gen_iface.py
contrib/src/stc/stc.cpp
src/stc/gen_iface.py
src/stc/stc.cpp

index 04303b82023120d3a0bfe90c9cb79038dd1a9b56..4c7d15bcca5b44982c001f0682e805202806a382 100644 (file)
@@ -86,6 +86,11 @@ methodOverrideMap = {
 
                        '''wxString %s(int startPos, int endPos) {
                           wxString text;
+                          if (endPos < startPos) {
+                              int temp = startPos;
+                              startPos = endPos;
+                              endPos = temp;
+                          }
                           int len = endPos - startPos;
                           if (!len) return "";
                           TextRange tr;
@@ -266,6 +271,11 @@ methodOverrideMap = {
                                 wxRect pageRect) {
                             RangeToFormat fr;
 
+                            if (endPos < startPos) {
+                                int temp = startPos;
+                                startPos = endPos;
+                                endPos = temp;
+                            }
                             fr.hdc = draw;
                             fr.hdcTarget = target;
                             fr.rc.top = renderRect.GetTop();
@@ -324,6 +334,11 @@ methodOverrideMap = {
 
                       '''wxString %s(int startPos, int endPos) {
                             wxString text;
+                            if (endPos < startPos) {
+                                int temp = startPos;
+                                startPos = endPos;
+                                endPos = temp;
+                            }
                             int   len  = endPos - startPos;
                             if (!len) return "";
                             char* buff = text.GetWriteBuf(len);
index b2da83040084c26482feae3a00063325e31a8810..520ebd5cb99d1e59ee6cbbeed5ca14939d7ad4b4 100644 (file)
@@ -276,6 +276,11 @@ void wxStyledTextCtrl::SetSavePoint() {
 // Retrieve a buffer of cells.
 wxString wxStyledTextCtrl::GetStyledText(int startPos, int endPos) {
                           wxString text;
+                          if (endPos < startPos) {
+                              int temp = startPos;
+                              startPos = endPos;
+                              endPos = temp;
+                          }
                           int len = endPos - startPos;
                           if (!len) return "";
                           TextRange tr;
@@ -973,6 +978,11 @@ int wxStyledTextCtrl::FindText(int minPos, int maxPos,
                                 wxRect pageRect) {
                             RangeToFormat fr;
 
+                            if (endPos < startPos) {
+                                int temp = startPos;
+                                startPos = endPos;
+                                endPos = temp;
+                            }
                             fr.hdc = draw;
                             fr.hdcTarget = target;
                             fr.rc.top = renderRect.GetTop();
@@ -1061,6 +1071,11 @@ wxString wxStyledTextCtrl::GetSelectedText() {
 // Retrieve a range of text.
 wxString wxStyledTextCtrl::GetTextRange(int startPos, int endPos) {
                             wxString text;
+                            if (endPos < startPos) {
+                                int temp = startPos;
+                                startPos = endPos;
+                                endPos = temp;
+                            }
                             int   len  = endPos - startPos;
                             if (!len) return "";
                             char* buff = text.GetWriteBuf(len);
index 04303b82023120d3a0bfe90c9cb79038dd1a9b56..4c7d15bcca5b44982c001f0682e805202806a382 100644 (file)
@@ -86,6 +86,11 @@ methodOverrideMap = {
 
                        '''wxString %s(int startPos, int endPos) {
                           wxString text;
+                          if (endPos < startPos) {
+                              int temp = startPos;
+                              startPos = endPos;
+                              endPos = temp;
+                          }
                           int len = endPos - startPos;
                           if (!len) return "";
                           TextRange tr;
@@ -266,6 +271,11 @@ methodOverrideMap = {
                                 wxRect pageRect) {
                             RangeToFormat fr;
 
+                            if (endPos < startPos) {
+                                int temp = startPos;
+                                startPos = endPos;
+                                endPos = temp;
+                            }
                             fr.hdc = draw;
                             fr.hdcTarget = target;
                             fr.rc.top = renderRect.GetTop();
@@ -324,6 +334,11 @@ methodOverrideMap = {
 
                       '''wxString %s(int startPos, int endPos) {
                             wxString text;
+                            if (endPos < startPos) {
+                                int temp = startPos;
+                                startPos = endPos;
+                                endPos = temp;
+                            }
                             int   len  = endPos - startPos;
                             if (!len) return "";
                             char* buff = text.GetWriteBuf(len);
index b2da83040084c26482feae3a00063325e31a8810..520ebd5cb99d1e59ee6cbbeed5ca14939d7ad4b4 100644 (file)
@@ -276,6 +276,11 @@ void wxStyledTextCtrl::SetSavePoint() {
 // Retrieve a buffer of cells.
 wxString wxStyledTextCtrl::GetStyledText(int startPos, int endPos) {
                           wxString text;
+                          if (endPos < startPos) {
+                              int temp = startPos;
+                              startPos = endPos;
+                              endPos = temp;
+                          }
                           int len = endPos - startPos;
                           if (!len) return "";
                           TextRange tr;
@@ -973,6 +978,11 @@ int wxStyledTextCtrl::FindText(int minPos, int maxPos,
                                 wxRect pageRect) {
                             RangeToFormat fr;
 
+                            if (endPos < startPos) {
+                                int temp = startPos;
+                                startPos = endPos;
+                                endPos = temp;
+                            }
                             fr.hdc = draw;
                             fr.hdcTarget = target;
                             fr.rc.top = renderRect.GetTop();
@@ -1061,6 +1071,11 @@ wxString wxStyledTextCtrl::GetSelectedText() {
 // Retrieve a range of text.
 wxString wxStyledTextCtrl::GetTextRange(int startPos, int endPos) {
                             wxString text;
+                            if (endPos < startPos) {
+                                int temp = startPos;
+                                startPos = endPos;
+                                endPos = temp;
+                            }
                             int   len  = endPos - startPos;
                             if (!len) return "";
                             char* buff = text.GetWriteBuf(len);