summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStephan Bergmann <sb@openoffice.org>2002-07-09 07:53:12 +0000
committerStephan Bergmann <sb@openoffice.org>2002-07-09 07:53:12 +0000
commit1fac87f84723a3d6e7e13c091e39b09e0dea1aa5 (patch)
tree94602ce8c4c1fd7635893e2d4575ec1dd8be32ab
parent61e62613dce4d1eb2d0f60f3ed4c8aaa29257704 (diff)
#99372# Fixed lcl_ParseText to return the line number instead of 0.
-rw-r--r--basctl/source/basicide/brkdlg.cxx43
1 files changed, 21 insertions, 22 deletions
diff --git a/basctl/source/basicide/brkdlg.cxx b/basctl/source/basicide/brkdlg.cxx
index 11af1fd12883..f41e12163b10 100644
--- a/basctl/source/basicide/brkdlg.cxx
+++ b/basctl/source/basicide/brkdlg.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: brkdlg.cxx,v $
*
- * $Revision: 1.2 $
+ * $Revision: 1.3 $
*
- * last change: $Author: tbe $ $Date: 2001-09-06 09:17:41 $
+ * last change: $Author: sb $ $Date: 2002-07-09 08:53:12 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -59,6 +59,7 @@
*
************************************************************************/
+#include <limits>
#pragma hdrstop
#include <vcl/sound.hxx>
@@ -76,30 +77,28 @@
#endif
#include <sfx2/viewfrm.hxx>
+// FIXME Why does BreakPointDialog allow only USHORT for break-point line
+// numbers, whereas BreakPoint supports ULONG?
-/**************************
- Soll-Aufbau des Strings:
- # <LineNr>
-**************************/
-
-BOOL lcl_ParseText( String aText, USHORT& rLineNr )
+bool lcl_ParseText( String aText, USHORT& rLineNr )
{
- // Blanks ?
- aText.EraseLeadingChars( ' ' );
- if ( !aText.Len() )
- return FALSE;
- if ( aText.GetChar( 0 ) != '#' )
- return FALSE;
- aText.EraseLeadingChars( ' ' );
- if ( !aText.Len() )
- return FALSE;
-
- rLineNr = (USHORT) aText.ToInt32();
- return TRUE;
+ // aText should look like "# n" where
+ // n > 0 && n < std::numeric_limits< USHORT >::max().
+ // All spaces are ignored, so there can even be spaces within the
+ // number n. (Maybe it would be better to ignore all whitespace instead
+ // of just spaces.)
+ aText.EraseAllChars(' ');
+ if (aText.GetChar(0) != '#')
+ return false;
+ aText.Erase(0, 1);
+ // XXX Assumes that USHORT is contained within sal_Int32:
+ sal_Int32 n = aText.ToInt32();
+ if (n <= 0 || n > std::numeric_limits< USHORT >::max())
+ return false;
+ rLineNr = static_cast< USHORT >(n);
+ return true;
}
-
-
BreakPointDialog::BreakPointDialog( Window* pParent, BreakPointList& rBrkPntList ) :
ModalDialog( pParent, IDEResId( RID_BASICIDE_BREAKPOINTDLG ) ),
aComboBox( this, IDEResId( RID_CB_BRKPOINTS ) ),