gnustep-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSApplication and an empty argument


From: Fred Kiefer
Subject: Re: NSApplication and an empty argument
Date: Mon, 05 Nov 2012 23:10:29 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:16.0) Gecko/20121025 Thunderbird/16.0.2

On 05.11.2012 13:26, Luboš Doležel wrote:
--- NSApplication.m.orig  2012-11-04 19:00:00.934920184 +0100
+++ NSApplication.m 2012-11-04 19:02:57.022792994 +0100
@@ -4121,6 +4121,9 @@
 [en nextObject]; // skip the first element, which is always empty...
 while((file = [en nextObject]) != nil)
   {
+      if([file length] == 0)
+        continue;
+
     unichar c = [file characterAtIndex: 0];
     if(c != '-')
{

Surely this is the incorrect behaviour, as it will cause off-by-one
errors for the subsequent arguments.  Instead, it's surely correct to
report the existence of an empty argument correctly.

Tom Davie

No, it won't break subsequent arguments; the parsing performed in
NSProcessInfo is not affected by this. The only problem is the
characterAtIndex:0 call.

If you suggest that empty arguments should be treated and passed on as
files, then the fix could look like this:

if ([file length] > 0 && [file characterAtIndex: 0] != '-')

That would result in exactly the same behaviour as your original patch. That's why I used that instead and committed it. (You probably wanted to use OR instead of AND)

Thank you very much
Fred




reply via email to

[Prev in Thread] Current Thread [Next in Thread]