Building gnome-vfs 2.0.4 on HP-UX 11i



I'm attempting to build gnome-vfs 2.0.4 on HP-UX 11i with the HP C
compiler. I'm getting the following error while trying to build
modules/vfolder/vfolder-method.c:
  cc: "vfolder-method.c", line 415: warning 604: Pointers are not
  assignment-compatible.
  cc: "vfolder-method.c", line 415: warning 563: Argument #2 is not the
  correct type.
  cc: "vfolder-method.c", line 1180: error 1649: Illegal integer-pointer
  combination for <.
  cc: "vfolder-method.c", line 1180: error 1563: Expression in if must
  be scalar.
  cc: "vfolder-method.c", line 1182: error 1649: Illegal integer-pointer
  combination for <.
  cc: "vfolder-method.c", line 1182: error 1563: Expression in if must
  be scalar.
  gmake[3]: *** [vfolder-method.lo] Error 1
  gmake[3]: Leaving directory
  `/opt/build/gnome-vfs-2.0.4/modules/vfolder'

The problematic code is:
        /* Remove the name if it already exists */
        key_idx = strstr (fullbuf->str, key);
        if (key_idx && (key_idx == fullbuf->str ||
                        key_idx [-1] == '\n' ||
                        key_idx [-1] == '\r')) {
                /* Look for the end of the value */
                val_end = strchr (key_idx, '\n');
                if (val_end < 0)
                        val_end = strchr (key_idx, '\r');
                if (val_end < 0)
                        val_end = &fullbuf->str [fullbuf->len - 1];

                /* Erase the old name */
                g_string_erase (fullbuf,
                                key_idx - fullbuf->str,
                                val_end - key_idx);
        }

What's the logic behind:
                if (val_end < 0)
                        val_end = strchr (key_idx, '\r');
                if (val_end < 0)
                        val_end = &fullbuf->str [fullbuf->len - 1];

strchr returns NULL if the 2nd argument is not found or a pointer to
the first occurrence of the value. So why compare val_end (gchar *) <
0? I could probably change this to:
                if (val_end < (gchar *)0)
                        val_end = strchr (key_idx, '\r');
                if (val_end < (gchar *)0)
                        val_end = &fullbuf->str [fullbuf->len - 1];
but this doesn't make sense. Should it be:
                if (val_end == NULL)
                        val_end = strchr (key_idx, '\r');
                if (val_end == NULL)
                        val_end = &fullbuf->str [fullbuf->len - 1];

-- 
albert chin (china thewrittenword com)



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