Some warning reduction:
authorMiguel de Icaza <miguel@gnome.org>
Sun, 7 Oct 2001 01:39:01 +0000 (01:39 -0000)
committerMiguel de Icaza <miguel@gnome.org>
Sun, 7 Oct 2001 01:39:01 +0000 (01:39 -0000)
2001-10-07  Miguel de Icaza  <miguel@ximian.com>

* Exception.cs: Implement bits of serialization.

* RuntimeFieldHandle.cs: Implement Serialization features.

* Type.cs: Implement TypeHandle property.

2001-10-07  Miguel de Icaza  <miguel@ximian.com>

* AssemblyBuilder.cs: Reformatted.

Added override keywords to those that needed them.

Removed methods that we do not override, but just inherit

2001-10-07  Miguel de Icaza  <miguel@ximian.com>

* Encoding.cs, UTF8Encoding.cs, UTF7Encoding.cs, ASCIIEncoding.cs,
UnicodeEncoding.cs: Corrected API.

* UTF8Encoding.cs: Checked in changes from Rafael.

svn path=/trunk/mcs/; revision=1113

12 files changed:
mcs/class/corlib/System.IO/FileSystemInfo.cs
mcs/class/corlib/System.Reflection.Emit/AssemblyBuilder.cs
mcs/class/corlib/System.Reflection.Emit/ChangeLog
mcs/class/corlib/System.Text/ASCIIEncoding.cs
mcs/class/corlib/System.Text/Encoding.cs
mcs/class/corlib/System.Text/UTF7Encoding.cs
mcs/class/corlib/System.Text/UTF8Encoding.cs
mcs/class/corlib/System.Text/UnicodeEncoding.cs
mcs/class/corlib/System/ChangeLog
mcs/class/corlib/System/Exception.cs
mcs/class/corlib/System/RuntimeFieldHandle.cs
mcs/class/corlib/System/Type.cs

index 168c0b8844fd0bfddbe4d107d630ab4ba61d121b..2f90d95b6e3d818817b0554a80d6b8f24dcfb6d2 100644 (file)
@@ -166,8 +166,8 @@ namespace System.IO
                                throw new IOException();
                           //break; generates warning CS0162 unreachable code
                        }
-                       inited = true;
                        */
+                       inited = true;
                }
 
                private DateTime c2csharpTime(double seconds)
index 76c6c6db62376b7eddfe4ea6d4247fd88a3eedb3..786f06dfdaf2fae324525ce94d02ce65cd9b30bb 100755 (executable)
@@ -8,177 +8,138 @@ using System.Globalization;
 using System.Runtime.CompilerServices;
 
 namespace System.Reflection.Emit {
+
        public sealed class AssemblyBuilder : Assembly {
                private IntPtr _impl;
                private MethodInfo entry_point;
 
-               public override string CodeBase {get {return null;}}
-               public override MethodInfo EntryPoint {get {return entry_point;}}
-
-               public override string Location {get {return null;}}
+               public override string CodeBase {
+                       get {
+                               return null;
+                       }
+               }
+               
+               public override MethodInfo EntryPoint {
+                       get {
+                               return entry_point;
+                       }
+               }
 
+               public override string Location {
+                       get {
+                               return null;
+                       }
+               }
 
-               public void AddResourceFile( string name, string fileName) {
+               public void AddResourceFile (string name, string fileName)
+               {
                }
-               public void AddResourceFile( string name, string fileName, ResourceAttributes attribute) {
+
+               public void AddResourceFile (string name, string fileName, ResourceAttributes attribute)
+               {
                }
+
                [MethodImplAttribute(MethodImplOptions.InternalCall)]
-               private static extern ModuleBuilder defineModule (AssemblyBuilder ab, string name, string filename);
+               private static extern ModuleBuilder defineModule (AssemblyBuilder ab,
+                                                                 string name,
+                                                                 string filename);
                
-               public ModuleBuilder DefineDynamicModule( string name) {
+               public override ModuleBuilder DefineDynamicModule (string name)
+               {
                        return null;
                }
-               public ModuleBuilder DefineDynamicModule( string name, bool emitSymbolInfo) {
+
+               public override ModuleBuilder DefineDynamicModule (string name, bool emitSymbolInfo)
+               {
                        return null;
                }
-               public ModuleBuilder DefineDynamicModule( string name, string fileName) {
+
+               public ModuleBuilder DefineDynamicModule(string name, string fileName)
+               {
                        return defineModule (this, name, fileName);
                }
-               public ModuleBuilder DefineDynamicModule( string name, string fileName, bool emitSymbolInfo) {
-                       return null;
-               }
-               public IResourceWriter DefineResource( string name, string description, string fileName) {
-                       return null;
-               }
-               public IResourceWriter DefineResource( string name, string description, string fileName, ResourceAttributes attribute) {
-                       return null;
-               }
-               public void DefineUnmanagedResource( byte[] resource) {
-               }
-               public void DefineUnmanagedResource( string resourceFileName) {
-               }
-               public void DefineVersionInfoResource() {
-               }
-               public void DefineVersionInfoResource( string product, string productVersion, string company, string copyright, string trademark) {
-               }
-               public ModuleBuilder GetDynamicModule( string name) {
-                       return null;
-               }
-               public override Type[] GetExportedTypes() {
-                       return null;
-               }
-               public override FileStream GetFile( string name) {
-                       return null;
-               }
-               /*public virtual FileStream[] GetFiles() {
-                       return null;
-               }
-               public override FileStream[] GetFiles( bool getResourceModules) {
-                       return null;
-               }*/
-               public Module[] GetLoadedModules() {
-                       return null;
-               }
-               public Module[] GetLoadedModules( bool getResourceModules) {
-                       return null;
-               }
-               /*public virtual ManifestResourceInfo GetManifestResourceInfo( string resourceName) {
-                       return null;
-               }
-               public virtual string[] GetManifestResourceNames() {
-                       return null;
-               }
-               public virtual Stream GetManifestResourceStream( string name) {
-                       return null;
-               }
-               public virtual Stream GetManifestResourceStream( Type type, string name) {
-                       return null;
-               }*/
-               public Module GetModule( string name) {
-                       return null;
-               }
-               public Module[] GetModules() {
-                       return null;
-               }
-               public Module[] GetModules( bool getResourceModules) {
-                       return null;
-               }
-               /*public virtual AssemblyName GetName() {
-                       return null;
-               }
-               public virtual AssemblyName GetName( bool copiedName) {
-                       return null;
-               }
-               public virtual void GetObjectData( SerializationInfo info, StreamingContext context) {
-               }*/
-               public AssemblyName[] GetReferencedAssemblies() {
-                       return null;
-               }
-               public Assembly GetSatelliteAssembly( CultureInfo culture) {
-                       return null;
-               }
 
-               public Assembly GetSatelliteAssembly( CultureInfo culture, Version version) {
+               public ModuleBuilder DefineDynamicModule (string name, string fileName,
+                                                         bool emitSymbolInfo)
+               {
                        return null;
                }
-               /*public virtual Type GetType( string name) {
+
+               public IResourceWriter DefineResource (string name, string description, string fileName)
+               {
                        return null;
                }
-               public virtual Type GetType( string name, bool throwOnError) {
-                       return null;
-               }*/
-               public Type GetType( string name, bool throwOnError, bool ignoreCase) {
+
+               public IResourceWriter DefineResource (string name, string description,
+                                                      string fileName, ResourceAttributes attribute)
+               {
                        return null;
                }
-               /*public virtual Type[] GetTypes() {
-                       return null;
+
+               public void DefineUnmanagedResource (byte[] resource)
+               {
                }
-               public virtual bool IsDefined( Type attributeType, bool inherit) {
-                       return false;
-               }*/
-               public static Assembly Load( AssemblyName assemblyRef) {
-                       return null;
+
+               public void DefineUnmanagedResource (string resourceFileName)
+               {
                }
 
-               public static Assembly Load( byte[] rawAssembly) {
-                       return null;
+               public void DefineVersionInfoResource ()
+               {
                }
 
-               public static Assembly Load( string assemblyString) {
-                       return null;
+               public void DefineVersionInfoResource (string product, string productVersion,
+                                                      string company, string copyright, string trademark)
+               {
                }
 
-               public static Assembly Load( AssemblyName assemblyRef, Evidence assemblySecurity) {
+               public ModuleBuilder GetDynamicModule (string name)
+               {
                        return null;
                }
 
-               public static Assembly Load( byte[] rawAssembly, byte[] rawSymbolStore) {
+               public override Type[] GetExportedTypes ()
+               {
                        return null;
                }
 
-               public static Assembly Load( string assemblyString, Evidence assemblySecurity) {
+               public override FileStream GetFile (string name)
+               {
                        return null;
                }
 
-               public static Assembly Load( byte[] rawAssembly, byte[] rawSymbolStore, Evidence securityEvidence) {
+               /*public virtual FileStream[] GetFiles() {
                        return null;
                }
-               public static Assembly LoadFrom( string assemblyFile) {
+               public override FileStream[] GetFiles(bool getResourceModules) {
                        return null;
-               }
+               }*/
 
-               public static Assembly LoadFrom( string assemblyFile, Evidence securityEvidence) {
+               /*public virtual ManifestResourceInfo GetManifestResourceInfo(string resourceName)
+                 {
                        return null;
                }
-               public Module LoadModule( string moduleName, byte[] rawModule) {
+               public virtual string[] GetManifestResourceNames() {
                        return null;
                }
-
-               public Module LoadModule( string moduleName, byte[] rawModule, byte[] rawSymbolStore) {
+               public virtual Stream GetManifestResourceStream(string name) {
                        return null;
                }
-               public override string ToString() {
-                       return "AssemblyBuilder";
-               }
-               
+               public virtual Stream GetManifestResourceStream(Type type, string name) {
+                       return null;
+               }*/
+
                [MethodImplAttribute(MethodImplOptions.InternalCall)]
                private static extern int getDataChunk (AssemblyBuilder ab, int type, byte[] buf);
 
-               public void Save( string assemblyFileName) {
+               public void Save (string assemblyFileName)
+               {
                        byte[] buf = new byte[8192];
-                       FileStream file = new FileStream (assemblyFileName, FileMode.OpenOrCreate, FileAccess.Write);
+                       FileStream file;
                        int count;
 
+                       file = new FileStream (assemblyFileName, FileMode.OpenOrCreate, FileAccess.Write);
+
                        count = getDataChunk (this, 0, buf);
                        if (count != 0) {
                                file.Write (buf, 0, count);
@@ -188,7 +149,9 @@ namespace System.Reflection.Emit {
 
                        file.Close ();
                }
-               public void SetEntryPoint(MethodInfo entryMethod) {
+
+               public void SetEntryPoint (MethodInfo entryMethod)
+               {
                        entry_point = entryMethod;
                }
 
index fd6fe83daece1c38d9b8dbcab3cbf33979ac3242..840ddde83a3b4d790f6ee3237164d38a3e2375c2 100644 (file)
@@ -1,3 +1,10 @@
+2001-10-07  Miguel de Icaza  <miguel@ximian.com>
+
+       * AssemblyBuilder.cs: Reformatted.
+
+       Added override keywords to those that needed them.
+
+       Removed methods that we do not override, but just inherit
 
 Tue Sep 25 16:53:08 CEST 2001 Paolo Molaro <lupus@ximian.com>
 
index 2bfe091a40c8d9813a33e26186e157772c283c64..81b8b8bd81ba9f15e4e8fb39aeec1c05bfef97de 100755 (executable)
@@ -21,9 +21,9 @@ namespace System.Text {
                         return 0;
                 }
 
-                public override char[] GetChars(byte[] bytes, int byteIndex, int byteCount, char[] chars, int charIndex) {
+                public override int GetChars(byte[] bytes, int byteIndex, int byteCount, char[] chars, int charIndex) {
                         // FIXME
-                        return null;
+                        return 0;
                 }
 
                 public override int GetMaxByteCount(int charCount) {
index 178975441f3df8e47d520a688392076a6d8da000..3423086138fdb34dcf81917cdc6e7cd5c0e789cc 100755 (executable)
@@ -190,9 +190,9 @@ namespace System.Text {
 
                 public abstract int GetBytes(char[] chars, int charIndex, int charCount, byte[] bytes, int byteIndex);
 
-                public virtual byte[] GetBytes(string s, int charIndex, int charCount, byte[] bytes, int byteIndex) {
+                public virtual int GetBytes(string s, int charIndex, int charCount, byte[] bytes, int byteIndex) {
                         // FIXME
-                        return null;
+                        return 0;
                 }
 
                 public virtual int GetCharCount(byte[] bytes) {
@@ -215,7 +215,7 @@ namespace System.Text {
                         return null;
                 }
 
-                public abstract char[] GetChars(byte[] bytes, int byteIndex, int byteCount, char[] chars, int charIndex);
+                public abstract int GetChars(byte[] bytes, int byteIndex, int byteCount, char[] chars, int charIndex);
 
                 public virtual Decoder GetDecoder() {
                         // FIXME
index c21389b7e8ac92f3d4a9f84db70798cd14725a0b..8ea1b744394b29d972c67c14d24535ad7141e920 100755 (executable)
@@ -21,9 +21,9 @@ namespace System.Text {
                         return 0;
                 }
 
-                public override char[] GetChars(byte[] bytes, int byteIndex, int byteCount, char[] chars, int charIndex) {
+                public override int GetChars(byte[] bytes, int byteIndex, int byteCount, char[] chars, int charIndex) {
                         // FIXME
-                        return null;
+                        return 0;
                 }
 
                 public override int GetMaxByteCount(int charCount) {
index 414e610df97aec7846b6d4b656b3cdff4122fafa..83084e9b846fa36f528d2555578428b02cdf60a9 100755 (executable)
@@ -49,10 +49,8 @@ byte[] bytes, int byteIndex)
                                        }
                                        else
                                        {
-                                               // LAME: if chars[] come as UTF-16 - here we have to decode the 
-surrogate pair, before proceeding
-                                               // charCode = some magic with charCode and (int)chars[++i + charIndex] 
-if needed
+                                               // LAME: if chars[] come as UTF-16 - here we have to decode the surrogate pair, before proceeding
+                                               // charCode = some magic with charCode and (int)chars[++i + charIndex] if needed
                                                if (charCode < 0x10000)
                                                {
                                                        bytes [outputIndex++] = (byte)((charCode >> 12) | 0xE0);
@@ -91,8 +89,7 @@ if needed
                        return (outputIndex - byteIndex);
                }
 
-               public override int GetBytes(string s, int charIndex, int charCount, 
-byte[] bytes, int byteIndex)
+               public override int GetBytes(string s, int charIndex, int charCount, byte[] bytes, int byteIndex)
                {
                                char[] chars = s.ToCharArray(charIndex, charCount);
                                return  GetBytes(chars, 0, charCount, bytes, byteIndex);
index 374c6e1963c321324e60d6659503a17f6123399d..1e08098098c4da52492a0e3a48b4f175317b844f 100755 (executable)
@@ -28,9 +28,9 @@ namespace System.Text {
                         return 0;
                 }
 
-                public override char[] GetChars(byte[] bytes, int byteIndex, int byteCount, char[] chars, int charIndex) {
+                public override int GetChars(byte[] bytes, int byteIndex, int byteCount, char[] chars, int charIndex) {
                         // FIXME
-                        return null;
+                        return 0;
                 }
 
                 public override int GetMaxByteCount(int charCount) {
index 80b921a249083896ab8f13e97f6740f810025840..42339354905ee17f9fe31773092f5adbe25651d8 100644 (file)
@@ -1,3 +1,11 @@
+2001-10-07  Miguel de Icaza  <miguel@ximian.com>
+
+       * Exception.cs: Implement bits of serialization.
+
+       * RuntimeFieldHandle.cs: Implement Serialization features.
+
+       * Type.cs: Implement TypeHandle property.
+
 2001-09-28  Dick Porter  <dick@ximian.com>
 
        * LocalDataStoreSlot.cs: Implemented
index 00994103c41d29eb4d535f2e41ce6cf405e23279..13fca2f80e89e4d210ffa2ec8fe737ab0f1a3e07 100644 (file)
@@ -16,6 +16,7 @@ namespace System {
                Exception inner_exception;
                string message;
                string help_link;
+               string class_name;
                string stack_trace = "TODO: implement stack traces";
                int hresult;
                private string source;
@@ -34,12 +35,15 @@ namespace System {
 
                protected Exception (SerializationInfo info, StreamingContext sc)
                {
-                       if (info == null){
+                       if (info == null)
                                throw new ArgumentNullException ("info");
-                       }
-                       
-                       // TODO: Implement the restoration of an Exception
-                       // from a stream.
+
+                       class_name      = info.GetString ("ClassName");
+                       message         = info.GetString ("Message");
+                       inner_exception = (Exception) info.GetValue  ("InnerException", typeof (Exception));
+                       help_link       = info.GetString ("HelpURL");
+                       stack_trace     = info.GetString ("StackTraceString");
+                       hresult         = info.GetInt32  ("HResult");
                }
 
                public Exception (string msg, Exception e)
index dc259245ebeb3160d9632c444777c09b948e998a..81aa1c366606f4fdda1d329b9cb3363b3fbf782e 100755 (executable)
@@ -20,12 +20,24 @@ namespace System {
                                return (IntPtr) value;
                        }
                }
+
+               RuntimeFieldHandle (SerializationInfo info, StreamingContext context)
+               {
+                       Type t;
+                       
+                       if (info == null)
+                               throw new ArgumentNullException ("info");
+
+                       t = (Type) info.GetValue ("TypeObj", typeof (Type));
+
+                       value = t.TypeHandle.Value;
+                       if (value == (IntPtr) 0)
+                               throw new SerializationException ("Insufficient state");
+               }
                
-                // This is from ISerializable
                 public void GetObjectData (SerializationInfo info, StreamingContext context)
                 {
-                        // TODO: IMPLEMENT ME.
+                       info.AddValue ("TypeObj", value, value.GetType ());
                 }
-
        }
 }
index ade10569455f577669ac60555b72ce1d2141d983..efdc164e571ace48d1b756f41b4bb41fc2e4a0ce 100644 (file)
@@ -19,8 +19,7 @@ namespace System {
        //
        
        public abstract class Type : MemberInfo /* IReflect */ {
-
-               private RuntimeTypeHandle _impl;
+               private RuntimeTypeHandle type_handle;
 
                /// <summary>
                ///   The assembly where the type is defined.
@@ -94,14 +93,22 @@ namespace System {
                [MethodImplAttribute(MethodImplOptions.InternalCall)]
                private static extern Type internal_from_name (string name);
                
-               public static Type GetType(string typeName) {
+               public static Type GetType(string typeName)
+               {
                        return internal_from_name (typeName);
                }
 
-               public static Type GetTypeFromHandle (RuntimeTypeHandle handle) { 
+               public static Type GetTypeFromHandle (RuntimeTypeHandle handle)
+               { 
                        return internal_from_handle (handle);
                }
 
+               public RuntimeTypeHandle TypeHandle {
+                       get {
+                               return type_handle;
+                       }
+               }
+               
                public bool IsValueType {
                        get {
                                // FIXME