]> sigrok.org Git - libsigrok.git/blobdiff - strutil.c
sysclk-lwla: Remove unused dev_context::next_state.
[libsigrok.git] / strutil.c
index 40ffc4dc7ccce2895fd1413640f8054e34fb7177..17d59e8d8850dba638ccb4a3eac35ec9f45bbfe5 100644 (file)
--- a/strutil.c
+++ b/strutil.c
@@ -42,6 +42,8 @@
  */
 
 /**
+ * @private
+ *
  * Convert a string representation of a numeric value to a long integer. The
  * conversion is strict and will fail if the complete string does not represent
  * a valid long integer. The function sets errno according to the details of the
@@ -73,6 +75,8 @@ SR_PRIV int sr_atol(const char *str, long *ret)
 }
 
 /**
+ * @private
+ *
  * Convert a string representation of a numeric value to an integer. The
  * conversion is strict and will fail if the complete string does not represent
  * a valid integer. The function sets errno according to the details of the
@@ -102,6 +106,8 @@ SR_PRIV int sr_atoi(const char *str, int *ret)
 }
 
 /**
+ * @private
+ *
  * Convert a string representation of a numeric value to a double. The
  * conversion is strict and will fail if the complete string does not represent
  * a valid double. The function sets errno according to the details of the
@@ -133,6 +139,8 @@ SR_PRIV int sr_atod(const char *str, double *ret)
 }
 
 /**
+ * @private
+ *
  * Convert a string representation of a numeric value to a float. The
  * conversion is strict and will fail if the complete string does not represent
  * a valid float. The function sets errno according to the details of the
@@ -184,7 +192,7 @@ SR_API char *sr_si_string_u64(uint64_t x, const char *unit)
                SR_GHZ(1000), SR_GHZ(1000 * 1000), SR_GHZ(1000 * 1000 * 1000),
        };
        const char *p, prefix[] = "\0kMGTPE";
-       char fmt[8], fract[20] = "", *f;
+       char fmt[16], fract[20] = "", *f;
 
        if (unit == NULL)
                unit = "";
@@ -192,7 +200,7 @@ SR_API char *sr_si_string_u64(uint64_t x, const char *unit)
        for (i = 0; (quot = x / divisor[i]) >= 1000; i++);
 
        if (i) {
-               sprintf(fmt, ".%%0%dlu", i * 3);
+               sprintf(fmt, ".%%0%d"PRIu64, i * 3);
                f = fract + sprintf(fract, fmt, x % divisor[i]) - 1;
 
                while (f >= fract && strchr("0.", *f))