aboutsummaryrefslogtreecommitdiff
path: root/xorg-server/os
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2013-02-11 08:04:06 +0100
committermarha <marha@users.sourceforge.net>2013-02-11 08:04:06 +0100
commitc4583f59d8460f05ee211c2f8ed6208addfe3087 (patch)
tree59420aaa7f249fcf3766adfab41e5285d48048e8 /xorg-server/os
parent71ff3367cab660035c6ea38e5171841dacd461b5 (diff)
parent8753441b3ba4316448e1ae5f408e6a84b0116a3c (diff)
downloadvcxsrv-c4583f59d8460f05ee211c2f8ed6208addfe3087.tar.gz
vcxsrv-c4583f59d8460f05ee211c2f8ed6208addfe3087.tar.bz2
vcxsrv-c4583f59d8460f05ee211c2f8ed6208addfe3087.zip
Merge remote-tracking branch 'origin/released'
* origin/released: xserver mesa git update 11 Feb 2013
Diffstat (limited to 'xorg-server/os')
-rw-r--r--xorg-server/os/log.c21
-rwxr-xr-xxorg-server/os/utils.c32
2 files changed, 50 insertions, 3 deletions
diff --git a/xorg-server/os/log.c b/xorg-server/os/log.c
index 23f181d8d..a65b03c66 100644
--- a/xorg-server/os/log.c
+++ b/xorg-server/os/log.c
@@ -304,7 +304,13 @@ pnprintf(char *string, size_t size, const char *f, va_list args)
continue;
}
- switch (f[++f_idx]) {
+ f_idx++;
+
+ /* silently swallow length modifiers */
+ while (f_idx < f_len && ((f[f_idx] >= '0' && f[f_idx] <= '9') || f[f_idx] == '.'))
+ f_idx++;
+
+ switch (f[f_idx]) {
case 's':
string_arg = va_arg(args, char*);
p_len = strlen_sigsafe(string_arg);
@@ -351,7 +357,16 @@ pnprintf(char *string, size_t size, const char *f, va_list args)
for (i = 0; i < p_len && s_idx < size - 1; i++)
string[s_idx++] = number[i];
break;
-
+ case 'f':
+ {
+ double d = va_arg(args, double);
+ FormatDouble(d, number);
+ p_len = strlen_sigsafe(number);
+
+ for (i = 0; i < p_len && s_idx < size - 1; i++)
+ string[s_idx++] = number[i];
+ }
+ break;
default:
va_arg(args, char*);
string[s_idx++] = '%';
@@ -654,7 +669,7 @@ AbortServer(void)
#endif
CloseWellKnownConnections();
OsCleanup(TRUE);
- CloseDownDevices();
+ AbortDevices();
AbortDDX(EXIT_ERR_ABORT);
fflush(stderr);
if (CoreDump)
diff --git a/xorg-server/os/utils.c b/xorg-server/os/utils.c
index 518400cfd..750bd8dfb 100755
--- a/xorg-server/os/utils.c
+++ b/xorg-server/os/utils.c
@@ -2048,6 +2048,38 @@ FormatUInt64(uint64_t num, char *string)
string[len] = '\0';
}
+/**
+ * Format a double number as %.2f.
+ */
+void
+FormatDouble(double dbl, char *string)
+{
+ int slen = 0;
+ uint64_t frac;
+
+ frac = (dbl > 0 ? dbl : -dbl) * 100.0 + 0.5;
+ frac %= 100;
+
+ /* write decimal part to string */
+ if (dbl < 0 && dbl > -1)
+ string[slen++] = '-';
+ FormatInt64((int64_t)dbl, &string[slen]);
+
+ while(string[slen] != '\0')
+ slen++;
+
+ /* append fractional part, but only if we have enough characters. We
+ * expect string to be 21 chars (incl trailing \0) */
+ if (slen <= 17) {
+ string[slen++] = '.';
+ if (frac < 10)
+ string[slen++] = '0';
+
+ FormatUInt64(frac, &string[slen]);
+ }
+}
+
+
/* Format a number into a hexadecimal string in a signal safe manner. The string
* should be at least 17 characters in order to handle all uint64_t values. */
void