Fix typo in the last changelog entry.
[official-gcc.git] / libjava / java / lang / natAbstractStringBuffer.cc
blobb2df69cc39e258b70ae7ac9e6dd07e5ec5b32e18
1 // natStringBuffer.cc - Implementation of java.lang.StringBuffer native methods.
3 /* Copyright (C) 2001, 2003 Free Software Foundation
5 This file is part of libgcj.
7 This software is copyrighted work licensed under the terms of the
8 Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
9 details. */
11 #include <config.h>
12 #include <gcj/cni.h>
13 #include <java/lang/AbstractStringBuffer.h>
15 java::lang::AbstractStringBuffer*
16 java::lang::AbstractStringBuffer::append (jint num)
18 // Use an array large enough for "-2147483648"; i.e. 11 chars.
19 jchar buffer[11];
20 int i = _Jv_FormatInt (buffer+11, num);
21 jint needed = count + i;
22 ensureCapacity_unsynchronized (needed);
23 jchar* dst = elements (value) + count;
24 jchar* src = buffer+11-i;
25 while (--i >= 0)
26 *dst++ = *src++;
27 count = needed;
28 return this;
31 jboolean
32 java::lang::AbstractStringBuffer::regionMatches(jint toffset, jstring other)
34 jint len = other->count;
35 jchar *tptr = elements(value) + toffset;
36 jchar *optr = JvGetStringChars(other);
37 while (--len >= 0)
38 if (*tptr++ != *optr++)
39 return false;
40 return true;