}
char* TcpFilter::patternToStr(const TcpFilter::Pattern& p) {
- rfb::CharArray addr;
- char buffer[INET6_ADDRSTRLEN + 2];
+ char addr[INET6_ADDRSTRLEN + 2];
if (p.address.u.sa.sa_family == AF_INET) {
getnameinfo(&p.address.u.sa, sizeof(p.address.u.sin),
- buffer, sizeof (buffer), NULL, 0, NI_NUMERICHOST);
- addr.buf = rfb::strDup(buffer);
+ addr, sizeof(addr), NULL, 0, NI_NUMERICHOST);
} else if (p.address.u.sa.sa_family == AF_INET6) {
- buffer[0] = '[';
+ addr[0] = '[';
getnameinfo(&p.address.u.sa, sizeof(p.address.u.sin6),
- buffer + 1, sizeof (buffer) - 2, NULL, 0, NI_NUMERICHOST);
- strcat(buffer, "]");
- addr.buf = rfb::strDup(buffer);
+ addr + 1, sizeof(addr) - 2, NULL, 0, NI_NUMERICHOST);
+ strcat(addr, "]");
} else
- addr.buf = rfb::strDup("");
+ addr[0] = '\0';
char action;
switch (p.action) {
case Query: action = '?'; break;
};
size_t resultlen = (1 // action
- + strlen (addr.buf) // address
+ + strlen (addr) // address
+ 1 // slash
+ 3 // prefix length, max 128
+ 1); // terminating nul
char* result = new char[resultlen];
- if (addr.buf[0] == '\0')
+ if (addr[0] == '\0')
snprintf(result, resultlen, "%c", action);
else
- snprintf(result, resultlen, "%c%s/%u", action, addr.buf, p.prefixlen);
+ snprintf(result, resultlen, "%c%s/%u", action, addr, p.prefixlen);
return result;
}
char title[128];
if (!GetWindowText(PropSheet_GetCurrentPageHwnd(handle), title, sizeof(title)))
sprintf(title, "capture%d", i);
- CharArray pageTitle(strDup(title));
- for (int j=0; j<strlen(pageTitle.buf); j++) {
- if (pageTitle.buf[j] == '/' || pageTitle.buf[j] == '\\' || pageTitle.buf[j] == ':')
- pageTitle.buf[j] = '-';
+ for (int j=0; j<strlen(title); j++) {
+ if (title == '/' || title[j] == '\\' || title[j] == ':')
+ title[j] = '-';
}
char filename[256];
- sprintf(filename, "%s\\%s.bmp", tmpdir, pageTitle.buf);
+ sprintf(filename, "%s\\%s.bmp", tmpdir, title);
vlog.debug("writing to %s", filename);
saveBMP(filename, &fb);
i++;
DWORD i = 0;
try {
while (1) {
- CharArray name(strDup(key.getValueName(i++)));
- if (!name.buf) break;
- CharArray value(key.getRepresentation(name.buf));
- if (!value.buf || !Configuration::setParam(name.buf, value.buf))
- vlog.info("unable to process %s", name.buf);
+ const char *name = key.getValueName(i++);
+ if (!name) break;
+ CharArray value(key.getRepresentation(name));
+ if (!value.buf || !Configuration::setParam(name, value.buf))
+ vlog.info("unable to process %s", name);
}
} catch (rdr::SystemException& e) {
if (e.err != 6)