[project @ 2005-06-23 18:11:08 by unknown_lamer]
authorunknown_lamer <unknown>
Thu, 23 Jun 2005 18:11:08 +0000 (18:11 +0000)
committerunknown_lamer <unknown>
Thu, 23 Jun 2005 18:11:08 +0000 (18:11 +0000)
hooks/timer argument is now zero padded instead of space padded

ChangeLog
source/Bot.C

index 6a9e6df..a5c71c4 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
 2005-06-23  Clinton Ebadi  <clinton@unknownlamer.org>
 
+       * source/Bot.C (waitForInput): Use %02d when formatting
+       Hooks::TIMER argument instead of %2d, and switch to snprintf to
+       enforce max length
+
        * bobot++.texinfo (Hooks): Clarified intro text about hooks (order
        of processing).
 
index 741e2e1..12f8aea 100644 (file)
@@ -411,7 +411,7 @@ Bot::waitForInput()
     if (thisTime->tm_sec == 0)
       {
        char s[6];
-       std::sprintf(s, "%2d:%2d", thisTime->tm_hour, thisTime->tm_min);
+       std::snprintf(s, 6, "%02d:%02d", thisTime->tm_hour, thisTime->tm_min);
        
        botInterp->RunHooks(Hook::TIMER, String(s),
                            scm_list_n (Utils::str2scm (std::string (s)),