[Libreoffice-commits] core.git: 5 commits - basic/source codemaker/source compilerplugins/clang connectivity/source dbaccess/source include/basic include/codemaker include/connectivity svx/source

Noel Grandin noel.grandin at collabora.co.uk
Fri Feb 17 05:52:37 UTC 2017


 basic/source/sbx/sbxobj.cxx                        |    4 +-
 basic/source/sbx/sbxvar.cxx                        |   38 ++++++---------------
 codemaker/source/commoncpp/commoncpp.cxx           |    5 +-
 compilerplugins/clang/unusedenumconstants.py       |    5 ++
 connectivity/source/commontools/dbexception.cxx    |   13 -------
 connectivity/source/parse/sqlnode.cxx              |   18 ---------
 dbaccess/source/ui/querydesign/QueryDesignView.cxx |    3 -
 dbaccess/source/ui/querydesign/querycontroller.cxx |   11 ------
 include/basic/sbxdef.hxx                           |    8 +---
 include/basic/sbxvar.hxx                           |    2 -
 include/codemaker/commoncpp.hxx                    |    3 -
 include/connectivity/IParseContext.hxx             |    1 
 include/connectivity/sqlnode.hxx                   |    4 +-
 include/connectivity/standardsqlstate.hxx          |   11 ------
 svx/source/form/ParseContext.cxx                   |    2 -
 15 files changed, 29 insertions(+), 99 deletions(-)

New commits:
commit f1421a3e12167fafc966d069b3a4f7eb84ffda05
Author: Noel Grandin <noel.grandin at collabora.co.uk>
Date:   Thu Feb 16 13:45:37 2017 +0200

    convert SbxNameType to scoped enum
    
    and drop unused enumerators
    
    Change-Id: I2b47828b2146fcda335f1dc1c1f61a1139abbe19

diff --git a/basic/source/sbx/sbxobj.cxx b/basic/source/sbx/sbxobj.cxx
index 69533d9..7763e96 100644
--- a/basic/source/sbx/sbxobj.cxx
+++ b/basic/source/sbx/sbxobj.cxx
@@ -764,7 +764,7 @@ void SbxObject::Dump( SvStream& rStrm, bool bFill )
         SbxVariable* pVar = r.get();
         if( pVar )
         {
-            OUString aLine = aIndent + "  - " + pVar->GetName( SbxNAME_SHORT_TYPES );
+            OUString aLine = aIndent + "  - " + pVar->GetName( SbxNameType::ShortTypes );
             OUString aAttrs2;
             if( CollectAttrs( pVar, aAttrs2 ) )
             {
@@ -801,7 +801,7 @@ void SbxObject::Dump( SvStream& rStrm, bool bFill )
             SbxVariable* pVar = r.get();
             if( pVar )
             {
-                OUString aLine = aIndent + "  - " + pVar->GetName( SbxNAME_SHORT_TYPES );
+                OUString aLine = aIndent + "  - " + pVar->GetName( SbxNameType::ShortTypes );
                 OUString aAttrs3;
                 if( CollectAttrs( pVar, aAttrs3 ) )
                 {
diff --git a/basic/source/sbx/sbxvar.cxx b/basic/source/sbx/sbxvar.cxx
index 097b04c..dcd9694 100644
--- a/basic/source/sbx/sbxvar.cxx
+++ b/basic/source/sbx/sbxvar.cxx
@@ -232,7 +232,7 @@ void SbxVariable::SetName( const OUString& rName )
 const OUString& SbxVariable::GetName( SbxNameType t ) const
 {
     static const char cSuffixes[] = "  %&!#@ $";
-    if( t == SbxNAME_NONE )
+    if( t == SbxNameType::NONE )
     {
         return maName;
     }
@@ -247,7 +247,7 @@ const OUString& SbxVariable::GetName( SbxNameType t ) const
     OUString aTmp( maName );
     // short type? Then fetch it, possible this is 0.
     SbxDataType et = GetType();
-    if( t == SbxNAME_SHORT_TYPES )
+    if( t == SbxNameType::ShortTypes )
     {
         if( et <= SbxSTRING )
         {
@@ -279,7 +279,7 @@ const OUString& SbxVariable::GetName( SbxNameType t ) const
         aTmp += i->aName;
         cType = ' ';
         // short type? Then fetch it, possible this is 0.
-        if( t == SbxNAME_SHORT_TYPES )
+        if( t == SbxNameType::ShortTypes )
         {
             if( nt <= SbxSTRING )
             {
@@ -301,34 +301,18 @@ const OUString& SbxVariable::GetName( SbxNameType t ) const
                 aTmp += "()";
             }
             // long type?
-            if( t != SbxNAME_SHORT )
+            aTmp += GetSbxRes( StringId::As );
+            if( nt < 32 )
             {
-                aTmp += GetSbxRes( StringId::As );
-                if( nt < 32 )
-                {
-                    aTmp += GetSbxRes( static_cast<StringId>( static_cast<int>( StringId::Types ) + nt ) );
-                }
-                else
-                {
-                    aTmp += GetSbxRes( StringId::Any );
-                }
+                aTmp += GetSbxRes( static_cast<StringId>( static_cast<int>( StringId::Types ) + nt ) );
+            }
+            else
+            {
+                aTmp += GetSbxRes( StringId::Any );
             }
         }
     }
     aTmp += ")";
-    // Long type? Then fetch it
-    if( t == SbxNAME_LONG_TYPES && et != SbxEMPTY )
-    {
-        aTmp += GetSbxRes( StringId::As );
-        if( et < 32 )
-        {
-            aTmp += GetSbxRes(  static_cast<StringId>( static_cast<int>( StringId::Types ) + et ) );
-        }
-        else
-        {
-            aTmp += GetSbxRes( StringId::Any );
-        }
-    }
     const_cast<SbxVariable*>(this)->aToolString = aTmp;
     return aToolString;
 }
@@ -699,7 +683,7 @@ void SbxAlias::Notify( SfxBroadcaster&, const SfxHint& rHint )
 
 void SbxVariable::Dump( SvStream& rStrm, bool bFill )
 {
-    OString aBNameStr(OUStringToOString(GetName( SbxNAME_SHORT_TYPES ), RTL_TEXTENCODING_ASCII_US));
+    OString aBNameStr(OUStringToOString(GetName( SbxNameType::ShortTypes ), RTL_TEXTENCODING_ASCII_US));
     rStrm.WriteCharPtr( "Variable( " )
          .WriteCharPtr( OString::number(reinterpret_cast<sal_Int64>(this)).getStr() ).WriteCharPtr( "==" )
          .WriteCharPtr( aBNameStr.getStr() );
diff --git a/compilerplugins/clang/unusedenumconstants.py b/compilerplugins/clang/unusedenumconstants.py
index ec7e732..8188c5a 100755
--- a/compilerplugins/clang/unusedenumconstants.py
+++ b/compilerplugins/clang/unusedenumconstants.py
@@ -114,6 +114,7 @@ for d in definitionSet:
          "sd/source/filter/eppt/epptbase.hxx", # PPTExTextAttr
          "sc/source/filter/inc/tokstack.hxx", # E_TYPE
          "filter/source/graphicfilter/icgm/cgmtypes.hxx",
+         ":basic/source/inc/filefmt.hxx", # FileOffset
         # unit test code
          "cppu/source/uno/check.cxx",
         # general weird nonsense going on
@@ -137,6 +138,9 @@ for d in definitionSet:
          "cppcanvas/source/mtfrenderer/emfpbrush.hxx", # EmfPlusHatchStyle
          "include/filter/msfilter/svdfppt.hxx", # PptPlaceholder, PptSlideLayout
          "include/filter/msfilter/escherex.hxx", # various
+         "basic/source/inc/opcodes.hxx", # SbiOpcode
+         "basic/source/inc/token.hxx", # SbiToken
+         "binaryurp/source/specialfunctionids.hxx", # binaryurp::SpecialFunctionIds
         # Windows or OSX only
          "include/canvas/rendering/icolorbuffer.hxx",
          "include/vcl/commandevent.hxx",
@@ -170,6 +174,7 @@ for d in definitionSet:
          "cui/source/tabpages/tparea.cxx", # FillType (from UI)
          "include/editeng/svxenum.hxx", # css::style::NumberingType
          "include/editeng/bulletitem.hxx", # css::style::NumberingType
+         ":basic/source/sbx/sbxdec.hxx", # SbxDecimal::CmpResult, must match some Windows API
         # represents constants from an external API
          "opencl/inc/opencl_device_selection.h",
          "vcl/inc/sft.hxx",
diff --git a/include/basic/sbxdef.hxx b/include/basic/sbxdef.hxx
index 44c75db..77e3231 100644
--- a/include/basic/sbxdef.hxx
+++ b/include/basic/sbxdef.hxx
@@ -119,11 +119,9 @@ enum SbxOperator {
     SbxGE       // this >= var
 };
 
-enum SbxNameType {          // Type of the questioned name of a variable
-    SbxNAME_NONE,           // plain name
-    SbxNAME_SHORT,          // Name(A,B)
-    SbxNAME_SHORT_TYPES,    // Name%(A%,B$)
-    SbxNAME_LONG_TYPES      // Name(A As Integer, B As String) As Integer
+enum class SbxNameType {          // Type of the questioned name of a variable
+    NONE,           // plain name
+    ShortTypes,     // Name%(A%,B$)
 };
 
 // from 1996/3/20: New error messages
diff --git a/include/basic/sbxvar.hxx b/include/basic/sbxvar.hxx
index 82acb60..4855e09 100644
--- a/include/basic/sbxvar.hxx
+++ b/include/basic/sbxvar.hxx
@@ -249,7 +249,7 @@ public:
     void Dump( SvStream&, bool bDumpAll );
 
     void SetName( const OUString& );
-    const OUString& GetName( SbxNameType = SbxNAME_NONE ) const;
+    const OUString& GetName( SbxNameType = SbxNameType::NONE ) const;
     sal_uInt16 GetHashCode() const          { return nHash; }
 
     virtual void SetModified( bool ) override;
commit fb4bf693999b8a1ebf79bad0d223ae2d4398cf81
Author: Noel Grandin <noel.grandin at collabora.co.uk>
Date:   Thu Feb 16 13:41:29 2017 +0200

    remove unused KeywordsOnly from IdentifierTranslationMode
    
    Change-Id: I7262e618a14fa9e025d269b560da752e3200309d

diff --git a/codemaker/source/commoncpp/commoncpp.cxx b/codemaker/source/commoncpp/commoncpp.cxx
index d2c5915..4f1840c 100644
--- a/codemaker/source/commoncpp/commoncpp.cxx
+++ b/codemaker/source/commoncpp/commoncpp.cxx
@@ -169,8 +169,7 @@ OString translateUnoToCppIdentifier(
         || unoIdentifier == "xor"
         /* unoIdentifier == "xor_eq" */
         // Standard macros:
-        || (transmode != IdentifierTranslationMode::KeywordsOnly
-            && (unoIdentifier == "BUFSIZ"
+        || (unoIdentifier == "BUFSIZ"
                 || unoIdentifier == "CLOCKS_PER_SEC"
                 || unoIdentifier == "EDOM"
                 || unoIdentifier == "EOF"
@@ -264,7 +263,7 @@ OString translateUnoToCppIdentifier(
                 || unoIdentifier == "UCHAR_MAX"
                 || unoIdentifier == "UINT_MAX"
                 || unoIdentifier == "ULONG_MAX"
-                || unoIdentifier == "USHRT_MAX"))
+                || unoIdentifier == "USHRT_MAX")
             || (transmode == IdentifierTranslationMode::Global
                 && (// Standard types:
                     /* unoIdentifier == "clock_t" */
diff --git a/include/codemaker/commoncpp.hxx b/include/codemaker/commoncpp.hxx
index a1a8e91..29e2c9d 100644
--- a/include/codemaker/commoncpp.hxx
+++ b/include/codemaker/commoncpp.hxx
@@ -47,8 +47,7 @@ rtl::OString translateUnoToCppType(
 
 enum class IdentifierTranslationMode {
     Global,
-    NonGlobal,
-    KeywordsOnly
+    NonGlobal
 };
 
 rtl::OString translateUnoToCppIdentifier(
commit 1920061bb2f35df638a638ffebae25245e6ec450
Author: Noel Grandin <noel.grandin at collabora.co.uk>
Date:   Thu Feb 16 13:39:28 2017 +0200

    remove unused None from ErrorCode
    
    Change-Id: Iab5bf1a34fa07c851067fe30df875e821583038b

diff --git a/include/connectivity/IParseContext.hxx b/include/connectivity/IParseContext.hxx
index 53c09f5..7277f42 100644
--- a/include/connectivity/IParseContext.hxx
+++ b/include/connectivity/IParseContext.hxx
@@ -35,7 +35,6 @@ namespace connectivity
     public:
         enum class ErrorCode
         {
-            None      = 0,
             General,                // "Syntax error in SQL expression"
             ValueNoLike,            // "The value #1 can not be used with LIKE."
             FieldNoLike,            // "LIKE can not be used with this field."
diff --git a/svx/source/form/ParseContext.cxx b/svx/source/form/ParseContext.cxx
index b02413e..c5a2654 100644
--- a/svx/source/form/ParseContext.cxx
+++ b/svx/source/form/ParseContext.cxx
@@ -68,7 +68,7 @@ OUString OSystemParseContext::getErrorMessage(ErrorCode _eCode) const
         case ErrorCode::InvalidColumn:         aMsg = SVX_RESSTR(RID_STR_SVT_SQL_SYNTAX_COLUMN); break;
         case ErrorCode::InvalidTableExist:     aMsg = SVX_RESSTR(RID_STR_SVT_SQL_SYNTAX_TABLE_EXISTS); break;
         case ErrorCode::InvalidQueryExist:     aMsg = SVX_RESSTR(RID_STR_SVT_SQL_SYNTAX_QUERY_EXISTS); break;
-        case ErrorCode::None: break;
+        default: break;
     }
     return aMsg;
 }
commit d386abfb09e4add6817cfb3fc8fcb259a2b69705
Author: Noel Grandin <noel.grandin at collabora.co.uk>
Date:   Thu Feb 16 13:36:57 2017 +0200

    remove unused enumerators from SQLNodeType
    
    Change-Id: I0e8a3c5b63a00befa36c7edfbec0acd60bd3dc03

diff --git a/connectivity/source/parse/sqlnode.cxx b/connectivity/source/parse/sqlnode.cxx
index 6ab4a2f..d2e88a9 100644
--- a/connectivity/source/parse/sqlnode.cxx
+++ b/connectivity/source/parse/sqlnode.cxx
@@ -2290,12 +2290,6 @@ void OSQLParseNode::showParseTree( OUStringBuffer& _inout_rBuffer, sal_uInt32 nL
             _inout_rBuffer.append( '\n' );
             break;
 
-        case SQLNodeType::Comparison:
-            _inout_rBuffer.appendAscii( "SQL_COMPARISON: " );
-            _inout_rBuffer.append( m_aNodeValue );
-            _inout_rBuffer.append( '\n' );
-            break;
-
         case SQLNodeType::Name:
             _inout_rBuffer.appendAscii( "SQL_NAME: " );
             _inout_rBuffer.append( '"' );
@@ -2330,12 +2324,6 @@ void OSQLParseNode::showParseTree( OUStringBuffer& _inout_rBuffer, sal_uInt32 nL
             _inout_rBuffer.append( '\n' );
             break;
 
-        case SQLNodeType::AMMSC:
-            _inout_rBuffer.appendAscii( "SQL_AMMSC: " );
-            _inout_rBuffer.append( m_aNodeValue );
-            _inout_rBuffer.append( '\n' );
-            break;
-
         case SQLNodeType::Equal:
         case SQLNodeType::Less:
         case SQLNodeType::Great:
@@ -2352,12 +2340,6 @@ void OSQLParseNode::showParseTree( OUStringBuffer& _inout_rBuffer, sal_uInt32 nL
             _inout_rBuffer.append( '\n' );
             break;
 
-        case SQLNodeType::Date:
-            _inout_rBuffer.appendAscii( "SQL_DATE: " );
-            _inout_rBuffer.append( m_aNodeValue );
-            _inout_rBuffer.append( '\n' );
-            break;
-
         case SQLNodeType::Concat:
             _inout_rBuffer.appendAscii( "||" );
             _inout_rBuffer.append( '\n' );
diff --git a/dbaccess/source/ui/querydesign/QueryDesignView.cxx b/dbaccess/source/ui/querydesign/QueryDesignView.cxx
index 5c8da41..ab12b20 100644
--- a/dbaccess/source/ui/querydesign/QueryDesignView.cxx
+++ b/dbaccess/source/ui/querydesign/QueryDesignView.cxx
@@ -3221,11 +3221,9 @@ void OQueryDesignView::fillFunctionInfo(  const ::connectivity::OSQLParseNode* p
     case SQLNodeType::ApproxNum:
         nDataType = DataType::DOUBLE;
         break;
-    case SQLNodeType::Date:
     case SQLNodeType::AccessDate:
         nDataType = DataType::TIMESTAMP;
         break;
-    case SQLNodeType::Comparison:
     case SQLNodeType::Equal:
     case SQLNodeType::Less:
     case SQLNodeType::Great:
@@ -3238,7 +3236,6 @@ void OQueryDesignView::fillFunctionInfo(  const ::connectivity::OSQLParseNode* p
     case SQLNodeType::ListRule:
     case SQLNodeType::CommaListRule:
     case SQLNodeType::Keyword:
-    case SQLNodeType::AMMSC: //??
     case SQLNodeType::Punctuation:
         OSL_FAIL("Unexpected SQL Node Type");
         break;
diff --git a/dbaccess/source/ui/querydesign/querycontroller.cxx b/dbaccess/source/ui/querydesign/querycontroller.cxx
index 432778a..9351116 100644
--- a/dbaccess/source/ui/querydesign/querycontroller.cxx
+++ b/dbaccess/source/ui/querydesign/querycontroller.cxx
@@ -173,12 +173,6 @@ namespace dbaui
                         rString += OStringToOUString(sT, RTL_TEXTENCODING_UTF8);
                      break;}
 
-                case SQLNodeType::Comparison:
-                    {
-                        rString += "SQL_COMPARISON:" + _pNode->getTokenValue(); // append Nodevalue
-                            // and start new line
-                        break;}
-
                 case SQLNodeType::Name:
                     {
                         rString += "SQL_NAME:\"" + _pNode->getTokenValue() + "\"";
@@ -204,11 +198,6 @@ namespace dbaui
                         rString += "SQL_PUNCTUATION:" + _pNode->getTokenValue(); // append Nodevalue
                         break;}
 
-                case SQLNodeType::AMMSC:
-                    {
-                        rString += "SQL_AMMSC:" + _pNode->getTokenValue(); // append Nodevalue
-                        break;}
-
                 default:
                     OSL_FAIL("OSQLParser::ShowParseTree: unzulaessiger NodeType");
                     rString += _pNode->getTokenValue();
diff --git a/include/connectivity/sqlnode.hxx b/include/connectivity/sqlnode.hxx
index f943942..b7550e5 100644
--- a/include/connectivity/sqlnode.hxx
+++ b/include/connectivity/sqlnode.hxx
@@ -66,10 +66,10 @@ namespace connectivity
     typedef ::std::vector< OSQLParseNode* >                  OSQLParseNodes;
 
     enum class SQLNodeType { Rule, ListRule, CommaListRule,
-                         Keyword, Comparison, Name,
+                         Keyword, Name,
                          String, IntNum, ApproxNum,
                          Equal, Less, Great, LessEq, GreatEq, NotEqual,
-                         Punctuation, AMMSC, AccessDate, Date, Concat};
+                         Punctuation, AccessDate, Concat};
 
     typedef ::std::set< OUString >   QueryNameSet;
 
commit 691e19ec65ef6cbe042f101e05eafaa741c4fca4
Author: Noel Grandin <noel.grandin at collabora.co.uk>
Date:   Thu Feb 16 12:52:23 2017 +0200

    remove unused enumerators from StandardSQLState
    
    Change-Id: Id17c6c0cc41496f494117e781878b15ba2bc0518

diff --git a/connectivity/source/commontools/dbexception.cxx b/connectivity/source/commontools/dbexception.cxx
index 046b753..85a9827 100644
--- a/connectivity/source/commontools/dbexception.cxx
+++ b/connectivity/source/commontools/dbexception.cxx
@@ -472,28 +472,17 @@ OUString getStandardSQLState( StandardSQLState _eState )
 {
     switch ( _eState )
     {
-    case StandardSQLState::WRONG_PARAMETER_NUMBER:    return OUString("07001");
     case StandardSQLState::INVALID_DESCRIPTOR_INDEX:  return OUString("07009");
-    case StandardSQLState::UNABLE_TO_CONNECT:         return OUString("08001");
-    case StandardSQLState::NUMERIC_OUT_OF_RANGE:      return OUString("22003");
-    case StandardSQLState::INVALID_DATE_TIME:         return OUString("22007");
     case StandardSQLState::INVALID_CURSOR_STATE:      return OUString("24000");
-    case StandardSQLState::TABLE_OR_VIEW_EXISTS:      return OUString("42S01");
-    case StandardSQLState::TABLE_OR_VIEW_NOT_FOUND:   return OUString("42S02");
-    case StandardSQLState::INDEX_ESISTS:              return OUString("42S11");
-    case StandardSQLState::INDEX_NOT_FOUND:           return OUString("42S12");
-    case StandardSQLState::COLUMN_EXISTS:             return OUString("42S21");
     case StandardSQLState::COLUMN_NOT_FOUND:          return OUString("42S22");
     case StandardSQLState::GENERAL_ERROR:             return OUString("HY000");
     case StandardSQLState::INVALID_SQL_DATA_TYPE:     return OUString("HY004");
-    case StandardSQLState::OPERATION_CANCELED:        return OUString("HY008");
     case StandardSQLState::FUNCTION_SEQUENCE_ERROR:   return OUString("HY010");
     case StandardSQLState::INVALID_CURSOR_POSITION:   return OUString("HY109");
-    case StandardSQLState::INVALID_BOOKMARK_VALUE:    return OUString("HY111");
     case StandardSQLState::FEATURE_NOT_IMPLEMENTED:   return OUString("HYC00");
     case StandardSQLState::FUNCTION_NOT_SUPPORTED:    return OUString("IM001");
     case StandardSQLState::CONNECTION_DOES_NOT_EXIST: return OUString("08003");
-    default:                            return OUString("HY001"); // General Error
+    default:                                          return OUString("HY001"); // General Error
     }
 }
 
diff --git a/include/connectivity/standardsqlstate.hxx b/include/connectivity/standardsqlstate.hxx
index 9af461d..9ddf0c8 100644
--- a/include/connectivity/standardsqlstate.hxx
+++ b/include/connectivity/standardsqlstate.hxx
@@ -33,24 +33,13 @@ namespace dbtools
     */
     enum class StandardSQLState
     {
-        WRONG_PARAMETER_NUMBER,     // 07001
         INVALID_DESCRIPTOR_INDEX,   // 07009
-        UNABLE_TO_CONNECT,          // 08001
-        NUMERIC_OUT_OF_RANGE,       // 22003
-        INVALID_DATE_TIME,          // 22007
         INVALID_CURSOR_STATE,       // 24000
-        TABLE_OR_VIEW_EXISTS,       // 42S01
-        TABLE_OR_VIEW_NOT_FOUND,    // 42S02
-        INDEX_ESISTS,               // 42S11
-        INDEX_NOT_FOUND,            // 42S12
-        COLUMN_EXISTS,              // 42S21
         COLUMN_NOT_FOUND,           // 42S22
         GENERAL_ERROR,              // HY000
         INVALID_SQL_DATA_TYPE,      // HY004
-        OPERATION_CANCELED,         // HY008
         FUNCTION_SEQUENCE_ERROR,    // HY010
         INVALID_CURSOR_POSITION,    // HY109
-        INVALID_BOOKMARK_VALUE,     // HY111
         FEATURE_NOT_IMPLEMENTED,    // HYC00
         FUNCTION_NOT_SUPPORTED,     // IM001
         CONNECTION_DOES_NOT_EXIST,  // 08003


More information about the Libreoffice-commits mailing list