Various fixes.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@2796 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Adam Fedor 1998-05-13 19:25:38 +00:00
parent 4cf95f8203
commit 65b9b6186c
7 changed files with 61 additions and 31 deletions

View file

@ -1,3 +1,18 @@
Wed May 13 13:18:35 1998 Adam Fedor <fedor@doc.com>
* src/NSArray.m ([NSArray -initWithContentsOfFile:]): Move
definition from NSMutableArray.
* NSBundle.m (+initialize): New method.
(+mainBundle): Use recursive lock.
(-initWithPath:) Likewise.
* Unicode.m (encode_chartouni): Cast char to unsigned before to
unichar (patch provided by David Fritzsche <david@dementia.wupper.de>).
Fri May 1 14:26:50 1998 Masatake Yamato <masata-y@is.aist-nara.ac.jp>
* src/mframe.m(mframe_do_call): before allocating a storage for
returned structure, check stack_argsize.
Mon Apr 27 15:45:00 1998 Richard Frith-Macdonald <richard@brainstorm.co.uk>
* src/include/mframe.h: Added three new functions to enable passing

View file

@ -7,6 +7,15 @@
The currently released version of the library is
@samp{@value{GNUSTEP-BASE-VERSION}}.
@section Noteworthy changes in version @samp{0.5.1}
@itemize @bullet
@item Additional runtime functions for interaction with Guile and
ObjC-Guile library.
#end itemize
@section Noteworthy changes in version @samp{0.5.0}
@itemize @bullet

View file

@ -223,6 +223,25 @@ static Class NSMutableArray_concrete_class;
return self;
}
- initWithContentsOfFile: (NSString*)file
{
NSString *myString;
myString = [[NSString alloc] initWithContentsOfFile:file];
if (myString)
{
id result = [myString propertyList];
if ( [result isKindOfClass: [NSArray class]] )
{
[self initWithArray: result];
return self;
}
}
NSLog(@"Contents of file does not contain an array");
[self dealloc];
return nil;
}
+ arrayWithObjects: firstObject, ...
{
va_list ap;
@ -735,24 +754,6 @@ static Class NSMutableArray_concrete_class;
autorelease];
}
- initWithContentsOfFile: (NSString*)file
{
NSString *myString;
myString = [[NSString alloc] initWithContentsOfFile:file];
if (myString)
{
id result = [myString propertyList];
if ( [result isKindOfClass: [NSArray class]] )
{
[self initWithArray: result];
return self;
}
}
[self dealloc];
return nil;
}
- (BOOL)writeToFile:(NSString *)path atomically:(BOOL)useAuxiliaryFile
{
return [[self description] writeToFile:path atomically:useAuxiliaryFile];

View file

@ -81,9 +81,6 @@
# endif
#endif
#define CHECK_LOCK(lock) \
if (!lock) lock = [NSLock new]
typedef enum {
NSBUNDLE_BUNDLE = 1, NSBUNDLE_APPLICATION, NSBUNDLE_LIBRARY
} bundle_t;
@ -102,7 +99,7 @@ static NSMapTable* _releasedBundles = NULL;
where to store the class names.
*/
static NSBundle* _loadingBundle = nil;
static NSLock* load_lock = nil;
static NSRecursiveLock* load_lock = nil;
static BOOL _strip_after_loading = NO;
static NSString* gnustep_target_dir =
@ -230,12 +227,19 @@ _bundle_load_callback(Class theClass, Category *theCategory)
@implementation NSBundle
+ (void)initialize
{
if (self == [NSBundle class])
{
/* Need to make this recursive since both mainBundle and initWithPath:
want to lock the thread */
lock = [NSRecursiveLock new];
}
}
+ (NSBundle *)mainBundle
{
CHECK_LOCK(load_lock);
[load_lock lock];
if ( !_mainBundle )
{
char *output;
@ -359,7 +363,6 @@ _bundle_load_callback(Class theClass, Category *theCategory)
//return nil;
}
CHECK_LOCK(load_lock);
[load_lock lock];
if (!_bundles)
{

View file

@ -238,6 +238,7 @@ static Class NSMutableDictionary_concrete_class;
return self;
}
}
NSLog(@"Contents of file does not contain a dictionary");
[self autorelease];
return nil;
}

View file

@ -42,24 +42,24 @@ unichar encode_chartouni(char c, NSStringEncoding enc)
if((enc==NSNonLossyASCIIStringEncoding)
|| (enc==NSASCIIStringEncoding)
|| (enc==NSISOLatin1StringEncoding))
return (unichar)c;
return (unichar)((unsigned char)c);
if((enc==NSNEXTSTEPStringEncoding))
if((unsigned char)c<Next_conv_base)
return (unichar)c;
return (unichar)((unsigned char)c);
else
return(Next_char_to_uni_table[(unsigned char)c - Next_conv_base]);
if((enc==NSCyrillicStringEncoding))
if((unsigned char)c<Cyrillic_conv_base)
return (unichar)c;
return (unichar)((unsigned char)c);
else
return(Cyrillic_char_to_uni_table[(unsigned char)c - Cyrillic_conv_base]);
#if 0
if((enc==NSSymbolStringEncoding))
if((unsigned char)c<Symbol_conv_base)
return (unichar)c;
return (unichar)((unsigned char)c);
else
return(Symbol_char_to_uni_table[(unsigned char)c - Symbol_conv_base]);
#endif

View file

@ -529,7 +529,8 @@ mframe_do_call_opts (const char *encoded_types,
if (*type == _C_STRUCT_B || *type == _C_UNION_B || *type == _C_ARY_B) {
/* If we are passing a pointer to return a structure in, we must allocate
the memory for it and put it at the start of the argframe. */
*(void**)argframe->arg_ptr = alloca(objc_sizeof_type(type));
if (stack_argsize)
*(void**)argframe->arg_ptr = alloca(objc_sizeof_type(type));
}
/* Put OBJECT and SELECTOR into the ARGFRAME. */