Fix test_app_server again due to Coding Sprint changes

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36195 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Adrien Destugues 2010-04-12 20:02:43 +00:00
parent de202917dc
commit 8f2d34d9e0
4 changed files with 28 additions and 15 deletions

View File

@ -4,7 +4,7 @@ SetSubDirSupportedPlatformsBeOSCompatible ;
AddSubDirSupportedPlatforms libbe_test ;
UseLibraryHeaders agg ;
UsePrivateHeaders shared ;
UsePrivateHeaders shared libbe ;
# for RWLockManager only
UsePrivateSystemHeaders ;

View File

@ -8,8 +8,9 @@
#include <stdio.h>
#include <Catalog.h>
#include <Locale.h>
#include <LocaleRoster.h>
#include <LocaleBackend.h>
using BPrivate::gLocaleBackend;
using BPrivate::LocaleBackend;
namespace BPrivate {
@ -18,35 +19,37 @@ namespace BPrivate {
const char*
string_for_size(double size, char* string, size_t stringSize)
{
BCatalogAddOn* systemCatalog;
be_locale_roster->GetSystemCatalog(&systemCatalog);
// we need to translate some strings, and in order to do so, we need
// to use the LocaleBackend to reache liblocale.so
if (gLocaleBackend == NULL)
LocaleBackend::LoadBackend();
double kib = size / 1024.0;
if (kib < 1.0) {
snprintf(string, stringSize,
systemCatalog->GetString("%d bytes","StringForSize",""),
gLocaleBackend->GetString("%d bytes","StringForSize",""),
(int)size);
return string;
}
double mib = kib / 1024.0;
if (mib < 1.0) {
snprintf(string, stringSize,
systemCatalog->GetString("%3.2f KiB","StringForSize",""), kib);
gLocaleBackend->GetString("%3.2f KiB","StringForSize",""), kib);
return string;
}
double gib = mib / 1024.0;
if (gib < 1.0) {
snprintf(string, stringSize,
systemCatalog->GetString("%3.2f MiB","StringForSize",""), mib);
gLocaleBackend->GetString("%3.2f MiB","StringForSize",""), mib);
return string;
}
double tib = gib / 1024.0;
if (tib < 1.0) {
snprintf(string, stringSize,
systemCatalog->GetString("%3.2f GiB","StringForSize",""), gib);
gLocaleBackend->GetString("%3.2f GiB","StringForSize",""), gib);
return string;
}
snprintf(string, stringSize,
systemCatalog->GetString("%.2f TiB","StringForSize",""), tib);
gLocaleBackend->GetString("%.2f TiB","StringForSize",""), tib);
return string;
}

View File

@ -254,8 +254,13 @@ status_t
ValueNode<float>::GetString(BString &predicate)
{
char buffer[32];
int32 value = *reinterpret_cast<int32*>(&fValue);
sprintf(buffer, "0x%08lx", value);
union {
int32 asInteger;
float asFloat;
} value;
value.asFloat = fValue;
// int32 value = *reinterpret_cast<int32*>(&fValue);
sprintf(buffer, "0x%08lx", value.asInteger);
predicate.SetTo(buffer);
return B_OK;
}
@ -266,8 +271,13 @@ status_t
ValueNode<double>::GetString(BString &predicate)
{
char buffer[32];
int64 value = *reinterpret_cast<int64*>(&fValue);
sprintf(buffer, "0x%016Lx", value);
union {
int64 asInteger;
double asFloat;
} value;
// int64 value = *reinterpret_cast<int64*>(&fValue);
value.asFloat = fValue;
sprintf(buffer, "0x%016Lx", value.asInteger);
predicate.SetTo(buffer);
return B_OK;
}

View File

@ -91,7 +91,7 @@ SharedLibrary libtracker.so :
VolumeWindow.cpp
WidgetAttributeText.cpp
: be translation $(vector_icon_libs) $(TARGET_LIBSTDC++) libshared.a liblocale.so
: be translation $(vector_icon_libs) $(TARGET_LIBSTDC++) libshared.a
;