Back to index

lightning-sunbird  0.9+nobinonly
Classes | Functions
xpctest_string.cpp File Reference
#include "xpctest_private.h"

Go to the source code of this file.

Classes

class  xpcstringtest

Functions

static PRUnicharGetTestWString (int *size)

Function Documentation

static PRUnichar* GetTestWString ( int size) [static]

Definition at line 108 of file xpctest_string.cpp.

{
    static PRUnichar* sWStr;            
    static char str[] = "This is part of a long string... ";
    static const int slen = (sizeof(str)-1)/sizeof(char);
    static const int rep = 1;
    static const int space = (slen*rep*sizeof(PRUnichar))+sizeof(PRUnichar);

    if(!sWStr)
    {
        sWStr = (PRUnichar*) nsMemory::Alloc(space);
        if(sWStr)
        {
            PRUnichar* p = sWStr;
            for(int k = 0; k < rep; k++)
                for (int i = 0; i < slen; i++)
                    *(p++) = (PRUnichar) str[i];
        *p = 0;        
        }
    }
    if(size)
        *size = space;
    return sWStr;
}        

Here is the call graph for this function: