Ensure that endPos > startPos in a couple methods

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@13785 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Robin Dunn 2002-01-24 22:47:42 +00:00
parent 89a2818048
commit e1a93f46d5
4 changed files with 60 additions and 0 deletions

View 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);

View 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);

View 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);

View 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);