mirror of
https://github.com/ultimatepp/ultimatepp.git
synced 2026-08-22 22:04:00 -06:00
GridCtrl: fix warnings on macOS. (#356)
This commit is contained in:
parent
6cfeded6bd
commit
20f5a89dc7
2 changed files with 10 additions and 11 deletions
|
|
@ -287,13 +287,11 @@ int GridDisplay::GetLinesCount(int cx, const wchar* s, const Font& font, bool wr
|
|||
|
||||
const wchar * e = t;
|
||||
int ccx = max(5, cx);
|
||||
int enters = 0;
|
||||
int lines = 0;
|
||||
|
||||
while(*p)
|
||||
{
|
||||
bool nextline = *p == '\n';
|
||||
enters += int(nextline);
|
||||
|
||||
if(nextline || *(p + 1) == '\0')
|
||||
{
|
||||
|
|
@ -304,7 +302,7 @@ int GridDisplay::GetLinesCount(int cx, const wchar* s, const Font& font, bool wr
|
|||
{
|
||||
lines += tcx / ccx;
|
||||
if(tcx % ccx > 0)
|
||||
lines++;
|
||||
lines++;
|
||||
}
|
||||
else
|
||||
lines++;
|
||||
|
|
|
|||
|
|
@ -6,23 +6,24 @@ LineEdit *dlog = NULL;
|
|||
int dlev = 0;
|
||||
|
||||
static int pos = 0;
|
||||
static constexpr int buff_size = 1024;
|
||||
|
||||
void LogCon(const char *fmt, ...)
|
||||
{
|
||||
char buffer[1024];
|
||||
char buffer[buff_size];
|
||||
va_list argptr;
|
||||
va_start(argptr, fmt);
|
||||
vsprintf(buffer, fmt, argptr);
|
||||
vsnprintf(buffer, buff_size, fmt, argptr);
|
||||
va_end(argptr);
|
||||
LOG(buffer);
|
||||
}
|
||||
|
||||
void LogCon(int level, const char *fmt, ...)
|
||||
{
|
||||
char buffer[1024];
|
||||
char buffer[buff_size];
|
||||
va_list argptr;
|
||||
va_start(argptr, fmt);
|
||||
vsprintf(buffer, fmt, argptr);
|
||||
vsnprintf(buffer, buff_size, fmt, argptr);
|
||||
va_end(argptr);
|
||||
LOG(buffer);
|
||||
}
|
||||
|
|
@ -33,10 +34,10 @@ void LogGui(const char *fmt, ...)
|
|||
return;
|
||||
|
||||
pos = dlog->GetLength();
|
||||
char buffer[1024];
|
||||
char buffer[buff_size];
|
||||
va_list argptr;
|
||||
va_start(argptr, fmt);
|
||||
int l = vsprintf(buffer, fmt, argptr);
|
||||
int l = vsnprintf(buffer, buff_size, fmt, argptr);
|
||||
va_end(argptr);
|
||||
|
||||
dlog->Insert(pos, buffer);
|
||||
|
|
@ -52,10 +53,10 @@ void LogGui(int level, const char *fmt, ...)
|
|||
return;
|
||||
|
||||
pos = dlog->GetLength();
|
||||
char buffer[1024];
|
||||
char buffer[buff_size];
|
||||
va_list argptr;
|
||||
va_start(argptr, fmt);
|
||||
int l = vsprintf(buffer, fmt, argptr);
|
||||
int l = vsnprintf(buffer, buff_size, fmt, argptr);
|
||||
va_end(argptr);
|
||||
|
||||
dlog->Insert(pos, buffer);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue