clang-format: Apply formatting

Code submissions have continually suffered from formatting
inconsistencies that constantly have to be addressed.  Using
clang-format simplifies this by making code formatting more consistent,
and allows automation of the code formatting so that maintainers can
focus more on the code itself instead of code formatting.
This commit is contained in:
jp9000 2019-06-22 22:13:45 -07:00
commit f53df7da64
567 changed files with 34068 additions and 32903 deletions

View file

@ -11,34 +11,29 @@
using namespace std;
static const char *textExtensions[] = {
"txt", "log", nullptr
};
static const char *textExtensions[] = {"txt", "log", nullptr};
static const char *imageExtensions[] = {
"bmp", "tga", "png", "jpg", "jpeg", "gif", nullptr
};
static const char *imageExtensions[] = {"bmp", "tga", "png", "jpg",
"jpeg", "gif", nullptr};
static const char *htmlExtensions[] = {
"htm", "html", nullptr
};
static const char *htmlExtensions[] = {"htm", "html", nullptr};
static const char *mediaExtensions[] = {
"3ga", "669", "a52", "aac", "ac3", "adt", "adts", "aif", "aifc",
"aiff", "amb", "amr", "aob", "ape", "au", "awb", "caf", "dts",
"flac", "it", "kar", "m4a", "m4b", "m4p", "m5p", "mid", "mka",
"mlp", "mod", "mpa", "mp1", "mp2", "mp3", "mpc", "mpga", "mus",
"oga", "ogg", "oma", "opus", "qcp", "ra", "rmi", "s3m", "sid",
"spx", "tak", "thd", "tta", "voc", "vqf", "w64", "wav", "wma",
"wv", "xa", "xm", "3g2", "3gp", "3gp2", "3gpp", "amv", "asf", "avi",
"bik", "crf", "divx", "drc", "dv", "evo", "f4v", "flv", "gvi",
"gxf", "iso", "m1v", "m2v", "m2t", "m2ts", "m4v", "mkv", "mov",
"mp2", "mp2v", "mp4", "mp4v", "mpe", "mpeg", "mpeg1", "mpeg2",
"mpeg4", "mpg", "mpv2", "mts", "mtv", "mxf", "mxg", "nsv", "nuv",
"ogg", "ogm", "ogv", "ogx", "ps", "rec", "rm", "rmvb", "rpl", "thp",
"tod", "ts", "tts", "txd", "vob", "vro", "webm", "wm", "wmv", "wtv",
nullptr
};
"3ga", "669", "a52", "aac", "ac3", "adt", "adts", "aif",
"aifc", "aiff", "amb", "amr", "aob", "ape", "au", "awb",
"caf", "dts", "flac", "it", "kar", "m4a", "m4b", "m4p",
"m5p", "mid", "mka", "mlp", "mod", "mpa", "mp1", "mp2",
"mp3", "mpc", "mpga", "mus", "oga", "ogg", "oma", "opus",
"qcp", "ra", "rmi", "s3m", "sid", "spx", "tak", "thd",
"tta", "voc", "vqf", "w64", "wav", "wma", "wv", "xa",
"xm", "3g2", "3gp", "3gp2", "3gpp", "amv", "asf", "avi",
"bik", "crf", "divx", "drc", "dv", "evo", "f4v", "flv",
"gvi", "gxf", "iso", "m1v", "m2v", "m2t", "m2ts", "m4v",
"mkv", "mov", "mp2", "mp2v", "mp4", "mp4v", "mpe", "mpeg",
"mpeg1", "mpeg2", "mpeg4", "mpg", "mpv2", "mts", "mtv", "mxf",
"mxg", "nsv", "nuv", "ogg", "ogm", "ogv", "ogx", "ps",
"rec", "rm", "rmvb", "rpl", "thp", "tod", "ts", "tts",
"txd", "vob", "vro", "webm", "wm", "wmv", "wtv", nullptr};
static string GenerateSourceName(const char *base)
{
@ -50,7 +45,7 @@ static string GenerateSourceName(const char *base)
if (inc) {
name += " (";
name += to_string(inc+1);
name += to_string(inc + 1);
name += ")";
}
@ -62,7 +57,7 @@ static string GenerateSourceName(const char *base)
void OBSBasic::AddDropSource(const char *data, DropType image)
{
OBSBasic *main = reinterpret_cast<OBSBasic*>(App()->GetMainWindow());
OBSBasic *main = reinterpret_cast<OBSBasic *>(App()->GetMainWindow());
obs_data_t *settings = obs_data_create();
obs_source_t *source = nullptr;
const char *type = nullptr;
@ -115,8 +110,8 @@ void OBSBasic::AddDropSource(const char *data, DropType image)
if (name.isEmpty())
name = obs_source_get_display_name(type);
source = obs_source_create(type,
GenerateSourceName(QT_TO_UTF8(name)).c_str(),
settings, nullptr);
GenerateSourceName(QT_TO_UTF8(name)).c_str(),
settings, nullptr);
if (source) {
OBSScene scene = main->GetCurrentScene();
obs_scene_add(scene, source);
@ -143,7 +138,7 @@ void OBSBasic::dragMoveEvent(QDragMoveEvent *event)
void OBSBasic::dropEvent(QDropEvent *event)
{
const QMimeData* mimeData = event->mimeData();
const QMimeData *mimeData = event->mimeData();
if (mimeData->hasUrls()) {
QList<QUrl> urls = mimeData->urls();
@ -162,20 +157,20 @@ void OBSBasic::dropEvent(QDropEvent *event)
const char **cmp;
#define CHECK_SUFFIX(extensions, type) \
cmp = extensions; \
while (*cmp) { \
if (strcmp(*cmp, suffix) == 0) { \
AddDropSource(QT_TO_UTF8(file), type); \
found = true; \
break; \
} \
\
cmp++; \
} \
\
if (found) \
continue;
#define CHECK_SUFFIX(extensions, type) \
cmp = extensions; \
while (*cmp) { \
if (strcmp(*cmp, suffix) == 0) { \
AddDropSource(QT_TO_UTF8(file), type); \
found = true; \
break; \
} \
\
cmp++; \
} \
\
if (found) \
continue;
CHECK_SUFFIX(textExtensions, DropType_Text);
CHECK_SUFFIX(htmlExtensions, DropType_Html);
@ -188,4 +183,3 @@ if (found) \
AddDropSource(QT_TO_UTF8(mimeData->text()), DropType_RawText);
}
}