2009/1/26 Harry van der Wolf <[email protected]>: > Hi programmers, > > I have problems implementing a patch for Hugin. We need a hack to test for > OSX Leopard (10.5.x) and OSX Tiger (10.4.x). I do this by using > wxGetOsVersion. As such this work. > The version is reported in hex. > Leopard 10.5.6 becomes 10.56. Major version 0x10 (=16 decimal), minor > version 0x56 (=86 decimal) > Tiger 10.4.11 becomes 16 decimal, minor version < 80 dec > > There are two pieces of code: > > #if defined __WXMAC__ && defined __ppc__ > > int osVersionMajor; > int osVersionMinor; > > int os = wxGetOsVersion(&osVersionMajor, &osVersionMinor); > > cerr << "osVersionCheck: os is " << os << "\n" << endl; > cerr << "osVersionCheck: osVersionMajor = " << osVersionMajor << endl; > cerr << "osVersionCheck: osVersionMinor = " << osVersionMinor << endl; > > > if ((osVersionMajor == 0x10) && (osVersionMinor >= 0x50)) > { > //let the child process exit without becoming zombie > //may do some harm to internal handling by wxWidgets, but hey it's not > working anyway > signal(SIGCHLD,SIG_IGN); > } > #endif > > And the second part is > #if defined __WXMAC__ && defined __ppc__ > int osVersionMajor; > int osVersionMinor; > > int os = wxGetOsVersion(&osVersionMajor, &osVersionMinor); > > cerr << "osVersionCheck: os is " << os << "\n" << endl; > cerr << "osVersionCheck: osVersionMajor = " << osVersionMajor << endl; > cerr << "osVersionCheck: osVersionMinor = " << osVersionMinor << endl; > > > if ((osVersionMajor == 0x10) && (osVersionMinor >= 0x50)) > { > if(m_pidLast) > { > if(kill((pid_t)m_pidLast,0)!=0) //if not pid exists > { > DEBUG_DEBUG("Found terminated process: " << > (pid_t)m_pidLast) > > // probably should clean up the wxProcess object which was > newed when the process was launched. > // for now, nevermind the tiny memory leak... it's a hack to > workaround the bug anyway > > //notify dialog that it's finished. > if (this->GetParent()) { > wxProcessEvent event( wxID_ANY, m_pidLast, 0); // assume > 0 exit code > event.SetEventObject( this ); > DEBUG_TRACE("Sending wxProcess event"); > this->GetParent()->ProcessEvent( event ); > } > } > } > } > #endif > > The test checks for 0x10 as major and >=0x50 as minor version. > Leopard system.log: > osVersionCheck: os is 2 > osVersionCheck: osVersionMajor = 16 > osVersionCheck: osVersionMinor = 86 > Tiger log: > osVersionCheck: os is 2 > osVersionCheck: osVersionMajor = 16 > osVersionCheck: osVersionMinor = 73 > > Leopard mentions 16 and 86 and the code is executed => OK > Tiger mentions 16 and 73 (73 being smaller than 80 (0x50). Still the code is > executed => Tiger Hugin hangs. > If I completely remove the code Hugin hangs on Leopard and runs on Tiger, > which is expected behaviour. > I'm completely blind why my code is executed in both cases even though the > second version check for both code snippets is false. I assume I'm doing > something wrong but I have no idea what it is. > > Please can any programmer shine a light on this. > > Harry > > > >
I don't see anything wrong here. I'd try using: int intOsVersionMinor = atoi(&osVersionMinor[2]); and change comparison accordingly. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "hugin and other free panoramic software" group. A list of frequently asked questions is available at: http://wiki.panotools.org/Hugin_FAQ To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/hugin-ptx -~----------~----~----~----~------~----~------~--~---
