From eecb6f353695c2554630183c5e5023e5977b3669 Mon Sep 17 00:00:00 2001 From: Eivind Kvedalen Date: Sat, 26 Sep 2015 15:15:58 +0200 Subject: [PATCH] Spreadsheet: Fixed too liberal decoding of cell addresses. --- src/Mod/Spreadsheet/App/Utils.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/Mod/Spreadsheet/App/Utils.cpp b/src/Mod/Spreadsheet/App/Utils.cpp index 74345bb1c..5b50a9fe6 100644 --- a/src/Mod/Spreadsheet/App/Utils.cpp +++ b/src/Mod/Spreadsheet/App/Utils.cpp @@ -110,7 +110,7 @@ int Spreadsheet::decodeColumn(const std::string &colstr) if ((colstr[0] >= 'A' && colstr[0] <= 'Z')) col = colstr[0] - 'A'; else - col = colstr[0] - 'a'; + throw Base::Exception("Invalid column specification"); } else { col = 0; @@ -119,8 +119,6 @@ int Spreadsheet::decodeColumn(const std::string &colstr) if ((*i >= 'A' && *i <= 'Z')) v = *i - 'A'; - else if ((*i >= 'a' && *i <= 'z')) - v = *i - 'a'; else throw Base::Exception("Invalid column specification"); @@ -145,7 +143,7 @@ int Spreadsheet::decodeColumn(const std::string &colstr) Spreadsheet::CellAddress Spreadsheet::stringToAddress(const char * strAddress) { - static const boost::regex e("\\${0,1}([A-Za-z]+)\\${0,1}([0-9]+)"); + static const boost::regex e("\\${0,1}([A-Z]{1,2})\\${0,1}([0-9]{1,5})"); boost::cmatch cm; Q_ASSERT(strAddress != 0);