/****************************************************************************
- * Copyright (c) 2001-2011,2012 Free Software Foundation, Inc. *
+ * Copyright (c) 2001-2012,2014 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the *
#include <tic.h>
#include <ctype.h>
-MODULE_ID("$Id: visbuf.c,v 1.40 2012/02/22 22:40:24 tom Exp $")
+MODULE_ID("$Id: visbuf.c,v 1.44 2014/09/25 08:51:13 tom Exp $")
#define NUM_VISBUFS 4
#define NormalLen(len) (size_t) (((size_t)(len) + 1) * 4)
-#define WideLen(len) (size_t) (((size_t)(len) + 1) * 4 * MB_CUR_MAX)
+#define WideLen(len) (size_t) (((size_t)(len) + 1) * 4 * (size_t) MB_CUR_MAX)
#ifdef TRACE
static const char d_quote[] = StringOf(D_QUOTE);
if (c == '"' || c == '\\') {
*tp++ = '\\';
*tp++ = (char) c;
- } else if (is7bits(c) && (isgraph(c) || c == ' ')) {
+ } else if (is7bits((int) c) && (isgraph((int) c) || c == ' ')) {
*tp++ = (char) c;
} else if (c == '\n') {
*tp++ = '\\';
else
mybuf = typeMalloc(wchar_t, mylen);
}
- for (n = 0; buf[n] != 0; ++n) {
- mybuf[n] = (wchar_t) buf[n];
+ if (mybuf != 0) {
+ for (n = 0; buf[n] != 0; ++n) {
+ mybuf[n] = (wchar_t) buf[n];
+ }
+ mybuf[n] = L'\0';
}
- mybuf[n] = L'\0';
return _nc_viswbuf2(0, mybuf);
}
{
char temp[80];
VisChar(temp, UChar(buf[j]), sizeof(temp));
- result = _nc_trace_bufcat(bufnum, temp);
+ (void) _nc_trace_bufcat(bufnum, temp);
}
#endif /* USE_WIDEC_SUPPORT */
}