summaryrefslogtreecommitdiff
path: root/fpicker
diff options
context:
space:
mode:
authorTor Lillqvist <tml@iki.fi>2011-09-29 00:17:38 +0300
committerTor Lillqvist <tml@iki.fi>2011-09-29 00:54:43 +0300
commit15759b8c9423c8f3fd0be97566698bf94535875a (patch)
tree0d20d145a0169a0267dc19a039ca2e9f29657c7f /fpicker
parent7743899403177a53c782822e66d21aaf4043dd65 (diff)
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'
Diffstat (limited to 'fpicker')
-rw-r--r--fpicker/source/aqua/CFStringUtilities.cxx30
-rw-r--r--fpicker/source/aqua/NSURL_OOoAdditions.mm40
-rw-r--r--fpicker/source/aqua/SalAquaPicker.cxx12
3 files changed, 46 insertions, 36 deletions
diff --git a/fpicker/source/aqua/CFStringUtilities.cxx b/fpicker/source/aqua/CFStringUtilities.cxx
index 7d9293d7a1f1..da624fe829a5 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 6be80a765228..e5d5aaa3e42e 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 43962a30d3d5..07534a2f401a 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;