source: trunk/gcc/libjava/java/lang/natStringBuffer.cc

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: 826 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
7This software is copyrighted work licensed under the terms of the
8Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
9details. */
10
11#include <config.h>
12#include <gcj/cni.h>
13#include <java/lang/StringBuffer.h>
14
15java::lang::StringBuffer*
16java::lang::StringBuffer::append (jint num)
17{
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 JvSynchronize dummy (this);
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}
Note: See TracBrowser for help on using the repository browser.