[quake3-bugzilla] [Bug 5944] New: Com_sprintf not working properly

bugzilla-daemon at icculus.org bugzilla-daemon at icculus.org
Tue May 28 10:24:38 EDT 2013


https://bugzilla.icculus.org/show_bug.cgi?id=5944

            Bug ID: 5944
           Summary: Com_sprintf not working properly
    Classification: Unclassified
           Product: ioquake3
           Version: GIT MASTER
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: major
          Priority: P3
         Component: Misc
          Assignee: zachary at ioquake.org
          Reporter: signaljammed at gmail.com
        QA Contact: quake3-bugzilla at icculus.org

In the following code, copy is built on itself one character at a time from
original. This used to work in an older version of ioq3 from back in 2009, but
now when I use this same method with the latest ioquake3 source code it does
not build upon copy. Instead each time the Com_sprintf call is made what copy
previously had is being overwritten by the *p char. It is almost like it is
ignoring the %s format character in the call. 

char original[1024];
char copy[1024];
char *p;

p = original;
while (1) {
// do some text parsing

// end of line
if (!*p) break;

// All cases above fail so write out the char
Com_sprintf(copy, sizeof(copy), "%s%c", copy, *p);
p++;
}

So if the original text was something like "the fox ran over the hill" then
copy would be the last character in the string 'l'.  It should be an exact
replica of original.

-- 
You are receiving this mail because:
You are the QA Contact for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://icculus.org/pipermail/quake3-bugzilla/attachments/20130528/45d83a50/attachment.html>


More information about the quake3-bugzilla mailing list