Ticket #7901: Locale_status_code_1.diff

File Locale_status_code_1.diff, 4.0 KB (added by jscipione, 13 years ago)

Updates B_ERROR status to B_WOULD_BLOCK if locking fails in BLocale classes

  • src/kits/locale/Locale.cpp

    diff --git src/kits/locale/Locale.cpp src/kits/locale/Locale.cpp
    index 53edd1a..2b0208b 100644
    BLocale::GetLanguage(BLanguage* language) const  
    113113
    114114    BAutolock lock(fLock);
    115115    if (!lock.IsLocked())
    116         return B_ERROR;
     116        return B_WOULD_BLOCK;
    117117
    118118    *language = fLanguage;
    119119
    BLocale::GetFormattingConventions(BFormattingConventions* conventions) const  
    129129
    130130    BAutolock lock(fLock);
    131131    if (!lock.IsLocked())
    132         return B_ERROR;
     132        return B_WOULD_BLOCK;
    133133
    134134    *conventions = fConventions;
    135135
    BLocale::FormatDate(char* string, size_t maxSize, time_t time,  
    198198{
    199199    BAutolock lock(fLock);
    200200    if (!lock.IsLocked())
    201         return B_ERROR;
     201        return B_WOULD_BLOCK;
    202202
    203203    BString format;
    204204    fConventions.GetDateFormat(style, format);
    BLocale::FormatDate(BString *string, time_t time, BDateFormatStyle style,  
    225225{
    226226    BAutolock lock(fLock);
    227227    if (!lock.IsLocked())
    228         return B_ERROR;
     228        return B_WOULD_BLOCK;
    229229
    230230    BString format;
    231231    fConventions.GetDateFormat(style, format);
    BLocale::FormatDate(BString* string, int*& fieldPositions, int& fieldCount,  
    258258{
    259259    BAutolock lock(fLock);
    260260    if (!lock.IsLocked())
    261         return B_ERROR;
     261        return B_WOULD_BLOCK;
    262262
    263263    BString format;
    264264    fConventions.GetDateFormat(style, format);
    BLocale::GetDateFields(BDateElement*& fields, int& fieldCount,  
    305305{
    306306    BAutolock lock(fLock);
    307307    if (!lock.IsLocked())
    308         return B_ERROR;
     308        return B_WOULD_BLOCK;
    309309
    310310    BString format;
    311311    fConventions.GetDateFormat(style, format);
    BLocale::StartOfWeek() const  
    360360{
    361361    BAutolock lock(fLock);
    362362    if (!lock.IsLocked())
    363         return B_ERROR;
     363        return B_WOULD_BLOCK;
    364364
    365365    UErrorCode err = U_ZERO_ERROR;
    366366    Calendar* c = Calendar::createInstance(
    BLocale::FormatDateTime(char* target, size_t maxSize, time_t time,  
    384384{
    385385    BAutolock lock(fLock);
    386386    if (!lock.IsLocked())
    387         return B_ERROR;
     387        return B_WOULD_BLOCK;
    388388
    389389    BString format;
    390390    fConventions.GetDateFormat(dateStyle, format);
    BLocale::FormatDateTime(BString* target, time_t time,  
    421421{
    422422    BAutolock lock(fLock);
    423423    if (!lock.IsLocked())
    424         return B_ERROR;
     424        return B_WOULD_BLOCK;
    425425
    426426    BString format;
    427427    fConventions.GetDateFormat(dateStyle, format);
    BLocale::FormatTime(char* string, size_t maxSize, time_t time,  
    464464{
    465465    BAutolock lock(fLock);
    466466    if (!lock.IsLocked())
    467         return B_ERROR;
     467        return B_WOULD_BLOCK;
    468468
    469469    BString format;
    470470    fConventions.GetTimeFormat(style, format);
    BLocale::FormatTime(BString* string, time_t time, BTimeFormatStyle style,  
    491491{
    492492    BAutolock lock(fLock);
    493493    if (!lock.IsLocked())
    494         return B_ERROR;
     494        return B_WOULD_BLOCK;
    495495
    496496    BString format;
    497497    fConventions.GetTimeFormat(style, format);
    BLocale::FormatTime(BString* string, int*& fieldPositions, int& fieldCount,  
    524524{
    525525    BAutolock lock(fLock);
    526526    if (!lock.IsLocked())
    527         return B_ERROR;
     527        return B_WOULD_BLOCK;
    528528
    529529    BString format;
    530530    fConventions.GetTimeFormat(style, format);
    BLocale::GetTimeFields(BDateElement*& fields, int& fieldCount,  
    570570{
    571571    BAutolock lock(fLock);
    572572    if (!lock.IsLocked())
    573         return B_ERROR;
     573        return B_WOULD_BLOCK;
    574574
    575575    BString format;
    576576    fConventions.GetTimeFormat(style, format);
    BLocale::FormatNumber(BString* string, double value) const  
    646646{
    647647    BAutolock lock(fLock);
    648648    if (!lock.IsLocked())
    649         return B_ERROR;
     649        return B_WOULD_BLOCK;
    650650
    651651    UErrorCode err = U_ZERO_ERROR;
    652652    ObjectDeleter<NumberFormat> numberFormatter(NumberFormat::createInstance(
    BLocale::FormatNumber(BString* string, int32 value) const  
    686686{
    687687    BAutolock lock(fLock);
    688688    if (!lock.IsLocked())
    689         return B_ERROR;
     689        return B_WOULD_BLOCK;
    690690
    691691    UErrorCode err = U_ZERO_ERROR;
    692692    ObjectDeleter<NumberFormat> numberFormatter(NumberFormat::createInstance(
    BLocale::FormatMonetary(BString* string, double value) const  
    729729
    730730    BAutolock lock(fLock);
    731731    if (!lock.IsLocked())
    732         return B_ERROR;
     732        return B_WOULD_BLOCK;
    733733
    734734    UErrorCode err = U_ZERO_ERROR;
    735735    ObjectDeleter<NumberFormat> numberFormatter(