Fix invalid long long format specifier
authorJohn Spencer <maillist-alsa@barfooze.de>
Tue, 24 Apr 2012 10:58:48 +0000 (12:58 +0200)
committerTakashi Iwai <tiwai@suse.de>
Tue, 24 Apr 2012 13:38:45 +0000 (15:38 +0200)
Per POSIX:

       L      Specifies that a following a, A, e, E, f, F, g, or G  conversion
              specifier applies to a long double argument.

L is only intended to be used with long doubles, not long long ints.

the proper way is to use "ll" instead.

Signed-off-by: John Spencer <maillist-alsa@barfooze.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>

src/conf.c
test/midiloop.c

index 5b1b5a6..32446a2 100644 (file)
@@ -496,7 +496,7 @@ static int safe_strtoll(const char *str, long long *val)
        if (!*str)
                return -EINVAL;
        errno = 0;
-       if (sscanf(str, "%Li%n", &v, &endidx) < 1)
+       if (sscanf(str, "%lli%n", &v, &endidx) < 1)
                return -EINVAL;
        if (str[endidx])
                return -EINVAL;
@@ -1378,7 +1378,7 @@ static int _snd_config_save_node_value(snd_config_t *n, snd_output_t *out,
                snd_output_printf(out, "%ld", n->u.integer);
                break;
        case SND_CONFIG_TYPE_INTEGER64:
-               snd_output_printf(out, "%Ld", n->u.integer64);
+               snd_output_printf(out, "%lld", n->u.integer64);
                break;
        case SND_CONFIG_TYPE_REAL:
                snd_output_printf(out, "%-16g", n->u.real);
@@ -2630,7 +2630,7 @@ int snd_config_get_ascii(const snd_config_t *config, char **ascii)
                {
                        char res[32];
                        int err;
-                       err = snprintf(res, sizeof(res), "%Li", config->u.integer64);
+                       err = snprintf(res, sizeof(res), "%lli", config->u.integer64);
                        if (err < 0 || err == sizeof(res)) {
                                assert(0);
                                return -ENOMEM;
index ee2e563..d6548b5 100644 (file)
@@ -175,7 +175,7 @@ int main(int argc, char** argv)
        printf("output.status.xruns = %zi\n", snd_rawmidi_status_get_xruns(ostat));
 
        diff = timediff(end, start);
-       printf("Time diff: %Liusec (%Li bytes/sec)\n", diff, ((long long)opos * 1000000) / diff);
+       printf("Time diff: %lliusec (%lli bytes/sec)\n", diff, ((long long)opos * 1000000) / diff);
 
        if (verbose) {
                fprintf(stderr,"Closing\n");