summaryrefslogtreecommitdiff
path: root/editeng
diff options
context:
space:
mode:
authorKohei Yoshida <kohei.yoshida@gmail.com>2012-04-13 23:22:57 -0400
committerKohei Yoshida <kohei.yoshida@gmail.com>2012-04-13 23:35:51 -0400
commitb447f763f2739ef57f82183a8ff6af493bf031b2 (patch)
tree089c5902c289c974359cd5135e8cdcf040df708c /editeng
parentf75df5e338af4e109f3bce9ab6c98f681fdd14fa (diff)
EE_APPEND now has to be the max value of size_t.
Diffstat (limited to 'editeng')
-rw-r--r--editeng/Library_editeng.mk1
-rw-r--r--editeng/inc/editeng/editdata.hxx3
-rw-r--r--editeng/source/editeng/editdata.cxx35
-rw-r--r--editeng/source/editeng/editeng.cxx3
4 files changed, 41 insertions, 1 deletions
diff --git a/editeng/Library_editeng.mk b/editeng/Library_editeng.mk
index fb2193eecb99..3645247fc6ab 100644
--- a/editeng/Library_editeng.mk
+++ b/editeng/Library_editeng.mk
@@ -55,6 +55,7 @@ $(eval $(call gb_Library_add_exception_objects,editeng,\
editeng/source/accessibility/AccessibleStaticTextBase \
editeng/source/accessibility/AccessibleStringWrap \
editeng/source/editeng/editattr \
+ editeng/source/editeng/editdata \
editeng/source/editeng/editdbg \
editeng/source/editeng/editdoc \
editeng/source/editeng/editeng \
diff --git a/editeng/inc/editeng/editdata.hxx b/editeng/inc/editeng/editdata.hxx
index 2ac8a996d0bc..f9c88c39930c 100644
--- a/editeng/inc/editeng/editdata.hxx
+++ b/editeng/inc/editeng/editdata.hxx
@@ -52,9 +52,10 @@ enum EVAnchorMode {
#define EE_PARA_NOT_FOUND 0xFFFF
#define EE_PARA_APPEND 0xFFFF
#define EE_PARA_ALL 0xFFFF
-#define EE_APPEND 0xFFFF
#define EE_INDEX_NOT_FOUND 0xFFFF
+extern size_t EE_APPEND;
+
// Error messages for Read / Write Method
#define EE_READWRITE_OK (SVSTREAM_OK)
#define EE_READWRITE_WRONGFORMAT (SVSTREAM_ERRBASE_USER+1)
diff --git a/editeng/source/editeng/editdata.cxx b/editeng/source/editeng/editdata.cxx
new file mode 100644
index 000000000000..2aaa093706ae
--- /dev/null
+++ b/editeng/source/editeng/editdata.cxx
@@ -0,0 +1,35 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * Version: MPL 1.1 / GPLv3+ / LGPLv3+
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License or as specified alternatively below. You may obtain a copy of
+ * the License at http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * Major Contributor(s):
+ * Copyright (C) 2012 Kohei Yoshida <kohei.yoshida@suse.com>
+ *
+ * All Rights Reserved.
+ *
+ * For minor contributions see the git repository.
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 3 or later (the "GPLv3+"), or
+ * the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"),
+ * in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable
+ * instead of those above.
+ */
+
+#include "editeng/editdata.hxx"
+
+#include <limits>
+
+size_t EE_APPEND = std::numeric_limits<size_t>::max();
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/editeng/source/editeng/editeng.cxx b/editeng/source/editeng/editeng.cxx
index f78629f590c2..0adfec132d93 100644
--- a/editeng/source/editeng/editeng.cxx
+++ b/editeng/source/editeng/editeng.cxx
@@ -383,6 +383,9 @@ EditView* EditEngine::RemoveView(size_t nIndex)
{
DBG_CHKTHIS( EditEngine, 0 );
ImpEditEngine::ViewsType& rViews = pImpEditEngine->GetEditViews();
+ if (nIndex >= rViews.size())
+ return NULL;
+
EditView* pView = rViews[nIndex];
if ( pView )
return RemoveView( pView );