quick 'fix' for crashers in some locales (#157871) basicly the same +

* compose/ucompose.hpp: quick 'fix' for crashers in some locales (#157871)
* include/Utils.h: basicly the same + minor cleanups
* src/GParted_Core.cc: replaced C-style cast with static_cast..
This commit is contained in:
Bart Hakvoort 2005-08-31 02:30:25 +00:00
parent e5f96698f8
commit a98126d69b
4 changed files with 19 additions and 14 deletions

View File

@ -1,3 +1,9 @@
2005-08-30 Bart Hakvoort <hakvoort@cvs.gnome.org>
* compose/ucompose.hpp: quick 'fix' for crashers in some locales (#157871)
* include/Utils.h: basicly the same + minor cleanups
* src/GParted_Core.cc: replaced C-style cast with static_cast..
2005-07-31 Ilkka Tuohela <hile@iki.fi> 2005-07-31 Ilkka Tuohela <hile@iki.fi>
* configure.in: Added 'fi' to ALL_LINGUAS. * configure.in: Added 'fi' to ALL_LINGUAS.

View File

@ -124,7 +124,7 @@ namespace UStringPrivate
os << obj; os << obj;
std::wstring str = os.str(); std::wstring str = os.str();
return Glib::convert(std::string(reinterpret_cast<const char *>(str.data()), return Glib::convert(std::string(reinterpret_cast<const char *>(str.data()),
str.size() * sizeof(wchar_t)), str.size() * sizeof(wchar_t)),
"UTF-8", "WCHAR_T"); "UTF-8", "WCHAR_T");
@ -157,7 +157,7 @@ namespace UStringPrivate
inline Composition &Composition::arg(const T &obj) inline Composition &Composition::arg(const T &obj)
{ {
Glib::ustring rep = stringify(obj); Glib::ustring rep = stringify(obj);
if (!rep.empty()) { // manipulators don't produce output if (!rep.empty()) { // manipulators don't produce output
for (specification_map::const_iterator i = specs.lower_bound(arg_no), for (specification_map::const_iterator i = specs.lower_bound(arg_no),
end = specs.upper_bound(arg_no); i != end; ++i) { end = specs.upper_bound(arg_no); i != end; ++i) {
@ -179,7 +179,8 @@ namespace UStringPrivate
: arg_no(1) : arg_no(1)
{ {
#if __GNUC__ >= 3 #if __GNUC__ >= 3
os.imbue(std::locale("")); // use the user's locale for the stream //plors: i've uncommented this one since it caused a crasher at line 124 for some locales (e.g. nl_BE)
//os.imbue(std::locale("")); // use the user's locale for the stream
#endif #endif
std::string::size_type b = 0, i = 0; std::string::size_type b = 0, i = 0;

View File

@ -55,8 +55,7 @@ struct FS
FS( ) FS( )
{ {
read = create = grow = shrink = move = check = copy = false ; read = create = grow = shrink = move = check = copy = false ;
MIN = 0 ; MIN = MAX = 0 ;
MAX = 0 ;
} }
}; };
@ -99,10 +98,9 @@ inline Gtk::Label * mk_label( const Glib::ustring & text, bool use_markup = true
inline Glib::ustring num_to_str( Sector number ) inline Glib::ustring num_to_str( Sector number )
{ {
std::ostringstream os; std::stringstream ss;
os .imbue( std::locale( "" ) ); ss << number ;
os << number ; return ss .str( ) ;
return os .str( ) ;
} }
//use http://developer.gnome.org/projects/gup/hig/2.0/design.html#Palette as a starting point.. //use http://developer.gnome.org/projects/gup/hig/2.0/design.html#Palette as a starting point..

View File

@ -80,7 +80,7 @@ void GParted_Core::get_devices( std::vector<Device> & devices )
//in certain cases (e.g. when there's a cd in the cdrom-drive) ped_device_probe_all will find a 'ghost' device that has no name or contains //in certain cases (e.g. when there's a cd in the cdrom-drive) ped_device_probe_all will find a 'ghost' device that has no name or contains
//random garbage. Those 2 checks try to prevent such a ghostdevice from being initialized.. (tested over a 1000 times with and without cd) //random garbage. Those 2 checks try to prevent such a ghostdevice from being initialized.. (tested over a 1000 times with and without cd)
while ( device && strlen( device ->path ) > 6 && ( (Glib::ustring) device ->path ) .is_ascii( ) ) while ( device && strlen( device ->path ) > 6 && static_cast<Glib::ustring>( device ->path ) .is_ascii( ) )
{ {
if ( open_device( device ->path, device ) ) if ( open_device( device ->path, device ) )
device_paths .push_back( get_sym_path( device ->path ) ) ; device_paths .push_back( get_sym_path( device ->path ) ) ;
@ -108,7 +108,7 @@ void GParted_Core::get_devices( std::vector<Device> & devices )
//make sure cylsize is at least 1 MB //make sure cylsize is at least 1 MB
if ( temp_device .cylsize < 1 ) if ( temp_device .cylsize < 1 )
temp_device .cylsize = 1 ; temp_device .cylsize = 1 ;
//normal harddisk //normal harddisk
if ( disk ) if ( disk )
{ {
@ -130,7 +130,7 @@ void GParted_Core::get_devices( std::vector<Device> & devices )
partition_temp .Set_Unallocated( 0, temp_device .length, false ); partition_temp .Set_Unallocated( 0, temp_device .length, false );
temp_device .device_partitions .push_back( partition_temp ); temp_device .device_partitions .push_back( partition_temp );
} }
devices .push_back( temp_device ) ; devices .push_back( temp_device ) ;
close_device_and_disk( device, disk ) ; close_device_and_disk( device, disk ) ;
@ -183,7 +183,7 @@ void GParted_Core::set_device_partitions( Device & device )
switch ( c_partition ->type ) switch ( c_partition ->type )
{ {
case PED_PARTITION_NORMAL: case PED_PARTITION_NORMAL:
case PED_PARTITION_LOGICAL: case PED_PARTITION_LOGICAL:
partition_temp .Set( device .path + num_to_str( c_partition ->num ), partition_temp .Set( device .path + num_to_str( c_partition ->num ),
c_partition ->num, c_partition ->num,
c_partition ->type == 0 ? GParted::PRIMARY : GParted::LOGICAL , c_partition ->type == 0 ? GParted::PRIMARY : GParted::LOGICAL ,
@ -191,7 +191,7 @@ void GParted_Core::set_device_partitions( Device & device )
c_partition ->geom .end, c_partition ->geom .end,
c_partition ->type, c_partition ->type,
ped_partition_is_busy( c_partition ) ); ped_partition_is_busy( c_partition ) );
if ( partition_temp .filesystem != "linux-swap" ) if ( partition_temp .filesystem != "linux-swap" )
{ {
Set_Used_Sectors( partition_temp ) ; Set_Used_Sectors( partition_temp ) ;