<<< Date Index >>>     <<< Thread Index >>>

sscanf (x, "%u", &(uint64_t))



Hi,

Is it Okay to sscanf (x, "%u", &(uint64_t)) ?
I got a warning:
        imap.c:638: warning: unsigned int format,
        different type arg (arg 3)

And "man 3 sscanf" says;
        u    Matches an unsigned decimal integer; the
        next pointer must be a pointer to unsigned int.

So, I guess (with no confidence) that this part

|#ifdef USE_HCACHE
|    /* save UIDVALIDITY for the header cache */
|    else if (ascii_strncasecmp("OK [UIDVALIDITY", pc, 14) == 0)
|    {
|      dprint(2, (debugfile, "Getting mailbox UIDVALIDITY\n"));
|      pc += 3;
|      pc = imap_next_word(pc);
|      sscanf(pc, "%u", &(idata->uid_validity));
|    }
|#endif

shoud be something like this:

|#ifdef USE_HCACHE
|    /* save UIDVALIDITY for the header cache */
|    else if (ascii_strncasecmp("OK [UIDVALIDITY", pc, 14) == 0)
|    {
+      unsigned int *tmp_uid_val;
|      dprint(2, (debugfile, "Getting mailbox UIDVALIDITY\n"));
|      pc += 3;
|      pc = imap_next_word(pc);
!      sscanf(pc, "%u", tmp_uid_val);
+      idata->uid_validity = *tmp_uid_val;
|    }
|#endif

Note: I'm not a programmer!
I'm not sure this is a bug.
I'm just letting you know that my cc gives me a warning.

Thanks for reading,
-- 
tamo