--- a/src/index/beaglequeue.cpp
+++ b/src/index/beaglequeue.cpp
@@ -406,7 +406,7 @@
             dotdoc.fmtime = ascdate;
 
         char cbuf[100]; 
-        sprintf(cbuf, "%ld", (long)stp->st_size);
+        sprintf(cbuf, OFFTPC, stp->st_size);
         dotdoc.fbytes = cbuf;
 
         // Document signature for up to date checks: none. 
@@ -453,7 +453,7 @@
             doc.fmtime = ascdate;
 
         char cbuf[100]; 
-        sprintf(cbuf, "%ld", (long)stp->st_size);
+        sprintf(cbuf, OFFTPC, stp->st_size);
         doc.fbytes = cbuf;
         // Document signature for up to date checks: none. 
         doc.sig = "";