mirror of
https://github.com/gnustep/libs-base.git
synced 2025-05-10 16:20:42 +00:00
fix bug whe comment extends over end of line
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@36353 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
d314f0f843
commit
a727b0bd46
1 changed files with 144 additions and 131 deletions
|
@ -176,11 +176,16 @@ static NSString *parse_string(NSString **ptr)
|
|||
{
|
||||
l = [l substringFromIndex: 10];
|
||||
pos = [l rangeOfString: @" */"].location;
|
||||
if (pos == NSNotFound) continue;
|
||||
[se setComment: [l substringToIndex: pos]];
|
||||
}
|
||||
else
|
||||
{
|
||||
pos = [l rangeOfString: @"*/"].location;
|
||||
if (pos == NSNotFound)
|
||||
{
|
||||
pos = [l length];
|
||||
}
|
||||
if ([user_comment length])
|
||||
[user_comment appendString: @"\n"];
|
||||
[user_comment appendString: [l substringToIndex: pos]];
|
||||
|
@ -202,14 +207,16 @@ static NSString *parse_string(NSString **ptr)
|
|||
pos = [l rangeOfString: @"="].location;
|
||||
if (pos == NSNotFound)
|
||||
{
|
||||
fprintf(stderr,"parse error in '%s', expecting '='\n",[filename cString]);
|
||||
fprintf(stderr,"parse error in '%s', expecting '='\n",
|
||||
[filename cString]);
|
||||
exit(1);
|
||||
}
|
||||
l = [l substringFromIndex: pos+1];
|
||||
pos = [l rangeOfString: @"\""].location;
|
||||
if (pos == NSNotFound)
|
||||
{
|
||||
fprintf(stderr,"parse error in '%s', expecting second string\n",[filename cString]);
|
||||
fprintf(stderr,"parse error in '%s', expecting second string\n",
|
||||
[filename cString]);
|
||||
exit(1);
|
||||
}
|
||||
l = [l substringFromIndex: pos+1];
|
||||
|
@ -218,7 +225,8 @@ static NSString *parse_string(NSString **ptr)
|
|||
pos = [l rangeOfString: @"; "].location;
|
||||
if (pos == NSNotFound)
|
||||
{
|
||||
fprintf(stderr,"parse error in '%s', expecting ';'\n",[filename cString]);
|
||||
fprintf(stderr,"parse error in '%s', expecting '; '\n",
|
||||
[filename cString]);
|
||||
exit(1);
|
||||
}
|
||||
l = [l substringFromIndex: pos+1];
|
||||
|
@ -236,8 +244,10 @@ static NSString *parse_string(NSString **ptr)
|
|||
}
|
||||
}
|
||||
|
||||
[update_list makeObjectsPerformSelector: @selector(setKey:) withObject: key];
|
||||
[update_list makeObjectsPerformSelector: @selector(setTranslated:) withObject: trans];
|
||||
[update_list makeObjectsPerformSelector: @selector(setKey:)
|
||||
withObject: key];
|
||||
[update_list makeObjectsPerformSelector: @selector(setTranslated:)
|
||||
withObject: trans];
|
||||
|
||||
{
|
||||
int i,c = [update_list count];
|
||||
|
@ -507,7 +517,9 @@ static NSString *parse_string(NSString **ptr)
|
|||
{
|
||||
NSString *backupname = [filename stringByAppendingString: @"~"];
|
||||
[[NSFileManager defaultManager] removeFileAtPath: backupname handler: nil];
|
||||
[[NSFileManager defaultManager] movePath: filename toPath: backupname handler: nil];
|
||||
[[NSFileManager defaultManager] movePath: filename
|
||||
toPath: backupname
|
||||
handler: nil];
|
||||
result = [str writeToFile: filename atomically: YES];
|
||||
|
||||
if (!result)
|
||||
|
@ -518,7 +530,8 @@ static NSString *parse_string(NSString **ptr)
|
|||
DESTROY(un_list);
|
||||
|
||||
if (un_count)
|
||||
fprintf(stderr,"'%s': %i untranslated or unmatched messages\n",[filename cString],un_count);
|
||||
fprintf(stderr,"'%s': %i untranslated or unmatched messages\n",
|
||||
[filename cString],un_count);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
@ -550,8 +563,8 @@ static NSString *parse_string(NSString **ptr)
|
|||
|
||||
if (([se flags] & FLAG_UNMATCHED) && [[se file] isEqual: [e file]])
|
||||
{
|
||||
if ((![se comment] && ![e comment]) ||
|
||||
([[se comment] isEqual: [e comment]]))
|
||||
if ((![se comment] && ![e comment])
|
||||
|| ([[se comment] isEqual: [e comment]]))
|
||||
{
|
||||
[se setFlags: [se flags] & ~FLAG_UNMATCHED];
|
||||
[se setLine: [e line]];
|
||||
|
|
Loading…
Reference in a new issue