bug-gnustep
[Top][All Lists]
Advanced

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

Fix, GDL2, EOQualifier (getKey()): args


From: Georg Fleischmann
Subject: Fix, GDL2, EOQualifier (getKey()): args
Date: Tue, 22 Apr 2008 11:23:44 +0800

Hi,

this is addressing changes in EOQualifier getKey(), made on March 30.

> 2008-03-30  Matt Rice  <address@hidden>
>
>    (getKey): Don't use a pointer to a va_list. See
>    http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14557

This doesn't work without a pointer to args (I am using Mac OS 10.4 with Intel CPU). It will just stick with the first argument, so obviously the pointer incremented in the use of va_arg() will not return.
Quote from the discussion on bugzilla:

> I don't see anything wrong with using "va_list *". The standard even says:
>
>     It is permitted to create a pointer to a va_list and pass that
>     pointer to another function, in which case the original function
>     may make further use of the original list after the other
>     function returns.
>
> About passing by value it says:
>
>     The object ap may be passed as an argument to another function;
>     if that function invokes the va_arg macro with parameter ap, the
>     value of ap in the calling function is indeterminate and shall be
>     passed to the va_end macro prior to any further reference to ap

Best wishes,
Georg



*** EOControl/EOQualifier.m.old Mon Mar 31 13:30:35 2008
--- EOControl/EOQualifier.m     Tue Apr 22 10:53:06 2008
***************
*** 196,202 ****
         BOOL *isKeyValue,
         BOOL useVAList,
         NSEnumerator *argsEnum,
!        va_list args)
  {
    NSMutableString *key;
    NSString *classString = nil;
--- 196,202 ----
         BOOL *isKeyValue,
         BOOL useVAList,
         NSEnumerator *argsEnum,
!        va_list *args)
  {
    NSMutableString *key;
    NSString *classString = nil;
***************
*** 301,307 ****
                case '@':
                  if (useVAList)
                    {
!                     argObj = va_arg(args, id);
                    }
                  else
                    {
--- 301,307 ----
                case '@':
                  if (useVAList)
                    {
!                     argObj = va_arg(*args, id);
                    }
                  else
                    {
***************
*** 333,339 ****
                case 's':
                  if (useVAList)
                    {
!                     argString = va_arg(args, const char *);
                    }
                  else
                    {
--- 333,339 ----
                case 's':
                  if (useVAList)
                    {
!                     argString = va_arg(*args, const char *);
                    }
                  else
                    {
***************
*** 367,373 ****
                case 'd':
                  if (useVAList)
                    {
!                     argInt = va_arg(args, int);
                    }
                  else
                    {
--- 367,373 ----
                case 'd':
                  if (useVAList)
                    {
!                     argInt = va_arg(*args, int);
                    }
                  else
                    {
***************
*** 403,409 ****
                    {
                      /* 'float' is promoted to 'double' when passed through 
'...'
                         (so you should pass `double' not `float' to `va_arg') 
*/
!                     argFloat = va_arg(args, double);
                    }
                  else
                    {
--- 403,409 ----
                    {
                      /* 'float' is promoted to 'double' when passed through 
'...'
                         (so you should pass `double' not `float' to `va_arg') 
*/
!                     argFloat = va_arg(*args, double);
                    }
                  else
                    {
***************
*** 656,664 ****
        }

        notQual = isNotQualifier(&cFormat, &s);
!       leftKey = getKey(&cFormat, &s, NULL, useVAList, argEnum, args);
        operator = getOperator(&cFormat, &s);
! rightKey = getKey(&cFormat, &s, &isKeyValue, useVAList, argEnum, args);

operatorSelector = [EOQualifier operatorSelectorForString: operator];
        if (!operatorSelector)
--- 656,664 ----
        }

        notQual = isNotQualifier(&cFormat, &s);
!       leftKey = getKey(&cFormat, &s, NULL, useVAList, argEnum, &args);
        operator = getOperator(&cFormat, &s);
! rightKey = getKey(&cFormat, &s, &isKeyValue, useVAList, argEnum, &args);

operatorSelector = [EOQualifier operatorSelectorForString: operator];
        if (!operatorSelector)





reply via email to

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