not sure it goes here, but windbus code change

Mike Luschas mluschas at gmail.com
Mon May 14 14:22:35 CEST 2007


Hi,
File:   dbus-sysdeps-win.c

Function with code (and comment)

int _dbus_printf_string_upper_bound (const char *format,
                                     va_list args)
{
  /* MSVCRT's vsnprintf semantics are a bit different */
  /* The C library source in the Platform SDK indicates that this
   * would work, but alas, it doesn't. At least not on Windows
   * 2000. Presumably those sources correspond to the C library on
   * some newer or even future Windows version.
   *
    len = _vsnprintf (NULL, _DBUS_INT_MAX, format, args);
   */
  char p[1024];
  int len;
#ifdef DBUS_WINCE
  len = _vsnprintf (p, sizeof(p)-1, format, args);
#else
   /*  Ok Im using VS 2003 right now with the Server 2k3 R2 PSDSK.
      This line was originally len = vsnprintf(p, sizeof(p)-1, format,
args);
      It was failing to compile telling me it was undefined. So Im changing
it
      Michael Luschas May 14th 2007 mluschas at gmail.com  */
  len = _vsnprintf (p, sizeof(p)-1, format, args);
#endif
  if (len == -1) // try again
    {
      char *p;
      p = malloc (strlen(format)*3);
#ifdef DBUS_WINCE
      len = _vsnprintf (p, sizeof(p)-1, format, args);
#else
      /*Same as previous comment */
      len = _vsnprintf (p, sizeof(p)-1, format, args);
#endif
      free(p);

    }
  return len;
}

// End of code change
Not sure where exactly I would submit it (I am knew at this). So I left a
comment of WHY I changed it and what it was. I'm not sure if its the
compiler i'm using that made it be that way, or if its the PSDK or what. But
thats the change, so im posting it in case anyone else has
trouble, or if someone can commit that change (or tell me how to).

Thanks
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.kde.org/pipermail/kde-buildsystem/attachments/20070514/09a070ba/attachment.html 


More information about the Kde-buildsystem mailing list