Last change
on this file was 2, checked in by bird, 22 years ago |
Initial revision
|
-
Property cvs2svn:cvs-rev
set to
1.1
-
Property svn:eol-style
set to
native
-
Property svn:executable
set to
*
|
File size:
958 bytes
|
Line | |
---|
1 | // natStringBuffer.cc - Implementation of java.lang.StringBuffer native methods.
|
---|
2 |
|
---|
3 | /* Copyright (C) 2001 Free Software Foundation
|
---|
4 |
|
---|
5 | This file is part of libgcj.
|
---|
6 |
|
---|
7 | This software is copyrighted work licensed under the terms of the
|
---|
8 | Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
|
---|
9 | details. */
|
---|
10 |
|
---|
11 | #include <config.h>
|
---|
12 | #include <gcj/cni.h>
|
---|
13 | #include <gnu/gcj/runtime/StringBuffer.h>
|
---|
14 | #include <java/lang/String.h>
|
---|
15 |
|
---|
16 | gnu::gcj::runtime::StringBuffer *
|
---|
17 | gnu::gcj::runtime::StringBuffer::append (jint num)
|
---|
18 | {
|
---|
19 | // Use an array large enough for "-2147483648"; i.e. 11 chars.
|
---|
20 | jchar buffer[11];
|
---|
21 | int i = _Jv_FormatInt (buffer+11, num);
|
---|
22 | jint needed = count + i;
|
---|
23 | ensureCapacity_unsynchronized (needed);
|
---|
24 | jchar* dst = elements (value) + count;
|
---|
25 | jchar* src = buffer+11-i;
|
---|
26 | while (--i >= 0)
|
---|
27 | *dst++ = *src++;
|
---|
28 | count = needed;
|
---|
29 | return this;
|
---|
30 | }
|
---|
31 |
|
---|
32 | java::lang::String *
|
---|
33 | gnu::gcj::runtime::StringBuffer::toString ()
|
---|
34 | {
|
---|
35 | return new java::lang::String (this);
|
---|
36 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.