mirror of
https://github.com/gnustep/libs-base.git
synced 2025-05-31 08:41:03 +00:00
Minor fixups
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@23016 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
b3c9994d61
commit
fe47d64ef2
2 changed files with 18 additions and 4 deletions
|
@ -1,3 +1,8 @@
|
||||||
|
2006-06-01 Richard Frith-Macdonald <rfm@gnu.org>
|
||||||
|
|
||||||
|
* Source/GSString.m: Fix position of external function declaration.
|
||||||
|
Fix use gf getCString methods for length error.
|
||||||
|
|
||||||
2006-05-30 David Ayers <d.ayers@inode.at>
|
2006-05-30 David Ayers <d.ayers@inode.at>
|
||||||
|
|
||||||
* Source/GSPrivate.h (GSCharPtr): New union type to handle
|
* Source/GSPrivate.h (GSCharPtr): New union type to handle
|
||||||
|
|
|
@ -52,6 +52,8 @@
|
||||||
|
|
||||||
#include "GSPrivate.h"
|
#include "GSPrivate.h"
|
||||||
|
|
||||||
|
extern BOOL GSEncodingSupported(NSStringEncoding enc);
|
||||||
|
|
||||||
/* memcpy(), strlen(), strcmp() are gcc builtin's */
|
/* memcpy(), strlen(), strcmp() are gcc builtin's */
|
||||||
|
|
||||||
#include "GNUstepBase/Unicode.h"
|
#include "GNUstepBase/Unicode.h"
|
||||||
|
@ -439,6 +441,10 @@ fixBOM(unsigned char **bytes, unsigned *length, BOOL *shouldFree,
|
||||||
void *chars = 0;
|
void *chars = 0;
|
||||||
BOOL flag = NO;
|
BOOL flag = NO;
|
||||||
|
|
||||||
|
if (GSEncodingSupported(encoding) == NO)
|
||||||
|
{
|
||||||
|
return nil; // Invalid encoding
|
||||||
|
}
|
||||||
if (length > 0)
|
if (length > 0)
|
||||||
{
|
{
|
||||||
const void *original = bytes;
|
const void *original = bytes;
|
||||||
|
@ -455,6 +461,10 @@ fixBOM(unsigned char **bytes, unsigned *length, BOOL *shouldFree,
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
/*
|
||||||
|
* The fixBOM() function has already copied the data and allocated
|
||||||
|
* new memory, so we can just pass that to the designated initialiser
|
||||||
|
*/
|
||||||
chars = (void*)bytes;
|
chars = (void*)bytes;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -469,7 +479,6 @@ fixBOM(unsigned char **bytes, unsigned *length, BOOL *shouldFree,
|
||||||
encoding: (NSStringEncoding)encoding
|
encoding: (NSStringEncoding)encoding
|
||||||
freeWhenDone: (BOOL)flag
|
freeWhenDone: (BOOL)flag
|
||||||
{
|
{
|
||||||
extern BOOL GSEncodingSupported(NSStringEncoding enc);
|
|
||||||
GSCharPtr chars = { .u = 0 };
|
GSCharPtr chars = { .u = 0 };
|
||||||
BOOL isASCII = NO;
|
BOOL isASCII = NO;
|
||||||
BOOL isLatin1 = NO;
|
BOOL isLatin1 = NO;
|
||||||
|
@ -4026,7 +4035,7 @@ agree, create a new GSUnicodeInlineString otherwise.
|
||||||
unsigned char tmp = _contents.c[aRange.location + length];
|
unsigned char tmp = _contents.c[aRange.location + length];
|
||||||
|
|
||||||
[aString getCString: (char*)&_contents.c[aRange.location]
|
[aString getCString: (char*)&_contents.c[aRange.location]
|
||||||
maxLength: length
|
maxLength: length+1
|
||||||
encoding: internalEncoding];
|
encoding: internalEncoding];
|
||||||
_contents.c[aRange.location + length] = tmp;
|
_contents.c[aRange.location + length] = tmp;
|
||||||
}
|
}
|
||||||
|
@ -4040,7 +4049,7 @@ agree, create a new GSUnicodeInlineString otherwise.
|
||||||
if (l > 0)
|
if (l > 0)
|
||||||
{
|
{
|
||||||
[aString getCString: (char*)&_contents.c[aRange.location]
|
[aString getCString: (char*)&_contents.c[aRange.location]
|
||||||
maxLength: l
|
maxLength: l+1
|
||||||
encoding: internalEncoding];
|
encoding: internalEncoding];
|
||||||
}
|
}
|
||||||
u = [aString characterAtIndex: l];
|
u = [aString characterAtIndex: l];
|
||||||
|
@ -4106,7 +4115,7 @@ agree, create a new GSUnicodeInlineString otherwise.
|
||||||
if (l > 0)
|
if (l > 0)
|
||||||
{
|
{
|
||||||
[aString getCString: (char*)_contents.c
|
[aString getCString: (char*)_contents.c
|
||||||
maxLength: l
|
maxLength: l+1
|
||||||
encoding: internalEncoding];
|
encoding: internalEncoding];
|
||||||
}
|
}
|
||||||
_contents.c[l]
|
_contents.c[l]
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue