This is the mail archive of the
java-patches@gcc.gnu.org
mailing list for the Java project.
[Patch] Add UnicodeLittleUnmarked output converter...
- From: David Daney <ddaney at avtrex dot com>
- To: Java Patch List <java-patches at gcc dot gnu dot org>
- Date: Wed, 27 Oct 2004 13:30:39 -0700
- Subject: [Patch] Add UnicodeLittleUnmarked output converter...
The attached patch allows me to run jcifs-1.1 (http://jcifs.samba.org) out
of the box.
It adds "UnicodeLittleUnmarked" output encoding. This converter is not
specified in any Sun specifications, but their runtime supports it and
jcifs uses it.
Tested with make check in libjava with no regressions on i686-pc-linux-gnu
OK to commit?
David Daney.
2004-10-27 David Daney <ddaney@avtrex.com>
* gnu/gcj/convert/Output_UnicodeLittleUnmarked.java: New file.
* Makefile.am: Build it.
* Makefile.in: Regenerate.
Index: Makefile.am
===================================================================
RCS file: /cvs/gcc/gcc/libjava/Makefile.am,v
retrieving revision 1.421
diff -c -p -r1.421 Makefile.am
*** Makefile.am 26 Oct 2004 06:08:49 -0000 1.421
--- Makefile.am 27 Oct 2004 19:39:37 -0000
*************** gnu/gcj/convert/Output_ASCII.java \
*** 975,980 ****
--- 975,981 ----
gnu/gcj/convert/Output_EUCJIS.java \
gnu/gcj/convert/Output_JavaSrc.java \
gnu/gcj/convert/Output_SJIS.java \
+ gnu/gcj/convert/Output_UnicodeLittleUnmarked.java \
gnu/gcj/convert/Output_UTF8.java \
gnu/gcj/convert/Output_iconv.java \
gnu/gcj/convert/UnicodeToBytes.java
Index: gnu/gcj/convert/Output_UnicodeLittleUnmarked.java
===================================================================
RCS file: gnu/gcj/convert/Output_UnicodeLittleUnmarked.java
diff -N gnu/gcj/convert/Output_UnicodeLittleUnmarked.java
*** /dev/null 1 Jan 1970 00:00:00 -0000
--- gnu/gcj/convert/Output_UnicodeLittleUnmarked.java 27 Oct 2004 19:39:37 -0000
***************
*** 0 ****
--- 1,41 ----
+ /* Copyright (C) 2004 Free Software Foundation
+
+ This file is part of libgcj.
+
+ This software is copyrighted work licensed under the terms of the
+ Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
+ details. */
+
+ package gnu.gcj.convert;
+
+ /**
+ * Convert to Unicode Little Endian, no marker
+ */
+ public class Output_UnicodeLittleUnmarked extends UnicodeToBytes
+ {
+ public String getName() { return "UnicodeLittleUnmarked"; }
+
+ /** Convert chars to bytes.
+ * Converted bytes are written to buf, starting at count.
+ * @param inbuffer source of characters to convert
+ * @param inpos index of initial character in inbuffer to convert
+ * @param inlength number of characters to convert
+ * @return number of chars converted
+ * Also, this.count is increment by the number of bytes converted.
+ */
+ public int write (char[] inbuffer, int inpos, int inlength)
+ {
+ int avail = buf.length - count;
+ if (inlength * 2 > avail)
+ inlength = avail / 2;
+ for (int i = inlength; i > 0; i--)
+ {
+ char c = inbuffer[inpos++];
+ buf[count] = (byte)c;
+ buf[count+1] = (byte)(c >> 8);
+ count += 2;
+ }
+ return inlength;
+ }
+ }
+