Skip to content

Commit

Permalink
fix: mixing tabs and spaces
Browse files Browse the repository at this point in the history
  • Loading branch information
spacemeowx2 committed Nov 14, 2020
1 parent 49eb3fb commit 5bc6634
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 35 deletions.
56 changes: 28 additions & 28 deletions src/pcaploop.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -128,47 +128,47 @@ int uv_pcap_open_live(
LLOG(LLOG_DEBUG, "open %s fail: pcap_create", d->name);
return -1;
}
if (pcap_set_timeout(dev, 500)) {
if (pcap_set_timeout(dev, 500)) {
LLOG(LLOG_DEBUG, "open %s fail: pcap_set_timeout", d->name);
goto fail;
}
if (pcap_set_immediate_mode(dev, 1)) {
goto fail;
}
if (pcap_set_immediate_mode(dev, 1)) {
LLOG(LLOG_DEBUG, "open %s fail: pcap_set_immediate_mode", d->name);
goto fail;
}
if (pcap_set_snaplen(dev, 65535)) {
goto fail;
}
if (pcap_set_snaplen(dev, 65535)) {
LLOG(LLOG_DEBUG, "open %s fail: pcap_set_snaplen", d->name);
goto fail;
}
// if (pcap_set_buffer_size(dev, 100000)) {
goto fail;
}
// if (pcap_set_buffer_size(dev, 100000)) {
// LLOG(LLOG_DEBUG, "open %s fail: pcap_set_buffer_size", d->name);
// goto fail;
// }
if (pcap_set_promisc(dev, 1)) {
// goto fail;
// }
if (pcap_set_promisc(dev, 1)) {
LLOG(LLOG_DEBUG, "open %s fail: pcap_set_promisc", d->name);
goto fail;
}
goto fail;
}

rc = pcap_activate(dev);
if (rc > 0) { // pcap warning
switch (rc) {
case PCAP_WARNING_PROMISC_NOTSUP:
if (rc > 0) { // pcap warning
switch (rc) {
case PCAP_WARNING_PROMISC_NOTSUP:
LLOG(LLOG_DEBUG, "open %s fail: PCAP_WARNING_PROMISC_NOTSUP", d->name);
goto fail;
case PCAP_WARNING_TSTAMP_TYPE_NOTSUP:
case PCAP_WARNING_TSTAMP_TYPE_NOTSUP:
LLOG(LLOG_DEBUG, "open %s fail: PCAP_WARNING_TSTAMP_TYPE_NOTSUP", d->name);
break;
case PCAP_WARNING:
break;
case PCAP_WARNING:
LLOG(LLOG_DEBUG, "open %s fail: PCAP_WARNING: %s", d->name, pcap_geterr(dev));
break;
default:
LLOG(LLOG_DEBUG, "open %s fail: pcap_activate unknown warning");
break;
default:
LLOG(LLOG_DEBUG, "open %s fail: pcap_activate unknown warning");
goto fail;
}
} else if (rc < 0) { // pcap error
}
} else if (rc < 0) { // pcap error
LLOG(LLOG_DEBUG, "open %s fail: pcap_activate error %d: %s", d->name, rc, pcap_geterr(dev));
goto fail;
}
goto fail;
}

datalink = pcap_datalink(dev);
if (datalink != DLT_EN10MB) {
Expand Down
15 changes: 8 additions & 7 deletions src/sha1.c
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ uint32_t j;

j = context->count[0];
if ((context->count[0] += len << 3) < j)
context->count[1]++;
context->count[1]++;
context->count[1] += (len>>29);
j = (j >> 3) & 63;
if ((j + len) > 63) {
Expand All @@ -158,7 +158,8 @@ unsigned i;
unsigned char finalcount[8];
unsigned char c;

#if 0 /* untested "improvement" by DHR */
#if 0
/* untested "improvement" by DHR */
/* Convert context->count to a sequence of bytes
* in finalcount. Second element first, but
* big-endian order within element.
Expand All @@ -168,11 +169,11 @@ unsigned char c;

for (i = 0; i < 2; i++)
{
uint32_t t = context->count[i];
int j;
uint32_t t = context->count[i];
int j;

for (j = 0; j < 4; t >>= 8, j++)
*--fcp = (unsigned char) t
for (j = 0; j < 4; t >>= 8, j++)
*--fcp = (unsigned char) t
}
#else
for (i = 0; i < 8; i++) {
Expand All @@ -183,7 +184,7 @@ unsigned char c;
c = 0200;
SHA1Update(context, &c, 1);
while ((context->count[0] & 504) != 448) {
c = 0000;
c = 0000;
SHA1Update(context, &c, 1);
}
SHA1Update(context, finalcount, 8); /* Should cause a SHA1Transform() */
Expand Down

0 comments on commit 5bc6634

Please sign in to comment.