Ran clang-format on android/cdm/util files.

[ Merge of http://go/wvgerrit/87143 ]

Certain android files have yet to be formated since we introduced
clang-formatting.

Test: Android unit tests
Bug: 134365840
Change-Id: I0e58fb7e5b5525f1e2885ce89b222561a971ab27
This commit is contained in:
Alex Dale
2019-10-02 12:59:31 -07:00
parent 78e84dcd3b
commit 06388368cc
4 changed files with 36 additions and 19 deletions

View File

@@ -14,6 +14,7 @@
#include <sys/stat.h> #include <sys/stat.h>
#include <sys/types.h> #include <sys/types.h>
#include <unistd.h> #include <unistd.h>
#include <cstring> #include <cstring>
#include <memory> #include <memory>

View File

@@ -12,6 +12,7 @@
#include <sys/stat.h> #include <sys/stat.h>
#include <sys/types.h> #include <sys/types.h>
#include <unistd.h> #include <unistd.h>
#include <cstring> #include <cstring>
#include "file_store.h" #include "file_store.h"

View File

@@ -11,11 +11,11 @@
* at the top of your source file) to change that behavior. * at the top of your source file) to change that behavior.
*/ */
#ifndef LOG_NDEBUG #ifndef LOG_NDEBUG
#ifdef NDEBUG # ifdef NDEBUG
#define LOG_NDEBUG 1 # define LOG_NDEBUG 1
#else # else
#define LOG_NDEBUG 0 # define LOG_NDEBUG 0
#endif # endif
#endif #endif
#define LOG_TAG "WVCdm" #define LOG_TAG "WVCdm"
@@ -24,10 +24,10 @@
#include "log.h" #include "log.h"
#include <utils/Log.h> #include <utils/Log.h>
#include <string>
#include <stdio.h>
#include <stdarg.h> #include <stdarg.h>
#include <stdio.h>
#include <string>
/* /*
* Uncomment the line below if you want to have the LOGV messages to print * Uncomment the line below if you want to have the LOGV messages to print
@@ -48,28 +48,40 @@ void Log(const char* file, const char* function, int line, LogPriority level,
filename = filename == nullptr ? file : filename + 1; filename = filename == nullptr ? file : filename + 1;
char buf[LOG_BUF_SIZE]; char buf[LOG_BUF_SIZE];
int len = snprintf(buf, LOG_BUF_SIZE, "[%s(%d):%s] ", filename, line, int len =
function); snprintf(buf, LOG_BUF_SIZE, "[%s(%d):%s] ", filename, line, function);
if (len < 0) len = 0; if (len < 0) len = 0;
if (static_cast<unsigned int>(len) < sizeof(buf)) { if (static_cast<unsigned int>(len) < sizeof(buf)) {
va_list ap; va_list ap;
va_start(ap, format); va_start(ap, format);
vsnprintf(buf+len, LOG_BUF_SIZE-len, format, ap); vsnprintf(buf + len, LOG_BUF_SIZE - len, format, ap);
va_end(ap); va_end(ap);
} }
android_LogPriority prio = ANDROID_LOG_VERBOSE; android_LogPriority prio = ANDROID_LOG_VERBOSE;
switch(level) { switch (level) {
case LOG_SILENT: return; // It is nonsensical to pass LOG_SILENT. case LOG_SILENT:
case LOG_ERROR: prio = ANDROID_LOG_ERROR; break; return; // It is nonsensical to pass LOG_SILENT.
case LOG_WARN: prio = ANDROID_LOG_WARN; break; case LOG_ERROR:
case LOG_INFO: prio = ANDROID_LOG_INFO; break; prio = ANDROID_LOG_ERROR;
case LOG_DEBUG: prio = ANDROID_LOG_DEBUG; break; break;
case LOG_WARN:
prio = ANDROID_LOG_WARN;
break;
case LOG_INFO:
prio = ANDROID_LOG_INFO;
break;
case LOG_DEBUG:
prio = ANDROID_LOG_DEBUG;
break;
#if LOG_NDEBUG #if LOG_NDEBUG
case LOG_VERBOSE: return; case LOG_VERBOSE:
return;
#else #else
case LOG_VERBOSE: prio = ANDROID_LOG_VERBOSE; break; case LOG_VERBOSE:
prio = ANDROID_LOG_VERBOSE;
break;
#endif #endif
} }

View File

@@ -1,9 +1,12 @@
// Copyright 2018 Google LLC. All Rights Reserved. This file and proprietary // Copyright 2018 Google LLC. All Rights Reserved. This file and proprietary
// source code may only be used and distributed under the Widevine Master // source code may only be used and distributed under the Widevine Master
// License Agreement. // License Agreement.
#include "file_utils.h" #include "file_utils.h"
#include <gmock/gmock.h> #include <gmock/gmock.h>
#include <gtest/gtest.h> #include <gtest/gtest.h>
#include "file_store.h" #include "file_store.h"
#include "test_vectors.h" #include "test_vectors.h"