Improve unicode handling

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@10947 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Adam Fedor 2001-09-21 16:13:11 +00:00
parent f8cf838ad5
commit c8fc73d329
6 changed files with 46 additions and 99 deletions

View file

@ -1413,96 +1413,6 @@ static BOOL multi_threaded = NO;
RELEASE(arp);
}
#ifdef BROKEN_NESTED_FUNCTIONS
typedef struct _NSConnection_t {
@defs(NSConnection)
} NSConnection_t;
static NSConnection_t *c_self_t;
static NSPortCoder *op = nil;
static NSPortCoder *ip = nil;
static NSConnection *c_self;
static BOOL is_exception = NO;
static BOOL second_decode = NO;
static int seq_num;
void encoder (int argnum, void *datum, const char *type, int flags)
{
#define ENCODED_ARGNAME @"argument value"
switch (*type)
{
case _C_ID:
if (flags & _F_BYCOPY)
[op encodeBycopyObject: *(id*)datum];
#ifdef _F_BYREF
else if (flags & _F_BYREF)
[op encodeByrefObject: *(id*)datum];
#endif
else
[op encodeObject: *(id*)datum];
break;
default:
[op encodeValueOfObjCType: type at: datum];
}
}
void decoder(int argnum, void *datum, const char *type, int flags)
{
c_self_t = (NSConnection_t *)c_self;
if (type == 0)
{
if (ip != nil)
{
[c_self _doneInRmc: ip];
/* this must be here to avoid trashing alloca'ed retframe */
ip = (id)-1;
c_self_t->_repInCount++; /* received a reply */
}
return;
}
/* If we didn't get the reply packet yet, get it now. */
if (ip == nil)
{
if (c_self_t->_isValid == NO)
{
[NSException raise: NSGenericException
format: @"connection waiting for request was shut down"];
}
ip = [c_self _getReplyRmc: seq_num];
/*
* Find out if the server is returning an exception instead
* of the return values.
*/
[ip decodeValueOfObjCType: @encode(BOOL) at: &is_exception];
if (is_exception == YES)
{
/* Decode the exception object, and raise it. */
id exc;
[ip decodeValueOfObjCType: @encode(id) at: &exc];
[c_self _doneInRmc: ip];
ip = (id)-1;
/* xxx Is there anything else to clean up in
dissect_method_return()? */
[exc raise];
}
}
if (*type == _C_PTR)
else
[ip decodeValueOfObjCType: type+1 at: datum];
[ip decodeValueOfObjCType: type at: datum];
/* -decodeValueOfObjCType:at: malloc's new memory
for pointers. We need to make sure it gets freed eventually
so we don't have a memory leak. Request here that it be
autorelease'ed. Also autorelease created objects. */
if (second_decode == NO)
{
if ((*type == _C_CHARPTR || *type == _C_PTR) && *(void**)datum != 0)
[NSData dataWithBytesNoCopy: *(void**)datum length: 1];
}
else if (*type == _C_ID)
AUTORELEASE(*(id*)datum);
}
#endif
static void retDecoder(DOContext *ctxt)
{
NSPortCoder *coder = ctxt->decoder;