[Libreoffice-commits] .: 4 commits - fpicker/source

Tor Lillqvist tml at kemper.freedesktop.org
Wed Sep 28 15:06:37 PDT 2011


 fpicker/source/aqua/AquaFilePickerDelegate.mm |    3 +
 fpicker/source/aqua/CFStringUtilities.cxx     |   30 ++++++++++--------
 fpicker/source/aqua/FilterHelper.cxx          |   15 +++++++++
 fpicker/source/aqua/NSString_OOoAdditions.mm  |    3 +
 fpicker/source/aqua/NSURL_OOoAdditions.mm     |   43 +++++++++++++++-----------
 fpicker/source/aqua/SalAquaFilePicker.cxx     |    9 ++++-
 fpicker/source/aqua/SalAquaPicker.cxx         |   12 ++++---
 7 files changed, 78 insertions(+), 37 deletions(-)

New commits:
commit 78f81fdadbb2e1f461e8dd3edd2e79f139f94206
Author: Tor Lillqvist <tml at iki.fi>
Date:   Thu Sep 29 00:36:50 2011 +0300

    WaE: 'fileAttributesAtPath:traverseLink:' is deprecated

diff --git a/fpicker/source/aqua/FilterHelper.cxx b/fpicker/source/aqua/FilterHelper.cxx
index c0a5909..d1f5a7d 100644
--- a/fpicker/source/aqua/FilterHelper.cxx
+++ b/fpicker/source/aqua/FilterHelper.cxx
@@ -386,6 +386,17 @@ throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::
     DBG_PRINT_EXIT(CLASS_NAME, __func__);
 }
 
+// 'fileAttributesAtPath:traverseLink:' is deprecated 
+#if defined LIBO_WERROR && defined __GNUC__
+#define GCC_VERSION (__GNUC__ * 10000 \
+                     + __GNUC_MINOR__ * 100 \
+                     + __GNUC_PATCHLEVEL__)
+#if GCC_VERSION >= 40201
+#pragma GCC diagnostic warning "-Wdeprecated-declarations"
+#define DID_TURN_OFF_DEPRECATED_DECLARATIONS_WARNING
+#endif
+#endif
+
 sal_Bool FilterHelper::filenameMatchesFilter(NSString* sFilename)
 {
     DBG_PRINT_ENTRY(CLASS_NAME, __func__);
@@ -442,6 +453,10 @@ sal_Bool FilterHelper::filenameMatchesFilter(NSString* sFilename)
     return sal_False;
 }
 
+#ifdef DID_TURN_OFF_DEPRECATED_DECLARATIONS_WARNING
+#pragma GCC diagnostic error "-Wdeprecated-declarations"
+#endif
+
 FilterList* FilterHelper::getFilterList() {
     DBG_PRINT_ENTRY(CLASS_NAME, __func__);
     DBG_PRINT_EXIT(CLASS_NAME, __func__);
commit 17cc38231c743b33406c5184488d1831930dfc3b
Author: Tor Lillqvist <tml at iki.fi>
Date:   Thu Sep 29 00:32:57 2011 +0300

    Add mode lines

diff --git a/fpicker/source/aqua/AquaFilePickerDelegate.mm b/fpicker/source/aqua/AquaFilePickerDelegate.mm
index d5c9062..2fef707 100644
--- a/fpicker/source/aqua/AquaFilePickerDelegate.mm
+++ b/fpicker/source/aqua/AquaFilePickerDelegate.mm
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
 /*************************************************************************
  *
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -121,3 +122,5 @@
 }
 
 @end
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/fpicker/source/aqua/NSString_OOoAdditions.mm b/fpicker/source/aqua/NSString_OOoAdditions.mm
index 6707cff..86be0a6 100644
--- a/fpicker/source/aqua/NSString_OOoAdditions.mm
+++ b/fpicker/source/aqua/NSString_OOoAdditions.mm
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
 /*************************************************************************
  *
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -75,3 +76,5 @@
 }
 
 @end
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/fpicker/source/aqua/NSURL_OOoAdditions.mm b/fpicker/source/aqua/NSURL_OOoAdditions.mm
index e5d5aaa..5e76426 100644
--- a/fpicker/source/aqua/NSURL_OOoAdditions.mm
+++ b/fpicker/source/aqua/NSURL_OOoAdditions.mm
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
 /*************************************************************************
  *
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -114,3 +115,5 @@ NSString* resolveAlias( NSString* i_pSystemPath )
     
     return pResolvedPath;
 }
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
commit e41899b782a165adc12966e07398c38e8c73711c
Author: Tor Lillqvist <tml at iki.fi>
Date:   Thu Sep 29 00:24:29 2011 +0300

    WaE: class 'AquaFilePickerDelegate' does not implement the 'NSOpenSavePanelDelegate' protocol

diff --git a/fpicker/source/aqua/SalAquaFilePicker.cxx b/fpicker/source/aqua/SalAquaFilePicker.cxx
index 12846f5..2788da4 100644
--- a/fpicker/source/aqua/SalAquaFilePicker.cxx
+++ b/fpicker/source/aqua/SalAquaFilePicker.cxx
@@ -57,6 +57,7 @@
 
 #include "SalAquaFilePicker.hxx"
 
+#include <objc/objc-runtime.h>
 
 #pragma mark DEFINES
 
@@ -224,7 +225,13 @@ sal_Int16 SAL_CALL SalAquaFilePicker::execute() throw( uno::RuntimeException )
     }
 
     //Set the delegate to be notified of certain events
-    [m_pDialog setDelegate:m_pDelegate];
+
+    // I don't know why, but with gcc 4.2.1, this line results in the warning:
+    // class 'AquaFilePickerDelegate' does not implement the 'NSOpenSavePanelDelegate' protocol
+    // So instead of:
+    // [m_pDialog setDelegate:m_pDelegate];
+    // do:
+    objc_msgSend(m_pDialog, @selector(setDelegate:), m_pDelegate);
 
     int nStatus = runandwaitforresult();
 
commit 15759b8c9423c8f3fd0be97566698bf94535875a
Author: Tor Lillqvist <tml at iki.fi>
Date:   Thu Sep 29 00:17:38 2011 +0300

    Avoid "jump to case label crosses initialization" errors with gcc 4.2.1
    
    Reduce scope of variables declared inside a switch statement. OK, so
    make those code snippets into blocks then, to reduce the scope of
    those variables. Workaround for weird errors as reported by gcc 4.2.1
    in the 10.6 SDK:
    
    SalAquaPicker.cxx: In member function 'void SalAquaPicker::implInitialize()':
    SalAquaPicker.cxx:134: error: jump to case label
    SalAquaPicker.cxx:127: error:   crosses initialization of 'NSNumber* pExtn'
    SalAquaPicker.cxx:126: error:   crosses initialization of 'NSUserDefaults* pDefaults'
    SalAquaPicker.cxx:141: error: jump to case label
    SalAquaPicker.cxx:127: error:   crosses initialization of 'NSNumber* pExtn'
    SalAquaPicker.cxx:126: error:   crosses initialization of 'NSUserDefaults* pDefaults'

diff --git a/fpicker/source/aqua/CFStringUtilities.cxx b/fpicker/source/aqua/CFStringUtilities.cxx
index 7d9293d..da624fe 100644
--- a/fpicker/source/aqua/CFStringUtilities.cxx
+++ b/fpicker/source/aqua/CFStringUtilities.cxx
@@ -92,21 +92,25 @@ rtl::OUString CFURLRefToOUString(CFURLRef aUrlRef, InfoType info)
             CFRetain(sURLString);
             break;
         case FILENAME:
-            OSL_TRACE("Extracting the file name of an item");
-            CFStringRef fullString = CFURLGetString(aUrlRef);
-            CFURLRef dirRef = CFURLCreateCopyDeletingLastPathComponent(NULL,aUrlRef);
-            CFIndex dirLength = CFStringGetLength(CFURLGetString(dirRef));
-            CFRelease(dirRef);
-            CFIndex fullLength = CFStringGetLength(fullString);
-            CFRange substringRange = CFRangeMake(dirLength, fullLength - dirLength);
-            sURLString = CFStringCreateWithSubstring(NULL, fullString, substringRange);
+            {
+                OSL_TRACE("Extracting the file name of an item");
+                CFStringRef fullString = CFURLGetString(aUrlRef);
+                CFURLRef dirRef = CFURLCreateCopyDeletingLastPathComponent(NULL,aUrlRef);
+                CFIndex dirLength = CFStringGetLength(CFURLGetString(dirRef));
+                CFRelease(dirRef);
+                CFIndex fullLength = CFStringGetLength(fullString);
+                CFRange substringRange = CFRangeMake(dirLength, fullLength - dirLength);
+                sURLString = CFStringCreateWithSubstring(NULL, fullString, substringRange);
+            }
             break;
         case PATHWITHOUTLASTCOMPONENT:
-            OSL_TRACE("Extracting the last but one component of an item's path");
-            CFURLRef directoryRef = CFURLCreateCopyDeletingLastPathComponent(NULL,aUrlRef);
-            sURLString = CFURLGetString(directoryRef);
-            CFRetain(sURLString);
-            CFRelease(directoryRef);
+            {
+                OSL_TRACE("Extracting the last but one component of an item's path");
+                CFURLRef directoryRef = CFURLCreateCopyDeletingLastPathComponent(NULL,aUrlRef);
+                sURLString = CFURLGetString(directoryRef);
+                CFRetain(sURLString);
+                CFRelease(directoryRef);
+            }
             break;
         default:
             break;
diff --git a/fpicker/source/aqua/NSURL_OOoAdditions.mm b/fpicker/source/aqua/NSURL_OOoAdditions.mm
index 6be80a7..e5d5aaa 100644
--- a/fpicker/source/aqua/NSURL_OOoAdditions.mm
+++ b/fpicker/source/aqua/NSURL_OOoAdditions.mm
@@ -45,28 +45,32 @@
             [sURLString retain];
             break;
         case FILENAME:
-            OSL_TRACE("Extracting the file name of an item");
-            NSString *path = [self path];
-            if (path == nil) {
-                sURLString = @"";
-            }
-            else {
-                sURLString = [path lastPathComponent];
+            {
+                OSL_TRACE("Extracting the file name of an item");
+                NSString *path = [self path];
+                if (path == nil) {
+                    sURLString = @"";
+                }
+                else {
+                    sURLString = [path lastPathComponent];
+                }
+                [sURLString retain];
             }
-            [sURLString retain];
             break;
         case PATHWITHOUTLASTCOMPONENT:
-            OSL_TRACE("Extracting the last but one component of an item's path");
-            path = [self absoluteString];
-            if (path == nil) {
-                sURLString = @"";
-            }
-            else {
-                NSString* lastComponent = [path lastPathComponent];
-                unsigned int lastLength = [lastComponent length];
-                sURLString = [path substringToIndex:([path length] - lastLength)];
+            {
+                OSL_TRACE("Extracting the last but one component of an item's path");
+                NSString *path = [self absoluteString];
+                if (path == nil) {
+                    sURLString = @"";
+                }
+                else {
+                    NSString* lastComponent = [path lastPathComponent];
+                    unsigned int lastLength = [lastComponent length];
+                    sURLString = [path substringToIndex:([path length] - lastLength)];
+                }
+                [sURLString retain];
             }
-            [sURLString retain];
             break;
         default:
             break;
diff --git a/fpicker/source/aqua/SalAquaPicker.cxx b/fpicker/source/aqua/SalAquaPicker.cxx
index 43962a3..07534a2 100644
--- a/fpicker/source/aqua/SalAquaPicker.cxx
+++ b/fpicker/source/aqua/SalAquaPicker.cxx
@@ -123,11 +123,13 @@ void SAL_CALL SalAquaPicker::implInitialize()
              * So the only reliable way seems to be using the NSUserDefaults object because that is where that value is stored and
              * to just overwrite it if it has the wrong value.
              */
-            NSUserDefaults *pDefaults = [NSUserDefaults standardUserDefaults];
-            NSNumber *pExtn = [pDefaults objectForKey:kSetHideExtensionStateKey];
-            if(pExtn == nil || [pExtn boolValue] == NO) {
-                OSL_TRACE("Hiding extension");
-                [pDefaults setBool:YES forKey:kSetHideExtensionStateKey];
+            {
+                NSUserDefaults *pDefaults = [NSUserDefaults standardUserDefaults];
+                NSNumber *pExtn = [pDefaults objectForKey:kSetHideExtensionStateKey];
+                if(pExtn == nil || [pExtn boolValue] == NO) {
+                    OSL_TRACE("Hiding extension");
+                    [pDefaults setBool:YES forKey:kSetHideExtensionStateKey];
+                }
             }
             break;
 


More information about the Libreoffice-commits mailing list