realbasic-plugins
[Top] [All Lists]

vsprintf crashes in Mach-O

To: REALbasic Plugins <realbasic-plugins at lists dot realsoftware dot com>
Subject: vsprintf crashes in Mach-O
From: Alfred Van Hoek <vanhoek at mac dot com>
Date: Fri, 21 Apr 2006 09:42:25 -0400
Delivered-to: realbasic-plugins at lists dot realsoftware dot com
The code below never failed, but currently in OSX-Carbon_MachO it always crashes when a dlog string is produced like: dlog("%s %i", "myPlugin message: err = ", status); where status is of type OSStatus. Whether I would use CW-10 or Xcode, MSL or BSD, respectively, the dylib crashes in vsprintf where it accesses __formatter. Simple strings work fine...

void dlog(char *format, ...)
{
        va_list args;
        char    buffer[255];

        va_start(args,format);

        strcpy(buffer + vsprintf(buffer,format,args), "");
        Str255 dst;
        
        CopyC2P(buffer, dst);
        
        #ifndef WIN32
                DebugStr(dst);
        #else
                OutputDebugString(buffer);
        #endif
        va_end(args);
}

Any other way to implement it? What is the mistake that now pops up?

Alfred

_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>


<Prev in Thread] Current Thread [Next in Thread>
  • vsprintf crashes in Mach-O, Alfred Van Hoek <=