https://bugs.freedesktop.org/show_bug.cgi?id=66212

Boruch Baum <[email protected]> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |[email protected]

--- Comment #1 from Boruch Baum <[email protected]> ---
Here's a code snippet, written in C and taken from libhdate (hdate_strings.c,
function hdate_strings), that should solve the bug:

#define H_CHAR_WIDTH 2
static char *digits[3][10] = {
    {" ", "א", "ב", "ג", "ד", "ה", "ו", "ז", "ח", "ט"},
    {"ט", "י", "כ", "ל", "מ", "נ", "ס", "ע", "פ", "צ"},
    {" ", "ק", "ר", "ש", "ת"}

if ((index > 0) && (index < 11000))
{
    /// HEBREW_NUMBER_BUFFER_SIZE 17    defined in hdate.h
    return_string = malloc(HEBREW_NUMBER_BUFFER_SIZE);
    if (return_string == NULL) return NULL;
    return_string[0] = '\0';
    int n = index;
    if (n >= 1000)
    {
        strncat (return_string, digits[0][n / 1000], H_CHAR_WIDTH);
        n %= 1000;
    }
    while (n >= 400)
    {
        strncat (return_string, digits[2][4], H_CHAR_WIDTH);
        n -= 400;
    }
    if (n >= 100)
    {
        strncat (return_string, digits[2][n / 100], H_CHAR_WIDTH);
        n %= 100;
    }
    if (n >= 10)
    {
        if (n == 15 || n == 16)
            n -= 9;
        strncat (return_string, digits[1][n / 10], H_CHAR_WIDTH);
        n %= 10;
    }
    if (n > 0)
        strncat (return_string, digits[0][n], H_CHAR_WIDTH);

     /// possibly add the ' and " to hebrew numbers    
    if (!short_form)
    {
        return_string_len = strlen (return_string);
        if (return_string_len <= H_CHAR_WIDTH) strncat (return_string, "'",
H_CHAR_WIDTH);
        else
        {
            return_string[return_string_len + 1] =
return_string[return_string_len];
            return_string[return_string_len] = return_string[return_string_len
- 1];
            return_string[return_string_len - 1] =
return_string[return_string_len - 2];
            return_string[return_string_len - 2] = '\"';
            return_string[return_string_len + 2] = '\0';
        }
    }
    return return_string;

-- 
You are receiving this mail because:
You are the assignee for the bug.
_______________________________________________
Libreoffice-bugs mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/libreoffice-bugs

Reply via email to