Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mumble-voip/mumble.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert <krzmbrzl@gmail.com>2020-09-11 19:29:33 +0300
committerRobert <krzmbrzl@gmail.com>2020-09-11 19:29:33 +0300
commitaf7dac72f4063dd8d4dac71973ea51c25896089a (patch)
tree35558695aea94d48fd9e77d164d63fd8b7c76e90 /g15helper
parent40b28b03c150b453e00c6bc4f8d6957caea59c51 (diff)
FORMAT: Run clang-format 10 on all C/CXX source-files
Diffstat (limited to 'g15helper')
-rw-r--r--g15helper/g15helper.c27
-rw-r--r--g15helper/g15helper.h16
-rw-r--r--g15helper/g15helper_emu.cpp35
-rw-r--r--g15helper/g15helper_emu.h2
-rw-r--r--g15helper/g15helper_macx.c24
5 files changed, 53 insertions, 51 deletions
diff --git a/g15helper/g15helper.c b/g15helper/g15helper.c
index 9503e1840..332d4902f 100644
--- a/g15helper/g15helper.c
+++ b/g15helper/g15helper.c
@@ -7,9 +7,9 @@
* G15 Helper Daemon for Win32.
*/
+#include <windows.h>
#include <stdio.h>
#include <stdlib.h>
-#include <windows.h>
#include <time.h>
#include <wchar.h>
@@ -51,8 +51,9 @@ int __stdcall WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdL
if (lpCmdLine && (strcmp(lpCmdLine, "/detect") == 0)) {
warn("Detect mode!");
bDetect = TRUE;
- } else if (! lpCmdLine || (strcmp(lpCmdLine, "/mumble") != 0)) {
- MessageBox(NULL, L"This program is run by Mumble, and should not be started separately.", L"Nothing to see here, move along", MB_OK | MB_ICONERROR);
+ } else if (!lpCmdLine || (strcmp(lpCmdLine, "/mumble") != 0)) {
+ MessageBox(NULL, L"This program is run by Mumble, and should not be started separately.",
+ L"Nothing to see here, move along", MB_OK | MB_ICONERROR);
return 0;
}
@@ -71,11 +72,11 @@ int __stdcall WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdL
ZeroMemory(&ctx, sizeof(ctx));
ZeroMemory(&bitmap, sizeof(bitmap));
- conn.appFriendlyName = G15_WIDGET_NAME;
- conn.isAutostartable = FALSE;
- conn.isPersistent = FALSE;
- conn.dwAppletCapabilitiesSupported =LGLCD_APPLET_CAP_BASIC | LGLCD_APPLET_CAP_BW;
- conn.connection = LGLCD_INVALID_CONNECTION;
+ conn.appFriendlyName = G15_WIDGET_NAME;
+ conn.isAutostartable = FALSE;
+ conn.isPersistent = FALSE;
+ conn.dwAppletCapabilitiesSupported = LGLCD_APPLET_CAP_BASIC | LGLCD_APPLET_CAP_BW;
+ conn.connection = LGLCD_INVALID_CONNECTION;
/*
* Initialize and connect.
@@ -89,8 +90,8 @@ int __stdcall WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdL
die(G15_ERR_CONNECT, "Unable to connect to Logitech LCD manager. (Error: %i)", dwErr);
ctx.connection = conn.connection;
- ctx.device = LGLCD_INVALID_DEVICE;
- ctx.deviceType =LGLCD_DEVICE_BW;
+ ctx.device = LGLCD_INVALID_DEVICE;
+ ctx.deviceType = LGLCD_DEVICE_BW;
dwErr = lgLcdOpenByType(&ctx);
@@ -130,11 +131,13 @@ int __stdcall WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdL
}
bErr = ReadFile(hStdin, bitmap.pixels + dwTotRead, G15_MAX_FBMEM - dwTotRead, &dwRead, NULL);
if (bErr == FALSE || dwRead == 0)
- die(G15_ERR_READFILE, "Error while reading framebuffer. %d %x",dwRead,GetLastError());
+ die(G15_ERR_READFILE, "Error while reading framebuffer. %d %x", dwRead, GetLastError());
dwTotRead += dwRead;
} while (dwTotRead < G15_MAX_FBMEM);
- dwErr = lgLcdUpdateBitmap(ctx.device, (const lgLcdBitmapHeader *) &bitmap, bPriority ? LGLCD_SYNC_UPDATE(LGLCD_PRIORITY_ALERT) : LGLCD_SYNC_UPDATE(LGLCD_PRIORITY_NORMAL));
+ dwErr = lgLcdUpdateBitmap(ctx.device, (const lgLcdBitmapHeader *) &bitmap,
+ bPriority ? LGLCD_SYNC_UPDATE(LGLCD_PRIORITY_ALERT)
+ : LGLCD_SYNC_UPDATE(LGLCD_PRIORITY_NORMAL));
if (dwErr != ERROR_SUCCESS)
warn("Unable to update bitmap for device. (Error: %i)", dwErr);
}
diff --git a/g15helper/g15helper.h b/g15helper/g15helper.h
index f0f5391fc..9c3f6ab72 100644
--- a/g15helper/g15helper.h
+++ b/g15helper/g15helper.h
@@ -6,16 +6,16 @@
#ifndef MUMBLE_G15_HELPER_H_
#define MUMBLE_G15_HELPER_H_
-#define G15_MAX_DEV 5
-#define G15_MAX_WIDTH 160
-#define G15_MAX_HEIGHT 43
-#define G15_MAX_BPP 1
-#define G15_MAX_FBMEM (G15_MAX_WIDTH * G15_MAX_HEIGHT * G15_MAX_BPP)
-#define G15_MAX_FBMEM_BITS (G15_MAX_FBMEM / 8)
+#define G15_MAX_DEV 5
+#define G15_MAX_WIDTH 160
+#define G15_MAX_HEIGHT 43
+#define G15_MAX_BPP 1
+#define G15_MAX_FBMEM (G15_MAX_WIDTH * G15_MAX_HEIGHT * G15_MAX_BPP)
+#define G15_MAX_FBMEM_BITS (G15_MAX_FBMEM / 8)
#if defined(WIN32)
-#define G15_WIDGET_NAME L"Mumble G15 Display"
+# define G15_WIDGET_NAME L"Mumble G15 Display"
#elif defined(APPLE)
-#define G15_WIDGET_NAME CFSTR("Mumble G15 Display")
+# define G15_WIDGET_NAME CFSTR("Mumble G15 Display")
#endif
enum {
diff --git a/g15helper/g15helper_emu.cpp b/g15helper/g15helper_emu.cpp
index b417b501a..0f459c014 100644
--- a/g15helper/g15helper_emu.cpp
+++ b/g15helper/g15helper_emu.cpp
@@ -7,8 +7,8 @@
* G15 Helper Emulator
*/
-#include <cstdio>
#include <windows.h>
+#include <cstdio>
#include <QApplication>
@@ -16,13 +16,11 @@
#include "g15helper_emu.h"
#if defined(Q_OS_WIN)
-# include <io.h>
-# include <fcntl.h>
+# include <fcntl.h>
+# include <io.h>
#endif
-G15Reader::G15Reader()
- : QThread() {
-
+G15Reader::G15Reader() : QThread() {
moveToThread(this);
m_isRunning = true;
@@ -43,15 +41,14 @@ void G15Reader::run() {
while (m_isRunning) {
quint8 priority = 0;
- size_t nread = 0;
- size_t ntotal = 0;
+ size_t nread = 0;
+ size_t ntotal = 0;
memset(&buf, 0, G15_MAX_FBMEM);
nread = fread(&priority, 1, sizeof(priority), stdin);
if (nread <= 0) {
- qFatal("g15helper_emu: unable to read stdin, retval %lli",
- static_cast<long long>(nread));
+ qFatal("g15helper_emu: unable to read stdin, retval %lli", static_cast< long long >(nread));
}
// The priority flag is not used by the emulator.
@@ -60,8 +57,7 @@ void G15Reader::run() {
do {
nread = fread(&buf[0] + ntotal, 1, G15_MAX_FBMEM - ntotal, stdin);
if (nread <= 0) {
- qFatal("g15helper_emu: unable to read stdin, retval %lli",
- static_cast<long long>(nread));
+ qFatal("g15helper_emu: unable to read stdin, retval %lli", static_cast< long long >(nread));
}
ntotal += nread;
} while (ntotal < G15_MAX_FBMEM);
@@ -69,7 +65,7 @@ void G15Reader::run() {
for (int w = 0; w < G15_MAX_WIDTH; w++) {
for (int h = 0; h < G15_MAX_HEIGHT; h++) {
quint8 color = buf[G15_MAX_WIDTH * h + w];
- uint val = 0xff000000;
+ uint val = 0xff000000;
if (color == 0xff) {
val = 0xffffffff;
}
@@ -83,10 +79,8 @@ void G15Reader::run() {
}
}
-G15Emulator::G15Emulator()
- : QMainWindow() {
-
- setWindowTitle(QLatin1String("Mumble G15 Emulator"));
+G15Emulator::G15Emulator() : QMainWindow() {
+ setWindowTitle(QLatin1String("Mumble G15 Emulator"));
setStyleSheet("QMainWindow {background: #cacaca;}");
m_displayLabel = new QLabel(this);
@@ -105,15 +99,16 @@ int __stdcall WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdL
if (lpCmdLine && (strcmp(lpCmdLine, "/detect") == 0)) {
return 0;
- } else if (! lpCmdLine || (strcmp(lpCmdLine, "/mumble") != 0)) {
- MessageBox(nullptr, L"This program is run by Mumble, and should not be started separately.", L"Nothing to see here, move along", MB_OK | MB_ICONERROR);
+ } else if (!lpCmdLine || (strcmp(lpCmdLine, "/mumble") != 0)) {
+ MessageBox(nullptr, L"This program is run by Mumble, and should not be started separately.",
+ L"Nothing to see here, move along", MB_OK | MB_ICONERROR);
return 0;
}
char *argvec[1];
argvec[0] = nullptr;
- int argc = 0;
+ int argc = 0;
char **argv = &argvec[0];
QApplication app(argc, argv);
diff --git a/g15helper/g15helper_emu.h b/g15helper/g15helper_emu.h
index 4871d7531..73a76d866 100644
--- a/g15helper/g15helper_emu.h
+++ b/g15helper/g15helper_emu.h
@@ -7,9 +7,9 @@
#define MUMBLE_G15_HELPER_EMU_H_
#include <QFile>
+#include <QLabel>
#include <QMainWindow>
#include <QThread>
-#include <QLabel>
class G15Reader : public QThread {
Q_OBJECT
diff --git a/g15helper/g15helper_macx.c b/g15helper/g15helper_macx.c
index fc86c9c2e..56951f27d 100644
--- a/g15helper/g15helper_macx.c
+++ b/g15helper/g15helper_macx.c
@@ -7,10 +7,10 @@
* G15 Helper Daemon for Mac OS X.
*/
+#include <CoreFoundation/CoreFoundation.h>
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
-#include <CoreFoundation/CoreFoundation.h>
#include "g15helper.h"
#include "lglcd.h"
@@ -52,7 +52,9 @@ int main(int argc, char *argv[]) {
warn("Detect mode!");
bDetect = TRUE;
} else if (!(argc > 1) || (strcmp(argv[1], "/mumble") != 0)) {
- CFUserNotificationDisplayAlert(0, 0, NULL, NULL, NULL, CFSTR("Nothing to see here"), CFSTR("This program is run by Mumble, and should not be started separately."), CFSTR("OK"), NULL, NULL, NULL);
+ CFUserNotificationDisplayAlert(0, 0, NULL, NULL, NULL, CFSTR("Nothing to see here"),
+ CFSTR("This program is run by Mumble, and should not be started separately."),
+ CFSTR("OK"), NULL, NULL, NULL);
return 0;
}
@@ -63,11 +65,11 @@ int main(int argc, char *argv[]) {
memset(&ctx, 0, sizeof(ctx));
memset(&bitmap, 0, sizeof(bitmap));
- conn.appFriendlyName = G15_WIDGET_NAME;
- conn.isAutostartable = FALSE;
- conn.isPersistent = FALSE;
- conn.dwAppletCapabilitiesSupported =LGLCD_APPLET_CAP_BASIC | LGLCD_APPLET_CAP_BW;
- conn.connection = LGLCD_INVALID_CONNECTION;
+ conn.appFriendlyName = G15_WIDGET_NAME;
+ conn.isAutostartable = FALSE;
+ conn.isPersistent = FALSE;
+ conn.dwAppletCapabilitiesSupported = LGLCD_APPLET_CAP_BASIC | LGLCD_APPLET_CAP_BW;
+ conn.connection = LGLCD_INVALID_CONNECTION;
/*
* Initialize and connect.
@@ -81,8 +83,8 @@ int main(int argc, char *argv[]) {
die(G15_ERR_CONNECT, "Unable to connect to Logitech LCD manager. (Error: %i)", dwErr);
ctx.connection = conn.connection;
- ctx.device = LGLCD_INVALID_DEVICE;
- ctx.deviceType =LGLCD_DEVICE_BW;
+ ctx.device = LGLCD_INVALID_DEVICE;
+ ctx.deviceType = LGLCD_DEVICE_BW;
dwErr = lgLcdOpenByType(&ctx);
@@ -117,7 +119,9 @@ int main(int argc, char *argv[]) {
remain += ret;
} while (remain < G15_MAX_FBMEM);
- dwErr = lgLcdUpdateBitmap(ctx.device, (const lgLcdBitmapHeader *) &bitmap, bPriority ? LGLCD_SYNC_UPDATE(LGLCD_PRIORITY_ALERT) : LGLCD_SYNC_UPDATE(LGLCD_PRIORITY_NORMAL));
+ dwErr = lgLcdUpdateBitmap(ctx.device, (const lgLcdBitmapHeader *) &bitmap,
+ bPriority ? LGLCD_SYNC_UPDATE(LGLCD_PRIORITY_ALERT)
+ : LGLCD_SYNC_UPDATE(LGLCD_PRIORITY_NORMAL));
if (dwErr != ERROR_SUCCESS)
warn("Unable to update bitmap for device #%i successfully. (Error: %i)", i, dwErr);
}