Ooops, forgot to commit this file.
authorPaolo Molaro <lupus@oddwiz.org>
Thu, 22 Aug 2002 07:38:57 +0000 (07:38 -0000)
committerPaolo Molaro <lupus@oddwiz.org>
Thu, 22 Aug 2002 07:38:57 +0000 (07:38 -0000)
svn path=/trunk/mcs/; revision=6882

mcs/class/corlib/System.Text/Latin1Encoding.cs

index 8f8020c3881c9f4c816071669714b161da53b667..6bd426761c389b0150d77521ca2e37ffdd7e6e5c 100644 (file)
@@ -2,21 +2,25 @@
  * Latin1Encoding.cs - Implementation of the
  *                     "System.Text.Latin1Encoding" class.
  *
- * Copyright (C) 2002  Southern Storm Software, Pty Ltd.
+ * Copyright (c) 2002  Southern Storm Software, Pty Ltd
  *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
  *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
  *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
  */
 
 namespace System.Text
@@ -271,11 +275,18 @@ internal class Latin1Encoding : Encoding
                                        throw new ArgumentOutOfRangeException
                                                ("count", _("ArgRange_Array"));
                                }
+                               /*String s = String.NewString(count);
                                int posn = 0;
                                while(count-- > 0)
                                {
+                                       s.SetChar(posn++, (char)(bytes[index++]));
+                               }
+                               return s;*/
+                               unsafe {
+                                       fixed (byte *ss = &bytes [0]) {
+                                               return new String ((sbyte*)ss, index, count);
+                                       }
                                }
-                               return null;
                        }
        public override String GetString(byte[] bytes)
                        {
@@ -284,8 +295,19 @@ internal class Latin1Encoding : Encoding
                                        throw new ArgumentNullException("bytes");
                                }
                                int count = bytes.Length;
-                               int posn = 0;
-                               return null;
+                               /*int posn = 0;
+                               String s = String.NewString(count);
+                               while(count-- > 0)
+                               {
+                                       s.SetChar(posn, (char)(bytes[posn]));
+                                       ++posn;
+                               }
+                               return s;*/
+                               unsafe {
+                                       fixed (byte *ss = &bytes [0]) {
+                                               return new String ((sbyte*)ss, 0, count);
+                                       }
+                               }
                        }
 
 #if !ECMA_COMPAT