Ejemplo n.º 1
0
 static void translate(UString::Rep*& location, const UCharBuffer& buf, unsigned hash)
 {
     UChar* d;
     UString::Rep* r = UString::Rep::createUninitialized(buf.length, d).releaseRef();
     for (unsigned i = 0; i != buf.length; i++)
         d[i] = buf.s[i];
     r->setHash(hash);
     location = r; 
 }
Ejemplo n.º 2
0
 static void translate(UString::Rep*& location, const char* c, unsigned hash)
 {
     size_t length = strlen(c);
     UChar* d;
     UString::Rep* r = UString::Rep::createUninitialized(length, d).releaseRef();
     for (size_t i = 0; i != length; i++)
         d[i] = static_cast<unsigned char>(c[i]); // use unsigned char to zero-extend instead of sign-extend
     r->setHash(hash);
     location = r;
 }