Re: [Flightgear-devel] terragear - file src/Lib/Optimize/genfans.cxx

2011-05-29 Thread Anders Gidenstam
On Sat, 28 May 2011, Geoff McLane wrote:

 Hi all,

 I read (everywhere) that a vector erase invalidates
 all current iterators - see say -
 http://www.cplusplus.com/reference/stl/vector/erase/
 so I really do not understand why genfans.cxx has lasted
 so long like it is ;=((

 When it does a -
   tris.erase( t_current );
 it should reset the iterators. The small patch attached
 does just that...

 Maybe somehow, on some platforms, the iterators are
 'correctly' adjusted, but certainly NOT in WIN32, and I
 suspect the same in other platforms!

 I would respectfully request the attached patch be
 applied soonest, unless there is some other reasoning
 at play here.

 It certainly works better for me ;=)) And removes
 another reason why fgfs-construct can abort
 without apparent reason!

Hi Geoff,

If I recall correctly (it is still before my morning coffee here :) 
vector::erase() returns a new iterator that you can use to continue the 
iteration, so the below should work for continuing the iteration:

t_current = tris.erase( t_current );
t_last = tris.end();

However, if you have more iterators around (than t_current and t_last) 
that will need to be adjusted perhaps a full restart is warranted.

Cheers,

Anders
-- 
---
Anders Gidenstam
WWW: http://www.gidenstam.org/FlightGear/

--
vRanger cuts backup time in half-while increasing security.
With the market-leading solution for virtual backup and recovery, 
you get blazing-fast, flexible, and affordable data protection.
Download your free trial now. 
http://p.sf.net/sfu/quest-d2dcopy1
___
Flightgear-devel mailing list
Flightgear-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/flightgear-devel


Re: [Flightgear-devel] terragear - file src/Lib/Optimize/genfans.cxx

2011-05-29 Thread Geoff McLane
On Sun, 2011-05-29 at 09:55 +0200, Anders Gidenstam wrote:
 On Sat, 28 May 2011, Geoff McLane wrote:
 
  Hi all,
 
  I read (everywhere) that a vector erase invalidates
  all current iterators - see say -
  http://www.cplusplus.com/reference/stl/vector/erase/
  so I really do not understand why genfans.cxx has lasted
  so long like it is ;=((
 
  When it does a -
  tris.erase( t_current );
  it should reset the iterators. The small patch attached
  does just that...
 
  Maybe somehow, on some platforms, the iterators are
  'correctly' adjusted, but certainly NOT in WIN32, and I
  suspect the same in other platforms!
 
  I would respectfully request the attached patch be
  applied soonest, unless there is some other reasoning
  at play here.
 
  It certainly works better for me ;=)) And removes
  another reason why fgfs-construct can abort
  without apparent reason!
 
 Hi Geoff,
 
 If I recall correctly (it is still before my morning coffee here :) 
 vector::erase() returns a new iterator that you can use to continue the 
 iteration, so the below should work for continuing the iteration:
 
 t_current = tris.erase( t_current );
 t_last = tris.end();
 
 However, if you have more iterators around (than t_current and t_last) 
 that will need to be adjusted perhaps a full restart is warranted.
 
 Cheers,
 
 Anders


Hi Anders,

Thanks for the information... and before your 
coffee as well ;=))

If erase does returns a 'next' valid iterator 
after the erased item, then a slightly 'faster' 
patch would indeed be, as you indicate :-

---
 src/Lib/Optimize/genfans.cxx |3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/src/Lib/Optimize/genfans.cxx b/src/Lib/Optimize/genfans.cxx
index 166c354..9551088 100644
--- a/src/Lib/Optimize/genfans.cxx
+++ b/src/Lib/Optimize/genfans.cxx
@@ -225,7 +225,8 @@ opt_list TGGenFans::greedy_build( triele_list tris )
{
//   t_current-get_n3()
//from master tri pool
//   endl;
-   tris.erase( t_current );
+   t_current = tris.erase( t_current );
+   t_last = tris.end();
} else {
++t_current;
}
-- 
1.7.0.4

since in that particular loop t_current and t_last 
are the only iterators used... it compiles ok 
like that, but yet to 'test' this change...

But also in this case, a full restart of the loop 
would not 'cost' much more... just to be very sure...

Just hope one of the 'fixes' gets into mapserver 
terragear cs soon ;=)) adding a little more 
stability to the likes of fgfs-construct, as one 
exe which uses this library...

Regards,
Geoff.



--
vRanger cuts backup time in half-while increasing security.
With the market-leading solution for virtual backup and recovery, 
you get blazing-fast, flexible, and affordable data protection.
Download your free trial now. 
http://p.sf.net/sfu/quest-d2dcopy1
___
Flightgear-devel mailing list
Flightgear-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/flightgear-devel


Re: [Flightgear-devel] terragear - file src/Lib/Optimize/genfans.cxx

2011-05-29 Thread Christian Schmitt
Geoff McLane wrote:
 It certainly works better for me ;=)) And removes
 another reason why fgfs-construct can abort
 without apparent reason!

Hi,

you mean segfaults with no apparent reason? I experience them under Linux 
when building huge scenery chunks and if your patch improves the situation, 
I'll gladly give it a try.

Chris

--
vRanger cuts backup time in half-while increasing security.
With the market-leading solution for virtual backup and recovery, 
you get blazing-fast, flexible, and affordable data protection.
Download your free trial now. 
http://p.sf.net/sfu/quest-d2dcopy1
___
Flightgear-devel mailing list
Flightgear-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/flightgear-devel


[Flightgear-devel] sound problem

2011-05-29 Thread kaiowas
Hello,

I re-install FlightGear GIT version. I installed according to these steps:

http://wiki.flightgear.org/Building_FlightGear_-_Debian

But no sound from aircraft.


/usr/local/games/FlightGear/bin/fgfs --show-sound-devices
--fg-root=/usr/local/games/FlightGear/fgdata
Processing command line arguments
Error: Audio device not available, trying default
Error: Default Audio device not available.
unknown provided by unknown

No. Device


./openal-info
Available playback devices:
!!! none !!!
Available capture devices:
!!! none !!!
Default playback device:
Default capture device:
ALC version: 1.1

!!! Failed to open default device !!!


I using Debian Squeeze. My sound card is:

00:1b.0 Audio device: Intel Corporation N10/ICH 7 Family High
Definition Audio Controller (rev 01)

What is problem? Suggest me solution please.

Thanks

Regards

Ozgur Karatas

--
vRanger cuts backup time in half-while increasing security.
With the market-leading solution for virtual backup and recovery, 
you get blazing-fast, flexible, and affordable data protection.
Download your free trial now. 
http://p.sf.net/sfu/quest-d2dcopy1
___
Flightgear-devel mailing list
Flightgear-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/flightgear-devel


Re: [Flightgear-devel] sound problem

2011-05-29 Thread Alex D-HUND
Ahoy,

you need to create an OpenAL config file which helps to find the sound
devices.

The files name is ~/.alsoftrc and may contain something like:
drivers = alsa
[alsa]  # ALSA backend stuff
device = default
capture = default

There are plenty of examples on the net.

hth
Alex



Am Sun, 29 May 2011 06:35:17 -0400 schrieb kaiowas krep...@gmail.com:

 Hello,
 
 I re-install FlightGear GIT version. I installed according to these
 steps:
 
 http://wiki.flightgear.org/Building_FlightGear_-_Debian
 
 But no sound from aircraft.
 
 
 /usr/local/games/FlightGear/bin/fgfs --show-sound-devices
 --fg-root=/usr/local/games/FlightGear/fgdata
 Processing command line arguments
 Error: Audio device not available, trying default
 Error: Default Audio device not available.
 unknown provided by unknown
 
 No. Device
 
 
 ./openal-info
 Available playback devices:
 !!! none !!!
 Available capture devices:
 !!! none !!!
 Default playback device:
 Default capture device:
 ALC version: 1.1
 
 !!! Failed to open default device !!!
 
 
 I using Debian Squeeze. My sound card is:
 
 00:1b.0 Audio device: Intel Corporation N10/ICH 7 Family High
 Definition Audio Controller (rev 01)
 
 What is problem? Suggest me solution please.
 
 Thanks
 
 Regards
 
 Ozgur Karatas
 
 --
 vRanger cuts backup time in half-while increasing security.
 With the market-leading solution for virtual backup and recovery, 
 you get blazing-fast, flexible, and affordable data protection.
 Download your free trial now. 
 http://p.sf.net/sfu/quest-d2dcopy1
 ___
 Flightgear-devel mailing list
 Flightgear-devel@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/flightgear-devel


--
vRanger cuts backup time in half-while increasing security.
With the market-leading solution for virtual backup and recovery, 
you get blazing-fast, flexible, and affordable data protection.
Download your free trial now. 
http://p.sf.net/sfu/quest-d2dcopy1
___
Flightgear-devel mailing list
Flightgear-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/flightgear-devel


Re: [Flightgear-devel] terragear - file src/Lib/Optimize/genfans.cxx

2011-05-29 Thread Geoff McLane
On Sun, 2011-05-29 at 11:45 +0200, Christian Schmitt wrote:
 Geoff McLane wrote:
  It certainly works better for me ;=)) And removes
  another reason why fgfs-construct can abort
  without apparent reason!
 
 Hi,
 
 you mean segfaults with no apparent reason? I experience them under Linux 
 when building huge scenery chunks and if your patch improves the situation, 
 I'll gladly give it a try.
 
 Chris
 

Hi Chris,

Exactly ;=))

I am not sure if it is the WHOLE reason, but 
under WIN32, where you get a 'small' indication 
of where the problem occurred, even on the release 
version - ie no debug symbols available - this is 
certainly one, perhaps _NOT_ the only ;=((, where 
a segfault can occur...

This part of the 'genfans' library is _NOT_ run on 
every bucket being built... so MANY buckets can 
be ok... ie no segfault... only in certain 
situations...

If you do your own 'exe' build, please give the 
patch a try... and advise if the situation 
improves...

This would certainly help the 'maintainers' of 
terragear cs to decide to incorporate the 
patch... although, at the moment, it seems 
very obvious to me...

Added to that... I have found another 
'no-apparent-reason' segfault can be caused 
by -

Re: src/BuildTiles/Clipper/priorities.cxx

ANOTHER patch I am working on for fgfs-contruct, 
and currently testing, is the building of the 
'area_types' array...

This is built from the reading of the 
'default_priorities.txt' file, or such other 
file as you designate via the '--priorities=file' 
specific command...

The reading of this file creates the 'area_types' 
array, which, no matter what, _MUST_ have at least 
'TG_MAX_AREA_TYPES' members (= 128 in the current 
build) ... 

There are a number of functions, here and there, 
having no 'knowledge' of the size of the 'area_types'
array, which use something like :-

 for (i = 0; i  TG_MAX_AREA_TYPES; i++) {
area_type_descriptor type = get_area_descriptor(i);
...

BUT the static function -
 get_area_descriptor(AreaType area) -

(a) has a crazy, bad, stupid, range checking of -
if ( 0=area || area  area_types.size() ) {
This _MUST_ be something more like :-
if ( area = 0  area  area_types.size() ) {

(b) thus the array may not be less than 
TG_MAX_AREA_TYPES in size()...
if ( area = 0  area  area_types.size() ) {
return area_types[area];
} else {
   SG_LOG(SG_GENERAL, SG_ALERT, unknown area code =  
(int)area);
   exit(-1);
}

With the current range checking of -
if ( 0=area || area  area_types.size() ) {
this again means you can have a segfault when 
'area' is above the area_types.size() ;=((

My quick patch for this is attached, but it presently
depends on the _LAST_ entry in 'default_priorities.txt',
or such other designated file, having a FINAL entry 
of 

Unknown other

to fill the array out to 128 with 'Unknown', of 
priority value 7...

With these patches in place, I no longer get 
'strange' aborts from fgfs-construct ;=)) but 
welcome others testing, and reporting...

Regards,
Geoff.

attached: priorities-01.patch


--- C:\FGCVS\terragear-cs\src\BuildTiles\Clipper\priorities.cxx	Sun Oct 10 10:12:53 2010
+++ C:\FG\TG2\terragear-cs\src\BuildTiles\Clipper\priorities.cxx	Fri May 27 18:15:47 2011
@@ -31,6 +31,11 @@
 
 #include priorities.hxx
 
+#ifndef TG_MAX_AREA_TYPES
+#define TG_MAX_AREA_TYPES 128	// FIXME also defined in
+// MergerClipper/clipper.hxx
+#endif // TG_MAX_AREA_TYPES
+
 using std::ifstream;
 using std::string;
 using std::map;
@@ -75,8 +80,9 @@
 in  skipcomment;
 in  sliver_area_name;
 in  skipcomment;
+area_type_descriptor descriptor;
 while ( !in.eof() ) {
-area_type_descriptor descriptor;
+//area_type_descriptor descriptor;
 string type;
 descriptor.kind = Other;
 in  descriptor.name;
@@ -109,6 +115,18 @@
 
 sliver_target_area_type = get_area_type( sliver_area_name );
 default_area_type = get_area_type( default_area_name );
+
+if (area_types.size()  TG_MAX_AREA_TYPES) {
+SG_LOG(SG_GENERAL, SG_INFO, EEK: Area type count =   area_types.size() 
+ being less that MAX =   TG_MAX_AREA_TYPES   UGH! );
+while (area_types.size()  TG_MAX_AREA_TYPES) {
+AreaType index = (AreaType)area_types.size();
+area_types.push_back(descriptor);
+area_names[descriptor.name]=index;
+SG_LOG(SG_GENERAL, SG_INFO, descriptor.name descriptor.kind);
+}
+return 2;
+}
 
 return 1;
 }
@@ -125,12 +143,15 @@
 }
 
 
+//if ( 0=area || area  area_types.size() ) {
+// the above should be AND nor OR ;=((
 static area_type_descriptor get_area_descriptor( AreaType area ) {
-if ( 0=area || area  area_types.size() ) {
+if (( area = 0 )  ( area  area_types.size() )) {
 return area_types[area];
 } else {
 	SG_LOG(SG_GENERAL, SG_ALERT, unknown area code =   (int)area);
 	exit(-1);
+// return 

Re: [Flightgear-devel] sound problem

2011-05-29 Thread Robert
You also can install alsoft-conf from Synaptic. It will create ~/.alsoftrc
automatically.
Run it from the terminal and in the Backend tab you can try to disable
everything except ALSA.
This worked for me some time ago, because I had Issued with the PortAudio
backend.
--
vRanger cuts backup time in half-while increasing security.
With the market-leading solution for virtual backup and recovery, 
you get blazing-fast, flexible, and affordable data protection.
Download your free trial now. 
http://p.sf.net/sfu/quest-d2dcopy1___
Flightgear-devel mailing list
Flightgear-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/flightgear-devel


Re: [Flightgear-devel] sound problem

2011-05-29 Thread Roland Häder
On Mon, 2011-05-30 at 06:03 +0200, Robert wrote:
 You also can install alsoft-conf from Synaptic. It will create ~/.alsoftrc
 automatically.
 Run it from the terminal and in the Backend tab you can try to disable
 everything except ALSA.
 This worked for me some time ago, because I had Issued with the PortAudio
 backend.
Attached is my ~/.alsoftrc file. No problems with FGFS so far. :)
format = AL_FORMAT_STEREO16
cf_level = 2
drivers = alsa
[alsa]  # ALSA backend stuff
device = plug:dmix
capture = plug:dsnoop


signature.asc
Description: This is a digitally signed message part
--
vRanger cuts backup time in half-while increasing security.
With the market-leading solution for virtual backup and recovery, 
you get blazing-fast, flexible, and affordable data protection.
Download your free trial now. 
http://p.sf.net/sfu/quest-d2dcopy1___
Flightgear-devel mailing list
Flightgear-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/flightgear-devel