Small fixes and optimizations

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gsweb/trunk@21155 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Manuel Guesdon 2005-04-24 12:12:16 +00:00
parent 7fa7771df6
commit c1c4332dc8
11 changed files with 158 additions and 69 deletions

View file

@ -1,3 +1,31 @@
2005-04-24 Manuel Guesdon <mguesdon@orange-concept.com>
* GSWeb.framework/GSWMessage.m:
o fixed indentation and double ;;
* GSWeb.framework/GSWPopUpButton.m:
o fix in comments
o fix output in -appendToResponse:inContext:
o avoid string formatting
* GSWeb.framework/GSWSessionTimeOut.m:
o improved logs
* GSWeb.framework/GSWTemplateParser.h
o added +templateWithHTMLString:declarationString:languages:
declaration
* GSWeb.framework/GSWURLValuedElementData.m:
o avoid string formatting
* GSWeb.framework/GSWUtils.h:
o replaced ClassIsKindOfClass() by GSObjCIsKindOf()
* GSWeb.framework/GSWUtils.m:
o removed ClassIsKindOfClass
o fixed GSWTime_format()
o implemented missing methods in NSFooNumberFormatter
o avoid string formatting
* GSWeb.framework/GSWSessionTimeOutManager.m:
o use +logString: instead of +logWithFormat:
* GSWeb.framework/NSString+HTML.m:
o commented debug logs
* GSWeb.framework/GSWResourceManager.m:
o fixes for warnings
2005-04-24 Manuel Guesdon <mguesdon@orange-concept.com> 2005-04-24 Manuel Guesdon <mguesdon@orange-concept.com>
* GSWeb.framework/GSWHyperlink.m: * GSWeb.framework/GSWHyperlink.m:
o removed -hrefInContext: o removed -hrefInContext:

View file

@ -911,7 +911,7 @@ static __inline__ NSMutableData *_checkBody(GSWMessage *self) {
if (aValue) if (aValue)
{ {
NSData* ad=[aValue dataUsingEncoding:NSASCIIStringEncoding NSData* ad=[aValue dataUsingEncoding:NSASCIIStringEncoding
allowLossyConversion:YES];; allowLossyConversion:YES];
(*_contentDataADImp)(_contentData,appendDataSel,ad); (*_contentDataADImp)(_contentData,appendDataSel,ad);
@ -929,7 +929,7 @@ NSData* ad=[aValue dataUsingEncoding:NSASCIIStringEncoding
int length = 0; int length = 0;
int i = 0; int i = 0;
int ch = 0; int ch = 0;
********
lossyCString = [aValue lossyCString]; lossyCString = [aValue lossyCString];
length = strlen(lossyCString); length = strlen(lossyCString);

View file

@ -49,7 +49,10 @@ Bindings
selection Selected object (used to pre-select item and modified to reflect user choice) selection Selected object (used to pre-select item and modified to reflect user choice)
It contains object from list, not value binding evaluated one ! It contains object from list, not value binding evaluated one !
selectedValue Array of pre selected values (not objects !) selectedValue Pre selected value (not object !)
selectionValue Selected value (used to pre-select item and modified to reflect user choice)
It contains object from list, not value binding evaluated one !
name Name of the element in the form (should be unique). If not specified, GSWeb assign one. name Name of the element in the form (should be unique). If not specified, GSWeb assign one.
@ -295,9 +298,9 @@ static SEL valueInComponentSEL = NULL;
{ {
GSWResponse_appendContentAsciiString(aResponse,@"\n<OPTION"); GSWResponse_appendContentAsciiString(aResponse,@"\n<OPTION");
if (_selectedValue && !selectedValueValue) if (_selectedValue && !selectedValueValue)
GSWResponse_appendContentAsciiString(aResponse,@" selected>");//TODO GSWResponse_appendContentAsciiString(aResponse,@" selected value=\"\">");
else else
GSWResponse_appendContentCharacter(aResponse,'>'); GSWResponse_appendContentAsciiString(aResponse,@" value=\"\">");
if (escapeHTMLBoolValue) if (escapeHTMLBoolValue)
noSelectionStringValue=GSWResponse_stringByEscapingHTMLString(aResponse,noSelectionStringValue); noSelectionStringValue=GSWResponse_stringByEscapingHTMLString(aResponse,noSelectionStringValue);
@ -439,7 +442,8 @@ static SEL valueInComponentSEL = NULL;
#ifndef ENABLE_OPTGROUP #ifndef ENABLE_OPTGROUP
if (optGroupLabel) if (optGroupLabel)
{ {
displayStringValue=[NSString stringWithFormat:@"%@ --",displayStringValue]; displayStringValue=NSStringWithObject(displayStringValue);
displayStringValue=[displayStringValue stringByAppendingString:@" --"];
}; };
#endif #endif
GSWResponse_appendContentString(aResponse,displayStringValue); GSWResponse_appendContentString(aResponse,displayStringValue);

View file

@ -1,6 +1,6 @@
/** GSWResourceManager.m - <title>GSWeb: Class GSWResourceManager</title> /** GSWResourceManager.m - <title>GSWeb: Class GSWResourceManager</title>
Copyright (C) 1999-2004 Free Software Foundation, Inc. Copyright (C) 1999-2005 Free Software Foundation, Inc.
Written by: Manuel Guesdon <mguesdon@orange-concept.com> Written by: Manuel Guesdon <mguesdon@orange-concept.com>
Date: Jan 1999 Date: Jan 1999
@ -711,12 +711,18 @@ NSString* localNotFoundMarker=@"NOTFOUND";
inFramework:(NSString*)aFrameworkName inFramework:(NSString*)aFrameworkName
language:(NSString*)aLanguage language:(NSString*)aLanguage
{ {
//OK
NSDictionary* stringsTable=nil; NSDictionary* stringsTable=nil;
NSDictionary* stringsTablesForFramework=nil;
NSDictionary* stringsTablesForFrameworkAndLanguage=nil;
LOGObjectFnStart(); LOGObjectFnStart();
stringsTable=[[[_stringsTablesByFrameworkByLanguageByName objectForKey:aFrameworkName] stringsTablesForFramework=[_stringsTablesByFrameworkByLanguageByName
objectForKey:aLanguage] objectForKey:aFrameworkName];
stringsTablesForFrameworkAndLanguage=[stringsTablesForFramework
objectForKey:aLanguage];
stringsTable=[stringsTablesForFrameworkAndLanguage
objectForKey:aTableName]; objectForKey:aTableName];
if (!stringsTable) if (!stringsTable)
stringsTable=[self lockedStringsTableWithName:aTableName stringsTable=[self lockedStringsTableWithName:aTableName
inFramework:aFrameworkName inFramework:aFrameworkName
@ -739,12 +745,21 @@ NSString* localNotFoundMarker=@"NOTFOUND";
inFramework:(NSString*)aFrameworkName inFramework:(NSString*)aFrameworkName
language:(NSString*)aLanguage language:(NSString*)aLanguage
{ {
//OK
NSArray* stringsTableArray=nil; NSArray* stringsTableArray=nil;
NSDictionary* stringsTableArraysForFramework=nil;
NSDictionary* stringsTableArraysForFrameworkAndLanguage=nil;
LOGObjectFnStart(); LOGObjectFnStart();
stringsTableArray=[[[_stringsTableArraysByFrameworkByLanguageByName objectForKey:aFrameworkName]
objectForKey:aLanguage] stringsTableArraysForFramework=
[_stringsTableArraysByFrameworkByLanguageByName
objectForKey:aFrameworkName];
stringsTableArraysForFrameworkAndLanguage=
[stringsTableArraysForFramework objectForKey:aLanguage];
stringsTableArray=[stringsTableArraysForFrameworkAndLanguage
objectForKey:aTableName]; objectForKey:aTableName];
if (!stringsTableArray) if (!stringsTableArray)
stringsTableArray=[self lockedStringsTableArrayWithName:aTableName stringsTableArray=[self lockedStringsTableArrayWithName:aTableName
inFramework:aFrameworkName inFramework:aFrameworkName

View file

@ -1,6 +1,6 @@
/** GSWSessionTimeOut.m - <title>GSWeb: Class GSWSessionTimeOut</title> /** GSWSessionTimeOut.m - <title>GSWeb: Class GSWSessionTimeOut</title>
Copyright (C) 1999-2003 Free Software Foundation, Inc. Copyright (C) 1999-2004 Free Software Foundation, Inc.
Written by: Manuel Guesdon <mguesdon@orange-concept.com> Written by: Manuel Guesdon <mguesdon@orange-concept.com>
Date: Mar 1999 Date: Mar 1999
@ -48,8 +48,11 @@ RCS_ID("$Id$")
ASSIGN(_sessionID,aSessionID); ASSIGN(_sessionID,aSessionID);
_lastAccessTime=aTime; _lastAccessTime=aTime;
_timeOut=aTimeOutInterval; _timeOut=aTimeOutInterval;
NSDebugMLog(@"_lastAccessTime=%f",_lastAccessTime); NSDebugMLLog(@"sessions",@"_lastAccessTime=%f (%@)",
NSDebugMLog(@"_timeOut=%f",_timeOut); _lastAccessTime,
[NSDate dateWithTimeIntervalSinceReferenceDate:_lastAccessTime]);
NSDebugMLLog(@"sessions",@"_timeOut=%f s",
_timeOut);
}; };
return self; return self;
}; };
@ -116,7 +119,8 @@ RCS_ID("$Id$")
-(void)setSessionTimeOut:(NSTimeInterval)aTimeOutInterval -(void)setSessionTimeOut:(NSTimeInterval)aTimeOutInterval
{ {
_timeOut=aTimeOutInterval; _timeOut=aTimeOutInterval;
NSDebugMLog(@"_timeOut=%f",_timeOut); NSDebugMLLog(@"sessions",@"_timeOut=%f s",
_timeOut);
}; };
//-------------------------------------------------------------------- //--------------------------------------------------------------------
@ -129,7 +133,9 @@ RCS_ID("$Id$")
-(void)setLastAccessTime:(NSTimeInterval)aTime -(void)setLastAccessTime:(NSTimeInterval)aTime
{ {
_lastAccessTime=aTime; _lastAccessTime=aTime;
NSDebugMLog(@"_lastAccessTime=%f",_lastAccessTime); NSDebugMLLog(@"sessions",@"_lastAccessTime=%f (%@)",
_lastAccessTime,
[NSDate dateWithTimeIntervalSinceReferenceDate:_lastAccessTime]);
}; };
//-------------------------------------------------------------------- //--------------------------------------------------------------------
@ -156,11 +162,13 @@ RCS_ID("$Id$")
return [NSDate dateWithTimeIntervalSinceReferenceDate:_lastAccessTime+_timeOut]; return [NSDate dateWithTimeIntervalSinceReferenceDate:_lastAccessTime+_timeOut];
}; };
//--------------------------------------------------------------------
-(BOOL)isCheckedOut -(BOOL)isCheckedOut
{ {
return _isCheckedOut; return _isCheckedOut;
}; };
//--------------------------------------------------------------------
-(void)setIsCheckedOut:(BOOL)isCheckOut -(void)setIsCheckedOut:(BOOL)isCheckOut
{ {
_isCheckedOut=isCheckOut; _isCheckedOut=isCheckOut;

View file

@ -1,6 +1,6 @@
/** GSWSessionTimeOutManager.m - <title>GSWeb: Class GSWSessionTimeOutManager</title> /** GSWSessionTimeOutManager.m - <title>GSWeb: Class GSWSessionTimeOutManager</title>
Copyright (C) 1999-2004 Free Software Foundation, Inc. Copyright (C) 1999-2005 Free Software Foundation, Inc.
Written by: Manuel Guesdon <mguesdon@orange-concept.com> Written by: Manuel Guesdon <mguesdon@orange-concept.com>
Date: Mar 1999 Date: Mar 1999
@ -130,17 +130,26 @@ RCS_ID("$Id$")
{ {
NSTimer* timer=nil; NSTimer* timer=nil;
GSWSessionTimeOut* sessionTimeOut=nil; GSWSessionTimeOut* sessionTimeOut=nil;
NSDebugMLLog(@"sessions",@"timeOut=%ld",(long)timeOut);
NSDebugMLLog(@"sessions",@"timeOut=%ld s",
(long)timeOut);
sessionTimeOut=[self _sessionTimeOutForSessionID:sessionID]; sessionTimeOut=[self _sessionTimeOutForSessionID:sessionID];
NSDebugMLLog(@"sessions",@"sessionTimeOut=%@",sessionTimeOut); NSDebugMLLog(@"sessions",@"sessionTimeOut=%@",sessionTimeOut);
NSDebugMLLog(@"sessions",@"self=%p _sessionOrderedTimeOuts %p=%@", NSDebugMLLog(@"sessions",@"self=%p _sessionOrderedTimeOuts %p=%@",
self,_sessionOrderedTimeOuts,_sessionOrderedTimeOuts); self,_sessionOrderedTimeOuts,_sessionOrderedTimeOuts);
NSAssert(sessionTimeOut,@"No sessionTimeOut"); NSAssert(sessionTimeOut,@"No sessionTimeOut");
[_sessionOrderedTimeOuts removeObject:sessionTimeOut]; [_sessionOrderedTimeOuts removeObject:sessionTimeOut];
[sessionTimeOut setLastAccessTime:[NSDate timeIntervalSinceReferenceDate]];
[sessionTimeOut setLastAccessTime:
[NSDate timeIntervalSinceReferenceDate]];
if (timeOut!=[sessionTimeOut sessionTimeOut]) if (timeOut!=[sessionTimeOut sessionTimeOut])
[sessionTimeOut setSessionTimeOut:timeOut]; [sessionTimeOut setSessionTimeOut:timeOut];
[_sessionOrderedTimeOuts addObject:sessionTimeOut]; [_sessionOrderedTimeOuts addObject:sessionTimeOut];
NSDebugMLLog(@"sessions",@"self=%p sessionOrderedTimeOuts %p=%@", NSDebugMLLog(@"sessions",@"self=%p sessionOrderedTimeOuts %p=%@",
@ -561,7 +570,7 @@ RCS_ID("$Id$")
NSDebugMLLog(@"sessions",@"Start startHandleTimerRefusingSessions"); NSDebugMLLog(@"sessions",@"Start startHandleTimerRefusingSessions");
//NSLog(@"---Start startHandleTimerRefusingSessions"); //NSLog(@"---Start startHandleTimerRefusingSessions");
//[GSWApplication statusLogWithFormat:@"Start startHandleTimerRefusingSessions"]; //[GSWApplication statusLogString:@"Start startHandleTimerRefusingSessions"];
//LOGObjectFnStart(); //LOGObjectFnStart();
[self lock]; [self lock];
/* /*
@ -587,7 +596,7 @@ RCS_ID("$Id$")
[self unlock]; [self unlock];
//LOGObjectFnStop(); //LOGObjectFnStop();
//[GSWApplication statusLogWithFormat:@"Stop startHandleTimerRefusingSessions"]; //[GSWApplication statusLogString:@"Stop startHandleTimerRefusingSessions"];
//NSLog(@"---Stop startHandleTimerRefusingSessions"); //NSLog(@"---Stop startHandleTimerRefusingSessions");
} }
@ -611,7 +620,7 @@ RCS_ID("$Id$")
NSDebugMLLog(@"sessions",@"timer tisn=%f",[[aTimer fireDate]timeIntervalSinceNow]); NSDebugMLLog(@"sessions",@"timer tisn=%f",[[aTimer fireDate]timeIntervalSinceNow]);
//OK //OK
//NSLog(@"-Start HandleTimerRefusingSessions"); //NSLog(@"-Start HandleTimerRefusingSessions");
//[GSWApplication statusLogWithFormat:@"-Start HandleTimerRefusingSessions"]; //[GSWApplication statusLogString:@"-Start HandleTimerRefusingSessions"];
//[GSWApp lockRequestHandling]; //[GSWApp lockRequestHandling];
if ([self tryLockBeforeTimeIntervalSinceNow:1])//Try locking before 1s if ([self tryLockBeforeTimeIntervalSinceNow:1])//Try locking before 1s
{ {
@ -739,7 +748,7 @@ RCS_ID("$Id$")
}; };
//[GSWApp unlockRequestHandling]; //[GSWApp unlockRequestHandling];
//[GSWApplication statusLogWithFormat:@"-Stop HandleTimerRefusingSessions"]; //[GSWApplication statusLogString:@"-Stop HandleTimerRefusingSessions"];
//NSLog(@"-Stop HandleTimerRefusingSessions"); //NSLog(@"-Stop HandleTimerRefusingSessions");
}; };

View file

@ -174,6 +174,11 @@ Creates a GSWHTMLComment with the comment text
declarationsPath:(NSString*)aDeclarationsPath; declarationsPath:(NSString*)aDeclarationsPath;
+(GSWTemplateParserType)templateParserTypeFromString:(NSString*)string; +(GSWTemplateParserType)templateParserTypeFromString:(NSString*)string;
+(GSWTemplateParserType)defaultTemplateParserType; +(GSWTemplateParserType)defaultTemplateParserType;
+(GSWElement*)templateWithHTMLString:(NSString *)HTMLString
declarationString:(NSString *)declarationsString
languages:(NSArray *)languages;
-(id)initWithTemplateName:(NSString*)aName -(id)initWithTemplateName:(NSString*)aName
inFrameworkName:(NSString*)aFrameworkName inFrameworkName:(NSString*)aFrameworkName
withString:(NSString*)HTMLString withString:(NSString*)HTMLString

View file

@ -1,6 +1,6 @@
/** GSWURLValuedElementData.m - <title>GSWeb: Class GSWURLValuedElementData</title> /** GSWURLValuedElementData.m - <title>GSWeb: Class GSWURLValuedElementData</title>
Copyright (C) 1999-2003 Free Software Foundation, Inc. Copyright (C) 1999-2005 Free Software Foundation, Inc.
Written by: Manuel Guesdon <mguesdon@orange-concept.com> Written by: Manuel Guesdon <mguesdon@orange-concept.com>
Date: Jan 1999 Date: Jan 1999
@ -110,7 +110,7 @@ RCS_ID("$Id$")
} }
else else
[response setContent:data]; [response setContent:data];
[response setHeader:[NSString stringWithFormat:@"%u",[data length]] [response setHeader:GSWIntToNSString((int)[data length])
forKey:@"content-length"]; forKey:@"content-length"];
[response setHeader:_mimeType [response setHeader:_mimeType

View file

@ -85,7 +85,7 @@ GSWEB_EXPORT char* GSWIntToString(char* buffer,unsigned int bufferSize,int value
GSWEB_EXPORT NSString* GSWIntToNSString(int value); GSWEB_EXPORT NSString* GSWIntToNSString(int value);
GSWEB_EXPORT NSNumber* GSWIntNumber(int value); GSWEB_EXPORT NSNumber* GSWIntNumber(int value);
GSWEB_EXPORT BOOL ClassIsKindOfClass(Class classA,Class classB); #define ClassIsKindOfClass(classA,classB) GSObjCIsKindOf(classA,classB)
typedef long long GSWTime; // usec since Epoch typedef long long GSWTime; // usec since Epoch

View file

@ -254,20 +254,6 @@ NSNumber* GSWIntNumber(int value)
return (*numberWithIntIMP)(nsNumberClass,numberWithIntSEL,value); return (*numberWithIntIMP)(nsNumberClass,numberWithIntSEL,value);
}; };
//--------------------------------------------------------------------
BOOL ClassIsKindOfClass(Class classA,Class classB)
{
Class class;
for (class = classA;
class != Nil;
class = class_get_super_class (class))
{
if (class == classB)
return YES;
}
return NO;
};
//-------------------------------------------------------------------- //--------------------------------------------------------------------
GSWTime GSWTime_now() GSWTime GSWTime_now()
{ {
@ -332,9 +318,9 @@ NSString* GSWTime_format(GSWTime t)
sDate[17] = stTM.tm_sec / 10 + '0'; sDate[17] = stTM.tm_sec / 10 + '0';
sDate[18] = stTM.tm_sec % 10 + '0'; sDate[18] = stTM.tm_sec % 10 + '0';
sDate[19] = '.'; sDate[19] = '.';
sDate[20] = (timeMSecPart/1000) / 100 + '0'; sDate[20] = timeMSecPart / 100 + '0';
sDate[21] = ((timeMSecPart/1000) % 100) / 10 + '0'; sDate[21] = (timeMSecPart % 100) / 10 + '0';
sDate[22] = (timeMSecPart/1000) % 10 + '0'; sDate[22] = timeMSecPart % 10 + '0';
sDate[23] = 0; sDate[23] = 0;
return (*nsString_stringWithCString_lengthIMP)(nsStringClass,stringWithCString_lengthSEL, return (*nsString_stringWithCString_lengthIMP)(nsStringClass,stringWithCString_lengthSEL,
@ -1861,6 +1847,34 @@ NSString* GSWGetDefaultDocRoot()
return self; return self;
}; };
//--------------------------------------------------------------------
-(id)copyWithZone:(NSZone*)zone
{
NSFooNumberFormatter* clone = [[isa allocWithZone:zone] init];
if (clone)
{
clone->_type=_type;
};
return clone;
};
//--------------------------------------------------------------------
-(void)encodeWithCoder:(NSCoder*)coder
{
[super encodeWithCoder:coder];
[coder encodeValueOfObjCType: @encode(int) at: &_type];
}
//--------------------------------------------------------------------
-(id)initWithCoder: (NSCoder*)coder
{
if (([super initWithCoder:coder]))
{
[coder decodeValueOfObjCType: @encode(int) at: &_type];
};
return self;
}
//-------------------------------------------------------------------- //--------------------------------------------------------------------
-(NSString*)stringForObjectValue:(id)anObject -(NSString*)stringForObjectValue:(id)anObject
{ {
@ -1909,7 +1923,7 @@ NSString* GSWGetDefaultDocRoot()
else if ([anObject respondsToSelector:@selector(intValue)]) else if ([anObject respondsToSelector:@selector(intValue)])
{ {
int value=[anObject intValue]; int value=[anObject intValue];
string=(*nsString_stringWithFormatIMP)(nsStringClass,stringWithFormatSEL,@"%d.00",value); string=[GSWIntToNSString(value) stringByAppendingString:@".00"];
} }
else if ([anObject respondsToSelector:@selector(floatValue)]) else if ([anObject respondsToSelector:@selector(floatValue)])
{ {

View file

@ -1,6 +1,6 @@
/** NSString+HTML.m - <title>GSWeb: NSString / HTML</title> /** NSString+HTML.m - <title>GSWeb: NSString / HTML</title>
Copyright (C) 1999-2004 Free Software Foundation, Inc. Copyright (C) 1999-2005 Free Software Foundation, Inc.
Written by: Manuel Guesdon <mguesdon@orange-concept.com> Written by: Manuel Guesdon <mguesdon@orange-concept.com>
Date: Jan 1999 Date: Jan 1999
@ -368,12 +368,12 @@ NSString* baseStringByConvertingToHTML(NSString* string,GSWHTMLConvertingStruct*
int allocMargin=max(128,length/2); int allocMargin=max(128,length/2);
allocOrReallocUnicharString(&pString,&capacity,0,length+1+allocMargin); allocOrReallocUnicharString(&pString,&capacity,0,length+1+allocMargin);
[string getCharacters:pString]; [string getCharacters:pString];
NSDebugFLog(@"string=%@",string); //NSDebugFLog(@"string=%@",string);
while(i<length) while(i<length)
{ {
srcLen=0; srcLen=0;
unichar c=pString[i]; unichar c=pString[i];
NSDebugFLog(@"i=%d: c=%c",i,(char)c); //NSDebugFLog(@"i=%d: c=%c",i,(char)c);
if (includeCRLF && c=='\r') if (includeCRLF && c=='\r')
{ {
if (i<(length-1) if (i<(length-1)
@ -411,25 +411,25 @@ NSString* baseStringByConvertingToHTML(NSString* string,GSWHTMLConvertingStruct*
}; };
if (srcLen>0) if (srcLen>0)
{ {
NSDebugFLog(@"i=%d j=%d: srcLen=%d dstLen=%d by '%@'",i,j,srcLen,dstLen,[NSString stringWithCharacters:dstChars /*NSDebugFLog(@"i=%d j=%d: srcLen=%d dstLen=%d by '%@'",i,j,srcLen,dstLen,[NSString stringWithCharacters:dstChars
length:dstLen]); length:dstLen]);*/
changed=YES; changed=YES;
NSDebugFLog(@"-1==> %@",[NSString stringWithCharacters:pString /*NSDebugFLog(@"-1==> %@",[NSString stringWithCharacters:pString
length:length]); length:length]);*/
if (length+1+dstLen-srcLen>capacity) if (length+1+dstLen-srcLen>capacity)
allocOrReallocUnicharString(&pString,&capacity,length,capacity+allocMargin); allocOrReallocUnicharString(&pString,&capacity,length,capacity+allocMargin);
NSDebugFLog(@"0==> %@",[NSString stringWithCharacters:pString /*NSDebugFLog(@"0==> %@",[NSString stringWithCharacters:pString
length:length]); length:length]);
NSDebugFLog(@"Copy %d characters from pos %d to pos %d",(length-i-srcLen),i+srcLen,i+dstLen); 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)); GSWMemMove(pString+i+dstLen,pString+i+srcLen,sizeof(unichar)*(length-i-srcLen));
NSDebugFLog(@"1==> %@",[NSString stringWithCharacters:pString /*NSDebugFLog(@"1==> %@",[NSString stringWithCharacters:pString
length:length+dstLen-srcLen]); length:length+dstLen-srcLen]);
NSDebugFLog(@"Copy %d characters to pos %d",dstLen,i); NSDebugFLog(@"Copy %d characters to pos %d",dstLen,i);*/
GSWMemMove(pString+i,dstChars,sizeof(unichar)*dstLen); GSWMemMove(pString+i,dstChars,sizeof(unichar)*dstLen);
i+=dstLen; i+=dstLen;
length+=dstLen-srcLen; length+=dstLen-srcLen;
NSDebugFLog(@"2==> i=%d length=%d %@",i,length,[NSString stringWithCharacters:pString /*NSDebugFLog(@"2==> i=%d length=%d %@",i,length,[NSString stringWithCharacters:pString
length:length]); length:length]);*/
} }
else else
@ -532,12 +532,12 @@ NSString* baseStringByConvertingFromHTML(NSString* string,GSWHTMLConvertingStruc
int i=0; int i=0;
int j=0; int j=0;
[string getCharacters:pString]; [string getCharacters:pString];
NSDebugFLog(@"string=%@",string); //NSDebugFLog(@"string=%@",string);
while(i<(length-2)) // at least 2 characters for html coded while(i<(length-2)) // at least 2 characters for html coded
{ {
srcLen=0; srcLen=0;
NSDebugFLog(@"i=%d: c=%@",i,[NSString stringWithCharacters:pString+i /*NSDebugFLog(@"i=%d: c=%@",i,[NSString stringWithCharacters:pString+i
length:length-i]); length:length-i]);*/
if (includeBR if (includeBR
&& length-i>=unicodeBRLen && length-i>=unicodeBRLen
&& areUnicharEquals(pString+i,unicodeBR,unicodeBRLen)) && areUnicharEquals(pString+i,unicodeBR,unicodeBRLen))
@ -562,23 +562,29 @@ NSString* baseStringByConvertingFromHTML(NSString* string,GSWHTMLConvertingStruc
}; };
if (srcLen>0) if (srcLen>0)
{ {
NSDebugFLog(@"i=%d j=%d: srcLen=%d dstLen=%d by '%@'",i,j,srcLen,dstLen,[NSString stringWithCharacters:&dstUnichar /*NSDebugFLog(@"i=%d j=%d: srcLen=%d dstLen=%d by '%@'",i,j,srcLen,dstLen,[NSString stringWithCharacters:&dstUnichar
length:dstLen]); length:dstLen]);*/
changed=YES; changed=YES;
/*
NSDebugFLog(@"-1==> %@",[NSString stringWithCharacters:pString NSDebugFLog(@"-1==> %@",[NSString stringWithCharacters:pString
length:length]); length:length]);
NSDebugFLog(@"0==> %@",[NSString stringWithCharacters:pString NSDebugFLog(@"0==> %@",[NSString stringWithCharacters:pString
length:length]); length:length]);
NSDebugFLog(@"Copy %d characters from pos %d to pos %d",(length-i-srcLen),i+srcLen,i+dstLen); 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)); GSWMemMove(pString+i+dstLen,pString+i+srcLen,sizeof(unichar)*(length-i-srcLen));
/*
NSDebugFLog(@"1==> %@",[NSString stringWithCharacters:pString NSDebugFLog(@"1==> %@",[NSString stringWithCharacters:pString
length:length+dstLen-srcLen]); length:length+dstLen-srcLen]);
NSDebugFLog(@"Copy %d characters to pos %d",dstLen,i); NSDebugFLog(@"Copy %d characters to pos %d",dstLen,i);
*/
GSWMemMove(pString+i,&dstUnichar,sizeof(unichar)*dstLen); GSWMemMove(pString+i,&dstUnichar,sizeof(unichar)*dstLen);
i+=dstLen; i+=dstLen;
length+=dstLen-srcLen; length+=dstLen-srcLen;
/*
NSDebugFLog(@"2==> i=%d %@",i,[NSString stringWithCharacters:pString NSDebugFLog(@"2==> i=%d %@",i,[NSString stringWithCharacters:pString
length:length]); length:length]);
*/
}; };
if (srcLen==0) if (srcLen==0)
i++; i++;