Skip to content

Commit

Permalink
Add some debug logging.
Browse files Browse the repository at this point in the history
  • Loading branch information
ni4 committed Nov 13, 2023
1 parent 1f7759f commit dd52f66
Show file tree
Hide file tree
Showing 3 changed files with 82 additions and 1 deletion.
3 changes: 3 additions & 0 deletions src/lib/rnp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3132,14 +3132,17 @@ rnp_verify_dest_provider(pgp_parse_handler_t *handler,
const char * filename,
uint32_t mtime)
{
RNP_LOG("here");
rnp_op_verify_t op = (rnp_op_verify_t) handler->param;
if (!op->output) {
RNP_LOG("here");
return false;
}
*dst = &(op->output->dst);
*closedst = false;
op->filename = filename ? std::string(filename) : "";
op->file_mtime = mtime;
RNP_LOG("here");
return true;
}

Expand Down
11 changes: 10 additions & 1 deletion src/librepgp/stream-common.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,16 +55,18 @@ bool
src_read(pgp_source_t *src, void *buf, size_t len, size_t *readres)
{
size_t left = len;
size_t read;
size_t read = 0;
pgp_source_cache_t *cache = src->cache;
bool readahead = cache ? cache->readahead : false;

if (src->error) {
RNP_LOG("here");
return false;
}

if (src->eof || (len == 0)) {
*readres = 0;
RNP_LOG("here");
return true;
}

Expand Down Expand Up @@ -96,11 +98,14 @@ src_read(pgp_source_t *src, void *buf, size_t len, size_t *readres)
// If there is no cache or chunk is larger then read directly
if (!src->read(src, buf, left, &read)) {
src->error = 1;
RNP_LOG("here");
return false;
}
// RNP_LOG("here: %p %zu", src->read, read);

Check notice

Code scanning / CodeQL

Commented-out code Note

This comment appears to contain commented-out code.
if (!read) {
src->eof = 1;
len = len - left;
RNP_LOG("here: %zu", len);
goto finish;
}
left -= read;
Expand All @@ -109,11 +114,14 @@ src_read(pgp_source_t *src, void *buf, size_t len, size_t *readres)
// Try to fill the cache to avoid small reads
if (!src->read(src, &cache->buf[0], sizeof(cache->buf), &read)) {
src->error = 1;
RNP_LOG("here");
return false;
}
// RNP_LOG("here: %p %zu", src->read, read);

Check notice

Code scanning / CodeQL

Commented-out code Note

This comment appears to contain commented-out code.
if (!read) {
src->eof = 1;
len = len - left;
RNP_LOG("here: %zu", len);
goto finish;
} else if (read < left) {
memcpy(buf, &cache->buf[0], read);
Expand All @@ -129,6 +137,7 @@ src_read(pgp_source_t *src, void *buf, size_t len, size_t *readres)
}

finish:
// RNP_LOG("here: %p", src->read);

Check notice

Code scanning / CodeQL

Commented-out code Note

This comment appears to contain commented-out code.
src->readb += len;
if (src->knownsize && (src->readb == src->size)) {
src->eof = 1;
Expand Down
Loading

0 comments on commit dd52f66

Please sign in to comment.