Bug 858 - backend/src/osx/OSXConfigurator.cc Switch/Case Error
Status:
RESOLVED FIXED
Component:
Core
Version:
1.9.0
Hardware:
Macintosh Mac OS
Importance:
P2 blocker
Target Milestone:
---
Assignee:
Rob Caelers
URL:
Depends on:
Blocks:
Reported:
Sep 21 2009 18:55:44 UTC
by:
Sean
Modified:
Oct 11 2009 13:24:13 UTC
CC List:
Sean
IdWhoWhenSizeType
196Path to fix jump to case label crosses initialization of 'NSString* val' error
SeanSep 21 2009 18:55:44 UTC519text/plain
WhoWhenWhatRemovedAdded
Rob CaelersOct 11 2009 13:24:13 UTCstatusNEWRESOLVED
resolutionFIXED
Description
Sean  Sep 21 2009 18:55:44 UTC
Created attachment 196
Path to fix jump to case label crosses initialization of 'NSString* val' error

On Mac OS X 10.6 (Snow Leopard) when trying to build workrave (after installing the required prereqs mostly via MacPorts, I get the following error during the build:

libtool: compile:  g++ -DHAVE_CONFIG_H -I. -I../../.. -xobjective-c++ -W -I../../../backend/src -I../../../backend/include -DWORKRAVE_PKGDATADIR=\"/usr/local/share/workrave\" -I ../../../common/include -I ../../../common/include/unix -D_XOPEN_SOURCE=600 -D_REENTRANT -I/opt/local/include/glib-2.0 -I/opt/local/lib/glib-2.0/include -I/opt/local/include -g -O2 -Os -g -DNDEBUG -MT libworkrave_backend_osx_la-OSXConfigurator.lo -MD -MP -MF .deps/libworkrave_backend_osx_la-OSXConfigurator.Tpo -c OSXConfigurator.cc  -fno-common -DPIC -o .libs/libworkrave_backend_osx_la-OSXConfigurator.o
OSXConfigurator.cc: In member function 'virtual bool OSXConfigurator::get_value(const std::string&, VariantType, Variant&) const':
OSXConfigurator.cc:130: error: jump to case label
OSXConfigurator.cc:119: error:   crosses initialization of 'NSString* val'
make[4]: *** [libworkrave_backend_osx_la-OSXConfigurator.lo] Error 1
make[3]: *** [all-recursive] Error 1
make[2]: *** [all-recursive] Error 1
make[1]: *** [all-recursive] Error 1
make: *** [all] Error 2  

I was able to "fix" this, by applying the following patch:

--- backend/src/osx/OSXConfigurator.cc-orig     2009-09-21 09:39:25.000000000 -0700
+++ backend/src/osx/OSXConfigurator.cc  2009-09-21 09:07:43.000000000 -0700
@@ -116,6 +116,7 @@
           // FALLTHROUGH

         case VARIANT_TYPE_STRING:
+        {
           NSString *val = [[NSUserDefaults standardUserDefaults] stringForKey: keystring];
           if (val != nil)
             {
@@ -126,6 +127,7 @@
               ret = false;
             }
           break;
+        }

         default:
           ret = false;
Comment 1
Rob Caelers  Oct 11 2009 13:19:44 UTC
Thanks! Fixed in 1.9.x