mirror of
https://github.com/gnustep/libs-gsweb.git
synced 2025-02-21 02:41:04 +00:00
* GSWeb.framework/NSString+HTML.m
o fixes in GSWMemMove and testStringByConvertingHTML git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gsweb/trunk@20924 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
ca9665c10c
commit
31b00db975
2 changed files with 31 additions and 10 deletions
|
@ -1,3 +1,8 @@
|
|||
2005-03-18 Manuel Guesdon <mguesdon@orange-concept.com>
|
||||
* GSWeb.framework/NSString+HTML.m
|
||||
o fixes in GSWMemMove and
|
||||
testStringByConvertingHTML
|
||||
|
||||
2005-03-11 David Wetzel <dave@turbocat.de>
|
||||
* GSWeb.framework/GSWRequest.m
|
||||
o changes to support various encodings in GSMime
|
||||
|
|
|
@ -295,22 +295,34 @@ void NSStringHTML_Initialize()
|
|||
#define GSWMemMove(dst,src,size); \
|
||||
{ \
|
||||
int __size=(size); \
|
||||
unsigned char* __src=((char*)(src)); \
|
||||
unsigned char* __dst=((char*)(dst)); \
|
||||
unsigned char* __pDst=__dst+__size; \
|
||||
unsigned char* __pSrc=((char*)(src))+__size; \
|
||||
while(__pDst>=__dst) *__pDst--=*__pSrc--; \
|
||||
unsigned char* __pDst=__dst+__size-1; \
|
||||
unsigned char* __pSrc=__src+__size-1; \
|
||||
if (__dst>__src) \
|
||||
while(__pDst>=__dst) { *__pDst--=*__pSrc--; } \
|
||||
else \
|
||||
while(__pDst>=__dst) { *__dst++=*__src++; }; \
|
||||
};
|
||||
|
||||
#define HTML_TEST_STRINGS @"(\"\", \
|
||||
\"ABCDEF\", \
|
||||
\"&12\\U00E9\", \
|
||||
\"&\n1\", \
|
||||
\"&\r\n2\\U00E8\", \
|
||||
\"<ee>\")"
|
||||
|
||||
void testStringByConvertingHTML()
|
||||
{
|
||||
NSString* strings[] = { @"", @"ABCDEF", @"&12é" , @"&\n1", @"&\r\n2è", @"Relation \"eoseq_display_component\" does not exist" };
|
||||
NSArray* testStrings=[HTML_TEST_STRINGS propertyList];
|
||||
int i=0;
|
||||
for(i=0;i<(sizeof(strings)/sizeof(NSString*));i++)
|
||||
for(i=0;i<[testStrings count];i++)
|
||||
{
|
||||
NSString* result=[strings[i] stringByConvertingToHTML];
|
||||
NSString* string=[testStrings objectAtIndex:i];
|
||||
NSString* result=[string stringByConvertingToHTML];
|
||||
NSString* reverse=[result stringByConvertingFromHTML];
|
||||
NSDebugFLog(@"RESULT: %d: '%@' => '%@'",i,strings[i],result);
|
||||
NSDebugFLog(@"Reverce RESULT: %d: '%@' => '%@'",i,result,reverse);
|
||||
NSDebugFLog(@"RESULT: %d: '%@' => '%@'",i,string,result);
|
||||
NSDebugFLog(@"Reverse RESULT: %d: '%@' => '%@'",i,result,reverse);
|
||||
};
|
||||
};
|
||||
|
||||
|
@ -408,14 +420,16 @@ NSString* baseStringByConvertingToHTML(NSString* string,GSWHTMLConvertingStruct*
|
|||
allocOrReallocUnicharString(&pString,&capacity,length,capacity+allocMargin);
|
||||
NSDebugFLog(@"0==> %@",[NSString stringWithCharacters:pString
|
||||
length:length]);
|
||||
NSDebugFLog(@"Copy %d characters from pos %d to pos %d",(length-i-srcLen),i+srcLen,i+dstLen);
|
||||
GSWMemMove(pString+i+dstLen,pString+i+srcLen,sizeof(unichar)*(length-i-srcLen));
|
||||
NSDebugFLog(@"1==> %@",[NSString stringWithCharacters:pString
|
||||
length:length+dstLen-srcLen]);
|
||||
NSDebugFLog(@"Copy %d characters to pos %d",dstLen,i);
|
||||
GSWMemMove(pString+i,dstChars,sizeof(unichar)*dstLen);
|
||||
i+=dstLen;
|
||||
length+=dstLen-srcLen;
|
||||
NSDebugFLog(@"2==> i=%d %@",i,[NSString stringWithCharacters:pString
|
||||
length:length]);
|
||||
NSDebugFLog(@"2==> i=%d length=%d %@",i,length,[NSString stringWithCharacters:pString
|
||||
length:length]);
|
||||
|
||||
}
|
||||
else
|
||||
|
@ -555,9 +569,11 @@ NSString* baseStringByConvertingFromHTML(NSString* string,GSWHTMLConvertingStruc
|
|||
length:length]);
|
||||
NSDebugFLog(@"0==> %@",[NSString stringWithCharacters:pString
|
||||
length:length]);
|
||||
NSDebugFLog(@"Copy %d characters from pos %d to pos %d",(length-i-srcLen),i+srcLen,i+dstLen);
|
||||
GSWMemMove(pString+i+dstLen,pString+i+srcLen,sizeof(unichar)*(length-i-srcLen));
|
||||
NSDebugFLog(@"1==> %@",[NSString stringWithCharacters:pString
|
||||
length:length+dstLen-srcLen]);
|
||||
NSDebugFLog(@"Copy %d characters to pos %d",dstLen,i);
|
||||
GSWMemMove(pString+i,&dstUnichar,sizeof(unichar)*dstLen);
|
||||
i+=dstLen;
|
||||
length+=dstLen-srcLen;
|
||||
|
|
Loading…
Reference in a new issue