src/share/vm/oops/symbolOop.cpp

changeset 657
2a1a77d3458f
parent 435
a61af66fc99e
child 1573
dd57230ba8fe
equal deleted inserted replaced
656:1e026f8da827 657:2a1a77d3458f
66 return as_C_string(str, buf_len); 66 return as_C_string(str, buf_len);
67 } 67 }
68 68
69 void symbolOopDesc::print_symbol_on(outputStream* st) { 69 void symbolOopDesc::print_symbol_on(outputStream* st) {
70 st = st ? st : tty; 70 st = st ? st : tty;
71 for (int index = 0; index < utf8_length(); index++) 71 int length = UTF8::unicode_length((const char*)bytes(), utf8_length());
72 st->put((char)byte_at(index)); 72 const char *ptr = (const char *)bytes();
73 jchar value;
74 for (int index = 0; index < length; index++) {
75 ptr = UTF8::next(ptr, &value);
76 if (value >= 32 && value < 127 || value == '\'' || value == '\\') {
77 st->put(value);
78 } else {
79 st->print("\\u%04x", value);
80 }
81 }
73 } 82 }
74 83
75 jchar* symbolOopDesc::as_unicode(int& length) const { 84 jchar* symbolOopDesc::as_unicode(int& length) const {
76 symbolOopDesc* this_ptr = (symbolOopDesc*)this; 85 symbolOopDesc* this_ptr = (symbolOopDesc*)this;
77 length = UTF8::unicode_length((char*)this_ptr->bytes(), utf8_length()); 86 length = UTF8::unicode_length((char*)this_ptr->bytes(), utf8_length());

mercurial