[Libreoffice-commits] .: sal/inc sal/qa sal/workben

Christina Rossmanith crossmanith at kemper.freedesktop.org
Sun May 1 08:09:57 PDT 2011


 sal/inc/osl/file.hxx             |   14 ----------
 sal/qa/osl/file/osl_File.cxx     |   54 +++++++++++++++++++--------------------
 sal/qa/osl/module/osl_Module.cxx |    2 -
 sal/workben/testfile.cxx         |   50 ++++++++++++++++++------------------
 4 files changed, 53 insertions(+), 67 deletions(-)

New commits:
commit b8f7ae802e08768e47e2165d09b3733e02f09329
Author: Christina Rossmanith <ChrRossmanith at web.de>
Date:   Wed Apr 20 20:35:58 2011 +0200

    remove Attribute_XXX in favor of osl_File_Attribute_XXX (ure)

diff --git a/sal/inc/osl/file.hxx b/sal/inc/osl/file.hxx
index cba7e54..7ca79ef 100644
--- a/sal/inc/osl/file.hxx
+++ b/sal/inc/osl/file.hxx
@@ -676,20 +676,6 @@ public:
 };
 
 // -----------------------------------------------------------------------------
-
-#define Attribute_ReadOnly     osl_File_Attribute_ReadOnly
-#define Attribute_Hidden       osl_File_Attribute_Hidden
-#define Attribute_Executable   osl_File_Attribute_Executable
-#define Attribute_GrpWrite     osl_File_Attribute_GrpWrite
-#define Attribute_GrpRead      osl_File_Attribute_GrpRead
-#define Attribute_GrpExe       osl_File_Attribute_GrpExe
-#define Attribute_OwnWrite     osl_File_Attribute_OwnWrite
-#define Attribute_OwnRead      osl_File_Attribute_OwnRead
-#define Attribute_OwnExe       osl_File_Attribute_OwnExe
-#define Attribute_OthWrite     osl_File_Attribute_OthWrite
-#define Attribute_OthRead      osl_File_Attribute_OthRead
-#define Attribute_OthExe       osl_File_Attribute_OthExe
-
 class DirectoryItem;
 
 /** The FileStatus class.
diff --git a/sal/qa/osl/file/osl_File.cxx b/sal/qa/osl/file/osl_File.cxx
index 11f8ddc..7388f64 100644
--- a/sal/qa/osl/file/osl_File.cxx
+++ b/sal/qa/osl/file/osl_File.cxx
@@ -147,29 +147,29 @@ inline void printFileType( const ::osl::FileStatus::Type nType )
 inline void printFileAttributes( const sal_Int64 nAttributes )
 {
     printf( "#printFileAttributes# This file is a: (" );
-    if ( ( nAttributes | Attribute_ReadOnly ) == nAttributes )
+    if ( ( nAttributes | osl_File_Attribute_ReadOnly ) == nAttributes )
             printf( " ReadOnly " );
-    if ( ( nAttributes | Attribute_Hidden ) == nAttributes )
+    if ( ( nAttributes | osl_File_Attribute_Hidden ) == nAttributes )
             printf( " Hidden " );
-    if ( ( nAttributes | Attribute_Executable ) == nAttributes )
+    if ( ( nAttributes | osl_File_Attribute_Executable ) == nAttributes )
             printf( " Executable " );
-    if ( ( nAttributes | Attribute_GrpWrite ) == nAttributes )
+    if ( ( nAttributes | osl_File_Attribute_GrpWrite ) == nAttributes )
             printf( " GrpWrite " );
-    if ( ( nAttributes | Attribute_GrpRead ) == nAttributes )
+    if ( ( nAttributes | osl_File_Attribute_GrpRead ) == nAttributes )
             printf( " GrpRead " );
-    if ( ( nAttributes | Attribute_GrpExe ) == nAttributes )
+    if ( ( nAttributes | osl_File_Attribute_GrpExe ) == nAttributes )
             printf( " GrpExe " );
-    if ( ( nAttributes | Attribute_OwnWrite ) == nAttributes )
+    if ( ( nAttributes | osl_File_Attribute_OwnWrite ) == nAttributes )
             printf( " OwnWrite " );
-    if ( ( nAttributes | Attribute_OwnRead ) == nAttributes )
+    if ( ( nAttributes | osl_File_Attribute_OwnRead ) == nAttributes )
             printf( " OwnRead " );
-    if ( ( nAttributes | Attribute_OwnExe ) == nAttributes )
+    if ( ( nAttributes | osl_File_Attribute_OwnExe ) == nAttributes )
             printf( " OwnExe " );
-    if ( ( nAttributes | Attribute_OthWrite ) == nAttributes )
+    if ( ( nAttributes | osl_File_Attribute_OthWrite ) == nAttributes )
             printf( " OthWrite " );
-    if ( ( nAttributes | Attribute_OthRead ) == nAttributes )
+    if ( ( nAttributes | osl_File_Attribute_OthRead ) == nAttributes )
             printf( " OthRead " );
-    if ( ( nAttributes | Attribute_OthExe ) == nAttributes )
+    if ( ( nAttributes | osl_File_Attribute_OthExe ) == nAttributes )
             printf( " OthExe " );
     printf( ") file!\n" );
 }
@@ -394,7 +394,7 @@ inline void deleteTestFile( const ::rtl::OUString filename )
     if ( !isURL( filename ) )
         ::osl::FileBase::getFileURLFromSystemPath( filename, aPathURL ); //convert if not full qualified URL
 
-    nError = ::osl::File::setAttributes( aPathURL, Attribute_GrpWrite| Attribute_OwnWrite| Attribute_OthWrite ); // if readonly, make writtenable.
+    nError = ::osl::File::setAttributes( aPathURL, osl_File_Attribute_GrpWrite| osl_File_Attribute_OwnWrite| osl_File_Attribute_OthWrite ); // if readonly, make writtenable.
     CPPUNIT_ASSERT_MESSAGE( "In deleteTestFile Function: set writtenable ", ( ::osl::FileBase::E_None == nError ) || ( ::osl::FileBase::E_NOENT == nError ) );
 
     nError = ::osl::File::remove( aPathURL );
@@ -2877,7 +2877,7 @@ namespace osl_FileStatus
             CPPUNIT_ASSERT( nError == FileBase::E_None );
 
             CPPUNIT_ASSERT_MESSAGE( "test for getAttributes function: ReadOnly, GrpRead, OwnRead, OthRead( UNX version ) ",
-                                    ( Attribute_ReadOnly | Attribute_GrpRead | Attribute_OwnRead | Attribute_OthRead ) ==
+                                    ( osl_File_Attribute_ReadOnly | osl_File_Attribute_GrpRead | osl_File_Attribute_OwnRead | osl_File_Attribute_OthRead ) ==
                                     rFileStatus.getAttributes( ) );
         }
 #else                                    //Windows version
@@ -2899,7 +2899,7 @@ namespace osl_FileStatus
             CPPUNIT_ASSERT( nError == FileBase::E_None );
 
             CPPUNIT_ASSERT_MESSAGE( "test for getAttributes function: Executable, GrpExe, OwnExe, OthExe, the result is Readonly, Executable, GrpExe, OwnExe, OthExe, it partly not pass( Solaris version )",
-                                    ( Attribute_ReadOnly | Attribute_Executable | Attribute_GrpExe | Attribute_OwnExe | Attribute_OthExe ) ==
+                                    ( osl_File_Attribute_ReadOnly | osl_File_Attribute_Executable | osl_File_Attribute_GrpExe | osl_File_Attribute_OwnExe | osl_File_Attribute_OthExe ) ==
                                     rFileStatus.getAttributes( ) );
 #endif
         }
@@ -2915,7 +2915,7 @@ namespace osl_FileStatus
             CPPUNIT_ASSERT( nError == FileBase::E_None );
 
             CPPUNIT_ASSERT_MESSAGE( "test for getAttributes function: GrpWrite, OwnWrite, OthWrite( Solaris version )",
-                                    ( Attribute_GrpWrite | Attribute_OwnWrite | Attribute_OthWrite ) ==
+                                    ( osl_File_Attribute_GrpWrite | osl_File_Attribute_OwnWrite | osl_File_Attribute_OthWrite ) ==
                                     rFileStatus.getAttributes( ) );
         }
 #else                                    //Windows version
@@ -2929,14 +2929,14 @@ namespace osl_FileStatus
 #if ( defined UNX )                     //hidden file definition may different in Windows
         void getAttributes_004( )
         {
-            sal_Int32 test_Attributes = Attribute_Hidden;
+            sal_Int32 test_Attributes = osl_File_Attribute_Hidden;
               ::osl::FileStatus   rFileStatus( osl_FileStatus_Mask_Attributes );
             nError = rItem_hidden.getFileStatus( rFileStatus );
             CPPUNIT_ASSERT( nError == FileBase::E_None );
             test_Attributes &= rFileStatus.getAttributes( );
 
             CPPUNIT_ASSERT_MESSAGE( "test for getAttributes function: Hidden files( Solaris version )",
-                                    test_Attributes == Attribute_Hidden );
+                                    test_Attributes == osl_File_Attribute_Hidden );
         }
 #else                                    //Windows version
         void getAttributes_004( )
@@ -2949,7 +2949,7 @@ namespace osl_FileStatus
             CPPUNIT_ASSERT( nError == FileBase::E_None );
 
             CPPUNIT_ASSERT_MESSAGE( "Hidden files(Windows version), please check if hidden file c:/AUTOEXEC.BAT exists ",
-                                    (rFileStatus.getAttributes( ) & Attribute_Hidden)!= 0 );
+                                    (rFileStatus.getAttributes( ) & osl_File_Attribute_Hidden)!= 0 );
         }
 #endif
 
@@ -4544,10 +4544,10 @@ namespace osl_File
         // test code.
         void setAttributes_001( )
         {
-        //on windows, only can set 2 attributes: Attribute_ReadOnly,  Attribute_HIDDEN
+        //on windows, only can set 2 attributes: osl_File_Attribute_ReadOnly,  osl_File_Attribute_Hidden
 #ifdef UNX
             //set the file to readonly
-            nError2 = ::osl::File::setAttributes( aTmpName6, Attribute_ReadOnly | Attribute_GrpRead | Attribute_OwnRead | Attribute_OthRead );
+            nError2 = ::osl::File::setAttributes( aTmpName6, osl_File_Attribute_ReadOnly | osl_File_Attribute_GrpRead | osl_File_Attribute_OwnRead | osl_File_Attribute_OthRead );
             CPPUNIT_ASSERT( nError2 == FileBase::E_None);
             nError1 = ::osl::DirectoryItem::get( aTmpName6, rItem );
             CPPUNIT_ASSERT( nError1 == FileBase::E_None);
@@ -4557,11 +4557,11 @@ namespace osl_File
             CPPUNIT_ASSERT( nError1 == FileBase::E_None );
 
             CPPUNIT_ASSERT_MESSAGE( "test for setAttributes function: set file attributes and get it to verify.",
-                                    ( Attribute_ReadOnly | Attribute_GrpRead | Attribute_OwnRead | Attribute_OthRead ) ==
+                                    ( osl_File_Attribute_ReadOnly | osl_File_Attribute_GrpRead | osl_File_Attribute_OwnRead | osl_File_Attribute_OthRead ) ==
                                     rFileStatus.getAttributes( ) );
 #else
             //please see GetFileAttributes
-            nError2 = ::osl::File::setAttributes( aTmpName6, Attribute_ReadOnly );
+            nError2 = ::osl::File::setAttributes( aTmpName6, osl_File_Attribute_ReadOnly );
             CPPUNIT_ASSERT( nError2 == FileBase::E_None);
             nError1 = ::osl::DirectoryItem::get( aTmpName6, rItem );
             CPPUNIT_ASSERT( nError1 == FileBase::E_None);
@@ -4579,7 +4579,7 @@ namespace osl_File
                 printf("has readonly attribute");
             */
             CPPUNIT_ASSERT_MESSAGE( "test for setAttributes function: set file attributes READONLY and get it to verify.",
-                                    (Attribute_ReadOnly & rFileStatus.getAttributes( )) != 0  );
+                                    (osl_File_Attribute_ReadOnly & rFileStatus.getAttributes( )) != 0  );
 #endif
     }
         void setAttributes_002( )
@@ -4587,7 +4587,7 @@ namespace osl_File
         //on UNX, can not set hidden attribute to file, rename file can set the attribute
 #ifdef WNT
             //set the file to hidden
-            nError2 = ::osl::File::setAttributes( aTmpName6, Attribute_Hidden);
+            nError2 = ::osl::File::setAttributes( aTmpName6, osl_File_Attribute_Hidden);
 
             CPPUNIT_ASSERT( nError2 == FileBase::E_None);
             nError1 = ::osl::DirectoryItem::get( aTmpName6, rItem );
@@ -4598,7 +4598,7 @@ namespace osl_File
             CPPUNIT_ASSERT( nError1 == FileBase::E_None );
 
             CPPUNIT_ASSERT_MESSAGE( "test for setAttributes function: set file attributes and get it to verify.",
-                                    (Attribute_Hidden & rFileStatus.getAttributes( )) != 0 );
+                                    (osl_File_Attribute_Hidden & rFileStatus.getAttributes( )) != 0 );
 #endif
         }
 
@@ -4738,7 +4738,7 @@ namespace osl_File
             CPPUNIT_ASSERT_MESSAGE("write failed!", nError1 == FileBase::E_None);
 
             //set the file to readonly
-            nError2 = ::osl::File::setAttributes( aTmpName6, Attribute_ReadOnly | Attribute_GrpRead | Attribute_OwnRead | Attribute_OthRead );
+            nError2 = ::osl::File::setAttributes( aTmpName6, osl_File_Attribute_ReadOnly | osl_File_Attribute_GrpRead | osl_File_Attribute_OwnRead | osl_File_Attribute_OthRead );
             CPPUNIT_ASSERT( nError2 == FileBase::E_None);
 
             nError2 = tmp_file.sync();
diff --git a/sal/qa/osl/module/osl_Module.cxx b/sal/qa/osl/module/osl_Module.cxx
index 85af98a..983cfe7 100644
--- a/sal/qa/osl/module/osl_Module.cxx
+++ b/sal/qa/osl/module/osl_Module.cxx
@@ -148,7 +148,7 @@ inline void deleteTestFile( const ::rtl::OUString filename )
     if ( !isURL( filename ) )
         ::osl::FileBase::getFileURLFromSystemPath( filename, aPathURL ); //convert if not full qualified URL
 
-    nError = ::osl::File::setAttributes( aPathURL, Attribute_GrpWrite| Attribute_OwnWrite| Attribute_OthWrite ); // if readonly, make writtenable.
+    nError = ::osl::File::setAttributes( aPathURL, osl_File_Attribute_GrpWrite| osl_File_Attribute_OwnWrite| osl_File_Attribute_OthWrite ); // if readonly, make writtenable.
     CPPUNIT_ASSERT_MESSAGE( "In deleteTestFile Function: set writtenable ", ( ::osl::FileBase::E_None == nError ) || ( ::osl::FileBase::E_NOENT == nError ) );
 
     nError = ::osl::File::remove( aPathURL );
diff --git a/sal/workben/testfile.cxx b/sal/workben/testfile.cxx
index fb5b0af..3d3a27a 100644
--- a/sal/workben/testfile.cxx
+++ b/sal/workben/testfile.cxx
@@ -354,29 +354,29 @@ void showAttributes( sal_uInt64 uAttributes )
 {
     if ( uAttributes==0 )
         printf( "No Attributes \n" );
-    if ( uAttributes & Attribute_ReadOnly ) 
+    if ( uAttributes & osl_File_Attribute_ReadOnly )
         printf( "Attribute: ReadOnly \n" );
-    if ( uAttributes & Attribute_Hidden )
+    if ( uAttributes & osl_File_Attribute_Hidden )
         printf( "Attribute: Hidden \n" );
-    if ( uAttributes & Attribute_Executable ) 
+    if ( uAttributes & osl_File_Attribute_Executable )
         printf( "Attribute: Executable \n");
-    if ( uAttributes & Attribute_GrpWrite )
+    if ( uAttributes & osl_File_Attribute_GrpWrite )
         printf( "Attribute: GrpWrite \n");
-    if ( uAttributes & Attribute_GrpRead ) 
+    if ( uAttributes & osl_File_Attribute_GrpRead )
         printf( "Attribute: GrpRead \n" );
-    if ( uAttributes & Attribute_GrpExe )
+    if ( uAttributes & osl_File_Attribute_GrpExe )
         printf( "Attribute: GrpExe \n" );
-    if ( uAttributes & Attribute_OwnWrite ) 
+    if ( uAttributes & osl_File_Attribute_OwnWrite )
         printf( "Attribute: OwnWrite \n");
-    if ( uAttributes & Attribute_OwnRead )
+    if ( uAttributes & osl_File_Attribute_OwnRead )
         printf( "Attribute: OwnRead \n" );
-    if ( uAttributes & Attribute_OwnExe )
+    if ( uAttributes & osl_File_Attribute_OwnExe )
         printf( "Attribute: OwnExe \n" );
-    if ( uAttributes & Attribute_OthWrite )
+    if ( uAttributes & osl_File_Attribute_OthWrite )
         printf( "Attribute: OthWrite \n" );
-    if ( uAttributes & Attribute_OthRead )
+    if ( uAttributes & osl_File_Attribute_OthRead )
         printf( "Attribute: OthRead \n");
-    if ( uAttributes & Attribute_OthExe )
+    if ( uAttributes & osl_File_Attribute_OthExe )
         printf( "Attribute: OthExe \n" );
 
     return;
@@ -1278,7 +1278,7 @@ void FileAttributesTest( void )
     printf( "\n\n" );
     
 
-    rc=File::setAttributes( file1, Attribute_GrpWrite );
+    rc=File::setAttributes( file1, osl_File_Attribute_GrpWrite );
     print_error( rtl::OString( "Set Attribute: GrpWrite" ), rc );
     
     verifyFileAttributes();
@@ -1287,7 +1287,7 @@ void FileAttributesTest( void )
     if ( rc!=FileBase::E_None )
         print_error( rtl::OString( "Reset Attributes" ), rc );
 
-    rc=File::setAttributes( file1, Attribute_GrpRead );
+    rc=File::setAttributes( file1, osl_File_Attribute_GrpRead );
     print_error( rtl::OString( "Set Attribute: GrpRead" ), rc );
     
     verifyFileAttributes();
@@ -1296,7 +1296,7 @@ void FileAttributesTest( void )
     if ( rc!=FileBase::E_None )
         print_error( rtl::OString( "Reset Attributes" ), rc );
 
-    rc=File::setAttributes( file1, Attribute_GrpExe );
+    rc=File::setAttributes( file1, osl_File_Attribute_GrpExe );
     print_error( rtl::OString( "Set Attribute: GrpExe" ), rc );
     
     verifyFileAttributes();
@@ -1305,7 +1305,7 @@ void FileAttributesTest( void )
     if ( rc!=FileBase::E_None )
         print_error( rtl::OString( "Reset Attributes" ), rc );
 
-    rc=File::setAttributes( file1, Attribute_OwnWrite );
+    rc=File::setAttributes( file1, osl_File_Attribute_OwnWrite );
     print_error( rtl::OString( "Set Attribute: OwnWrite" ), rc );
     
     verifyFileAttributes();
@@ -1314,7 +1314,7 @@ void FileAttributesTest( void )
     if ( rc!=FileBase::E_None )
         print_error( rtl::OString( "Reset Attributes" ), rc );
 
-    rc=File::setAttributes( file1, Attribute_OwnRead );
+    rc=File::setAttributes( file1, osl_File_Attribute_OwnRead );
     print_error( rtl::OString( "Set Attribute: OwnRead" ), rc );
     
     verifyFileAttributes();
@@ -1323,7 +1323,7 @@ void FileAttributesTest( void )
     if ( rc!=FileBase::E_None )
         print_error( rtl::OString( "Reset Attributes" ), rc );
 
-    rc=File::setAttributes( file1, Attribute_OwnExe );
+    rc=File::setAttributes( file1, osl_File_Attribute_OwnExe );
     print_error( rtl::OString( "Set Attribute: OwnExe" ), rc );
     
     verifyFileAttributes();
@@ -1332,7 +1332,7 @@ void FileAttributesTest( void )
     if ( rc!=FileBase::E_None )
         print_error( rtl::OString( "Reset Attributes" ), rc );
 
-    rc=File::setAttributes( file1, Attribute_OthWrite );
+    rc=File::setAttributes( file1, osl_File_Attribute_OthWrite );
     print_error( rtl::OString( "Set Attribute: OthWrite" ), rc );
     
     verifyFileAttributes();
@@ -1341,7 +1341,7 @@ void FileAttributesTest( void )
     if ( rc!=FileBase::E_None )
         print_error( rtl::OString( "Reset Attributes" ), rc );
 
-    rc=File::setAttributes( file1, Attribute_OthRead );
+    rc=File::setAttributes( file1, osl_File_Attribute_OthRead );
     print_error( rtl::OString( "Set Attribute: OthRead" ), rc );
     
     verifyFileAttributes();
@@ -1350,7 +1350,7 @@ void FileAttributesTest( void )
     if ( rc!=FileBase::E_None )
         print_error( rtl::OString( "Reset Attributes" ), rc );
 
-    rc=File::setAttributes( file1, Attribute_OthExe );
+    rc=File::setAttributes( file1, osl_File_Attribute_OthExe );
     print_error( rtl::OString( "Set Attribute: OthExe" ), rc );
     
     verifyFileAttributes();
@@ -1360,7 +1360,7 @@ void FileAttributesTest( void )
         print_error( rtl::OString( "Reset Attributes" ), rc );
 
 
-    rc=File::setAttributes( file1, Attribute_GrpWrite | Attribute_GrpRead | Attribute_GrpExe | Attribute_OwnWrite | Attribute_OwnRead | Attribute_OwnExe | Attribute_OthWrite | Attribute_OthRead | Attribute_OthExe );
+    rc=File::setAttributes( file1, osl_File_Attribute_GrpWrite | osl_File_Attribute_GrpRead | osl_File_Attribute_GrpExe | osl_File_Attribute_OwnWrite | osl_File_Attribute_OwnRead | osl_File_Attribute_OwnExe | osl_File_Attribute_OthWrite | osl_File_Attribute_OthRead | osl_File_Attribute_OthExe );
     print_error( rtl::OString( "Set all Attributes" ), rc );
 
     verifyFileAttributes();
@@ -1385,7 +1385,7 @@ void FileAttributesTest( void )
     printf( "\n\n" );
     
 
-    rc=File::setAttributes( file1, Attribute_ReadOnly );
+    rc=File::setAttributes( file1, osl_File_Attribute_ReadOnly );
     print_error( rtl::OString( "Set Attribute: ReadOnly" ), rc );
     
     verifyFileAttributes();
@@ -1395,7 +1395,7 @@ void FileAttributesTest( void )
 
     verifyFileAttributes();
 
-    rc=File::setAttributes( file1, Attribute_Hidden );
+    rc=File::setAttributes( file1, osl_File_Attribute_Hidden );
     print_error( rtl::OString( "Set Attribute: Hidden" ), rc );
 
     verifyFileAttributes();
@@ -1405,7 +1405,7 @@ void FileAttributesTest( void )
 
     verifyFileAttributes();
 
-    rc=File::setAttributes( file1, Attribute_Hidden | Attribute_ReadOnly );
+    rc=File::setAttributes( file1, osl_File_Attribute_Hidden | osl_File_Attribute_ReadOnly );
     print_error( rtl::OString( "Set Attribute: Hidden & ReadOnly" ), rc );
 
     verifyFileAttributes();


More information about the Libreoffice-commits mailing list