VirtualBox

Ignore:
Timestamp:
Oct 6, 2009 6:07:06 AM (15 years ago)
Author:
vboxsync
Message:

crOpenGL: update to wine 1.1.30

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Additions/WINNT/Graphics/Wine/include/wine/test.h

    r19678 r23571  
    7171extern int winetest_get_mainargs( char*** pargv );
    7272extern void winetest_wait_child_process( HANDLE process );
     73
     74extern const char *wine_dbgstr_wn( const WCHAR *str, int n );
     75static inline const char *wine_dbgstr_w( const WCHAR *s ) { return wine_dbgstr_wn( s, -1 ); }
    7376
    7477#ifdef STANDALONE
     
    206209    int todo_level;                  /* current todo nesting level */
    207210    int todo_do_loop;
     211    char *str_pos;                   /* position in debug buffer */
     212    char strings[2000];              /* buffer for debug strings */
    208213} tls_data;
    209214static DWORD tls_index;
     
    218223    if (!data)
    219224    {
    220         data=HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,sizeof(tls_data));
     225        data=HeapAlloc(GetProcessHeap(), 0, sizeof(tls_data));
     226        data->todo_level = 0;
     227        data->str_pos = data->strings;
    221228        TlsSetValue(tls_index,data);
    222229    }
    223230    SetLastError(last_error);
    224231    return data;
     232}
     233
     234/* allocate some tmp space for a string */
     235static char *get_temp_buffer( size_t n )
     236{
     237    tls_data *data = get_tls_data();
     238    char *res = data->str_pos;
     239
     240    if (res + n >= &data->strings[sizeof(data->strings)]) res = data->strings;
     241    data->str_pos = res + n;
     242    return res;
     243}
     244
     245/* release extra space that we requested in gimme1() */
     246static void release_temp_buffer( char *ptr, size_t size )
     247{
     248    tls_data *data = get_tls_data();
     249    data->str_pos = ptr + size;
    225250}
    226251
     
    417442}
    418443
     444const char *wine_dbgstr_wn( const WCHAR *str, int n )
     445{
     446    char *dst, *res;
     447    size_t size;
     448
     449    if (!((ULONG_PTR)str >> 16))
     450    {
     451        if (!str) return "(null)";
     452        res = get_temp_buffer( 6 );
     453        sprintf( res, "#%04x", LOWORD(str) );
     454        return res;
     455    }
     456    if (n == -1)
     457    {
     458        const WCHAR *end = str;
     459        while (*end) end++;
     460        n = end - str;
     461    }
     462    if (n < 0) n = 0;
     463    size = 12 + min( 300, n * 5 );
     464    dst = res = get_temp_buffer( size );
     465    *dst++ = 'L';
     466    *dst++ = '"';
     467    while (n-- > 0 && dst <= res + size - 10)
     468    {
     469        WCHAR c = *str++;
     470        switch (c)
     471        {
     472        case '\n': *dst++ = '\\'; *dst++ = 'n'; break;
     473        case '\r': *dst++ = '\\'; *dst++ = 'r'; break;
     474        case '\t': *dst++ = '\\'; *dst++ = 't'; break;
     475        case '"':  *dst++ = '\\'; *dst++ = '"'; break;
     476        case '\\': *dst++ = '\\'; *dst++ = '\\'; break;
     477        default:
     478            if (c >= ' ' && c <= 126)
     479                *dst++ = c;
     480            else
     481            {
     482                *dst++ = '\\';
     483                sprintf(dst,"%04x",c);
     484                dst+=4;
     485            }
     486        }
     487    }
     488    *dst++ = '"';
     489    if (n > 0)
     490    {
     491        *dst++ = '.';
     492        *dst++ = '.';
     493        *dst++ = '.';
     494    }
     495    *dst++ = 0;
     496    release_temp_buffer( res, dst - res );
     497    return res;
     498}
     499
    419500/* Find a test by name */
    420501static const struct test *find_test( const char *name )
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette