[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Bug-glpk] print_context in glpmpl01.c
From: |
glpk xypron |
Subject: |
[Bug-glpk] print_context in glpmpl01.c |
Date: |
Sun, 11 Nov 2007 22:29:39 +0100 |
Hi Andrew,
in glpmpl01.c, print_context defines c as int. c should be char because
mpl->context is *char.
memmove will copy only CONTEXT_SIZE-1 bytes even if char is 2 bytes wide on
unicode systems. strncpy might be as better choice. Otherwise You might use
memmove with (CONTEXT_SIZE-1) * sizeof(char).
Best regards
Xypron
/*----------------------------------------------------------------------
-- print_context - print current content of context queue.
--
-- This routine prints current content of the context queue. */
void print_context(MPL *mpl)
{ int c;
while (mpl->c_ptr > 0)
{ mpl->c_ptr--;
c = mpl->context[0];
memmove(mpl->context, mpl->context+1, CONTEXT_SIZE-1);
mpl->context[CONTEXT_SIZE-1] = (char)c;
}
print("Context: %s%.*s", mpl->context[0] == ' ' ? "" : "...",
CONTEXT_SIZE, mpl->context);
return;
}
--
Der GMX SmartSurfer hilft bis zu 70% Ihrer Onlinekosten zu sparen!
Ideal für Modem und ISDN: http://www.gmx.net/de/go/smartsurfer
- [Bug-glpk] print_context in glpmpl01.c,
glpk xypron <=