r20377 - gnucash/trunk/src/libqof/qof - Add more debug logging.
Geert Janssens
gjanssens at code.gnucash.org
Sat Mar 5 12:31:24 EST 2011
Author: gjanssens
Date: 2011-03-05 12:31:24 -0500 (Sat, 05 Mar 2011)
New Revision: 20377
Trac: http://svn.gnucash.org/trac/changeset/20377
Modified:
gnucash/trunk/src/libqof/qof/guid.c
Log:
Add more debug logging.
Modified: gnucash/trunk/src/libqof/qof/guid.c
===================================================================
--- gnucash/trunk/src/libqof/qof/guid.c 2011-03-05 11:41:08 UTC (rev 20376)
+++ gnucash/trunk/src/libqof/qof/guid.c 2011-03-05 17:31:24 UTC (rev 20377)
@@ -141,8 +141,13 @@
char buffer[BLOCKSIZE + 72];
size_t sum, block_size, total;
+ ENTER("");
+
if (max_size <= 0)
+ {
+ LEAVE("max_size is 0 or less, skipping stream");
return 0;
+ }
total = 0;
@@ -172,7 +177,10 @@
max_size -= sum;
if (n == 0 && ferror (stream))
+ {
+ LEAVE("error while reading stream");
return total;
+ }
/* If end of file or max_size is reached, end the loop. */
if ((n == 0) || (max_size == 0))
@@ -192,6 +200,7 @@
total += sum;
}
+ LEAVE("");
return total;
}
@@ -203,19 +212,30 @@
size_t file_bytes;
FILE *fp;
+ ENTER("filename: %s", filename);
+
memset(&stats, 0, sizeof(stats));
if (g_stat(filename, &stats) != 0)
+ {
+ LEAVE("unable to read file stats on %s", filename);
return 0;
+ }
md5_process_bytes(&stats, sizeof(stats), &guid_context);
total += sizeof(stats);
if (max_size <= 0)
+ {
+ LEAVE("no bytes in file %s", filename);
return total;
+ }
fp = g_fopen (filename, "r");
if (fp == NULL)
+ {
+ LEAVE("unable to open file %s", filename);
return total;
+ }
file_bytes = init_from_stream(fp, max_size);
@@ -231,6 +251,7 @@
fclose(fp);
+ LEAVE("file %s processed successfully", filename);
return total;
}
@@ -244,12 +265,19 @@
int result;
GDir *dir;
+ ENTER("dirname: %s", dirname);
if (max_files <= 0)
+ {
+ LEAVE("max_files is 0 or less, skipping directory %s", dirname);
return 0;
+ }
dir = g_dir_open(dirname, 0, NULL);
if (dir == NULL)
+ {
+ LEAVE("unable to open directory %s", dirname);
return 0;
+ }
total = 0;
@@ -279,6 +307,7 @@
g_dir_close(dir);
+ LEAVE("");
return total;
}
@@ -292,6 +321,8 @@
struct tms tms_buf;
#endif
+ ENTER("");
+
total = 0;
t_time = time(NULL);
@@ -305,20 +336,25 @@
total += sizeof(clocks) + sizeof(tms_buf);
#endif
+ LEAVE("");
return total;
}
static size_t
init_from_int(int val)
{
+ ENTER("");
md5_process_bytes(&val, sizeof(val), &guid_context);
+ LEAVE("");
return sizeof(int);
}
static size_t
init_from_buff(unsigned char * buf, size_t buflen)
{
+ ENTER("");
md5_process_bytes(buf, buflen, &guid_context);
+ LEAVE("");
return buflen;
}
More information about the gnucash-changes
mailing list