Skip to content

Commit

Permalink
Clean up a few unused globals.
Browse files Browse the repository at this point in the history
Found by clang's new -Wunused-const-variable.

BUG=290204
R=akalin@chromium.org, brettw@chromium.org, sergeyu@chromium.org, thestig@chromium.org

Review URL: https://codereview.chromium.org/24616002

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@225235 0039d316-1c4b-4281-b951-d872f2087c98
  • Loading branch information
thakis@chromium.org committed Sep 25, 2013
1 parent 5d4c422 commit 2bf5a6a
Show file tree
Hide file tree
Showing 35 changed files with 30 additions and 279 deletions.
3 changes: 0 additions & 3 deletions base/file_util.cc
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@ namespace base {

namespace {

const FilePath::CharType kExtensionSeparator = FILE_PATH_LITERAL('.');

// The maximum number of 'uniquified' files we will try to create.
// This is used when the filename we're trying to download is already in use,
// so we create a new unique filename by appending " (nnn)" before the
Expand Down Expand Up @@ -157,7 +155,6 @@ namespace file_util {

using base::FileEnumerator;
using base::FilePath;
using base::kExtensionSeparator;
using base::kMaxUniqueFiles;

bool IsDirectoryEmpty(const FilePath& dir_path) {
Expand Down
102 changes: 0 additions & 102 deletions base/file_util_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -244,108 +244,6 @@ uint64 FileTimeAsUint64(const FILETIME& ft) {
}
#endif

const struct append_case {
const wchar_t* path;
const wchar_t* ending;
const wchar_t* result;
} append_cases[] = {
#if defined(OS_WIN)
{L"c:\\colon\\backslash", L"path", L"c:\\colon\\backslash\\path"},
{L"c:\\colon\\backslash\\", L"path", L"c:\\colon\\backslash\\path"},
{L"c:\\colon\\backslash\\\\", L"path", L"c:\\colon\\backslash\\\\path"},
{L"c:\\colon\\backslash\\", L"", L"c:\\colon\\backslash\\"},
{L"c:\\colon\\backslash", L"", L"c:\\colon\\backslash\\"},
{L"", L"path", L"\\path"},
{L"", L"", L"\\"},
#elif defined(OS_POSIX)
{L"/foo/bar", L"path", L"/foo/bar/path"},
{L"/foo/bar/", L"path", L"/foo/bar/path"},
{L"/foo/bar//", L"path", L"/foo/bar//path"},
{L"/foo/bar/", L"", L"/foo/bar/"},
{L"/foo/bar", L"", L"/foo/bar/"},
{L"", L"path", L"/path"},
{L"", L"", L"/"},
#endif
};

static const struct filename_case {
const wchar_t* path;
const wchar_t* filename;
} filename_cases[] = {
#if defined(OS_WIN)
{L"c:\\colon\\backslash", L"backslash"},
{L"c:\\colon\\backslash\\", L""},
{L"\\\\filename.exe", L"filename.exe"},
{L"filename.exe", L"filename.exe"},
{L"", L""},
{L"\\\\\\", L""},
{L"c:/colon/backslash", L"backslash"},
{L"c:/colon/backslash/", L""},
{L"//////", L""},
{L"///filename.exe", L"filename.exe"},
#elif defined(OS_POSIX)
{L"/foo/bar", L"bar"},
{L"/foo/bar/", L""},
{L"/filename.exe", L"filename.exe"},
{L"filename.exe", L"filename.exe"},
{L"", L""},
{L"/", L""},
#endif
};

// Test finding the file type from a path name
static const struct extension_case {
const wchar_t* path;
const wchar_t* extension;
} extension_cases[] = {
#if defined(OS_WIN)
{L"C:\\colon\\backslash\\filename.extension", L"extension"},
{L"C:\\colon\\backslash\\filename.", L""},
{L"C:\\colon\\backslash\\filename", L""},
{L"C:\\colon\\backslash\\", L""},
{L"C:\\colon\\backslash.\\", L""},
{L"C:\\colon\\backslash\filename.extension.extension2", L"extension2"},
#elif defined(OS_POSIX)
{L"/foo/bar/filename.extension", L"extension"},
{L"/foo/bar/filename.", L""},
{L"/foo/bar/filename", L""},
{L"/foo/bar/", L""},
{L"/foo/bar./", L""},
{L"/foo/bar/filename.extension.extension2", L"extension2"},
{L".", L""},
{L"..", L""},
{L"./foo", L""},
{L"./foo.extension", L"extension"},
{L"/foo.extension1/bar.extension2", L"extension2"},
#endif
};

// Test finding the directory component of a path
static const struct dir_case {
const wchar_t* full_path;
const wchar_t* directory;
} dir_cases[] = {
#if defined(OS_WIN)
{L"C:\\WINDOWS\\system32\\gdi32.dll", L"C:\\WINDOWS\\system32"},
{L"C:\\WINDOWS\\system32\\not_exist_thx_1138", L"C:\\WINDOWS\\system32"},
{L"C:\\WINDOWS\\system32\\", L"C:\\WINDOWS\\system32"},
{L"C:\\WINDOWS\\system32\\\\", L"C:\\WINDOWS\\system32"},
{L"C:\\WINDOWS\\system32", L"C:\\WINDOWS"},
{L"C:\\WINDOWS\\system32.\\", L"C:\\WINDOWS\\system32."},
{L"C:\\", L"C:\\"},
#elif defined(OS_POSIX)
{L"/foo/bar/gdi32.dll", L"/foo/bar"},
{L"/foo/bar/not_exist_thx_1138", L"/foo/bar"},
{L"/foo/bar/", L"/foo/bar"},
{L"/foo/bar//", L"/foo/bar"},
{L"/foo/bar", L"/foo"},
{L"/foo/bar./", L"/foo/bar."},
{L"/", L"/"},
{L".", L"."},
{L"..", L"."}, // yes, ".." technically lives in "."
#endif
};

TEST_F(FileUtilTest, FileAndDirectorySize) {
// Create three files of 20, 30 and 3 chars (utf8). ComputeDirectorySize
// should return 53 bytes.
Expand Down
4 changes: 0 additions & 4 deletions base/memory/shared_memory_posix.cc
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,6 @@ namespace base {

namespace {

// Paranoia. Semaphores and shared memory segments should live in different
// namespaces, but who knows what's out there.
const char kSemaphoreSuffix[] = "-sem";

LazyInstance<Lock>::Leaky g_thread_lock_ = LAZY_INSTANCE_INITIALIZER;

}
Expand Down
4 changes: 3 additions & 1 deletion base/message_loop/message_loop_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -609,7 +609,9 @@ void RunTest_Nesting(MessageLoop::Type message_loop_type) {
EXPECT_EQ(depth, 0);
}

const wchar_t* const kMessageBoxTitle = L"MessageLoop Unit Test";
#if defined(OS_WIN)
const wchar_t kMessageBoxTitle[] = L"MessageLoop Unit Test";
#endif // defined(OS_WIN)

enum TaskType {
MESSAGEBOX,
Expand Down
8 changes: 1 addition & 7 deletions base/process/process_util_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -54,12 +54,6 @@ using base::FilePath;

namespace {

#if defined(OS_WIN)
const wchar_t kProcessName[] = L"base_unittests.exe";
#else
const wchar_t kProcessName[] = L"base_unittests";
#endif // defined(OS_WIN)

#if defined(OS_ANDROID)
const char kShellPath[] = "/system/bin/sh";
const char kPosixShell[] = "sh";
Expand All @@ -69,7 +63,6 @@ const char kPosixShell[] = "bash";
#endif

const char kSignalFileSlow[] = "SlowChildProcess.die";
const char kSignalFileCrash[] = "CrashingChildProcess.die";
const char kSignalFileKill[] = "KilledChildProcess.die";

#if defined(OS_WIN)
Expand Down Expand Up @@ -221,6 +214,7 @@ TEST_F(ProcessUtilTest, GetProcId) {
// TODO(gspencer): turn this test process into a very small program
// with no symbols (instead of using the multiprocess testing
// framework) to reduce the ReportCrash overhead.
const char kSignalFileCrash[] = "CrashingChildProcess.die";

MULTIPROCESS_TEST_MAIN(CrashingChildProcess) {
WaitToDie(ProcessUtilTest::GetSignalFilePath(kSignalFileCrash).c_str());
Expand Down
2 changes: 0 additions & 2 deletions base/test/test_launcher.cc
Original file line number Diff line number Diff line change
Expand Up @@ -564,8 +564,6 @@ const char kGTestRepeatFlag[] = "gtest_repeat";
const char kGTestRunDisabledTestsFlag[] = "gtest_also_run_disabled_tests";
const char kGTestOutputFlag[] = "gtest_output";

const char kHelpFlag[] = "help";

TestResult::TestResult() : status(TEST_UNKNOWN) {
}

Expand Down
2 changes: 0 additions & 2 deletions base/time/time_mac.cc
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,6 @@ namespace base {
// irb(main):011:0> Time.at(-11644473600).getutc()
// => Mon Jan 01 00:00:00 UTC 1601
static const int64 kWindowsEpochDeltaSeconds = GG_INT64_C(11644473600);
static const int64 kWindowsEpochDeltaMilliseconds =
kWindowsEpochDeltaSeconds * Time::kMillisecondsPerSecond;

// static
const int64 Time::kWindowsEpochDeltaMicroseconds =
Expand Down
10 changes: 2 additions & 8 deletions chrome/common/chrome_paths.cc
Original file line number Diff line number Diff line change
Expand Up @@ -64,16 +64,10 @@ const base::FilePath::CharType kInternalNaClPluginFileName[] =
FILE_PATH_LITERAL("libppGoogleNaClPluginChrome.so");
#endif

#if defined(OS_POSIX) && !defined(OS_MACOSX)

const base::FilePath::CharType kEffectsPluginFileName[] =
#if defined(OS_WIN)
FILE_PATH_LITERAL("pepper/libppeffects.dll");
#elif defined(OS_MACOSX)
FILE_PATH_LITERAL("pepper/libppeffects.plugin");
#else // Linux and Chrome OS
FILE_PATH_LITERAL("pepper/libppeffects.so");
#endif

#if defined(OS_POSIX) && !defined(OS_MACOSX)

const base::FilePath::CharType kO3DPluginFileName[] =
FILE_PATH_LITERAL("pepper/libppo3dautoplugin.so");
Expand Down
2 changes: 2 additions & 0 deletions chrome/common/chrome_switches.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1134,8 +1134,10 @@ const char kPrerenderModeSwitchValueEnabled[] = "enabled";
// prefetch_only: No prerendering, but enables prefetching.
const char kPrerenderModeSwitchValuePrefetchOnly[] = "prefetch_only";

#if defined(OS_WIN)
// Enable conversion from vector to raster for any page.
const char kPrintRaster[] = "print-raster";
#endif

// Use IPv6 only for privet HTTP.
const char kPrivetIPv6Only[] = "privet-ipv6-only";
Expand Down
27 changes: 0 additions & 27 deletions chrome/common/pref_names.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1703,33 +1703,6 @@ const char kNtpPromoDesktopSessionFound[] = "ntp.promo_desktop_session_found";
// Boolean indicating whether the web store is active for the current locale.
const char kNtpWebStoreEnabled[] = "ntp.webstore_enabled";

// The id of the last web store promo actually displayed on the NTP.
const char kNtpWebStorePromoLastId[] = "ntp.webstore_last_promo_id";

// The id of the current web store promo.
const char kNtpWebStorePromoId[] = "ntp.webstorepromo.id";

// The header line for the NTP web store promo.
const char kNtpWebStorePromoHeader[] = "ntp.webstorepromo.header";

// The button text for the NTP web store promo.
const char kNtpWebStorePromoButton[] = "ntp.webstorepromo.button";

// The button link for the NTP web store promo.
const char kNtpWebStorePromoLink[] = "ntp.webstorepromo.link";

// The image URL for the NTP web store promo logo.
const char kNtpWebStorePromoLogo[] = "ntp.webstorepromo.logo";

// The original URL for the NTP web store promo logo.
const char kNtpWebStorePromoLogoSource[] = "ntp.webstorepromo.logo_source";

// The "hide this" link text for the NTP web store promo.
const char kNtpWebStorePromoExpire[] = "ntp.webstorepromo.expire";

// Specifies what users should maximize the NTP web store promo.
const char kNtpWebStorePromoUserGroup[] = "ntp.webstorepromo.usergroup";

// Customized app page names that appear on the New Tab Page.
const char kNtpAppPageNames[] = "ntp.app_page_names";

Expand Down
3 changes: 0 additions & 3 deletions chrome/installer/gcapi_mac/gcapi.mm
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,6 @@
@"~~/Library/Application Support/Google/Chrome/"
"Google Chrome Master Preferences";

NSString* const kChannelKey = @"KSChannelID";
NSString* const kVersionKey = @"KSVersion";

// Condensed from chromium's base/mac/mac_util.mm.
bool IsOSXVersionSupported() {
// On 10.6, Gestalt() was observed to be able to spawn threads (see
Expand Down
6 changes: 0 additions & 6 deletions content/test/plugin/plugin_get_javascript_url2_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,9 @@
// The identifier for the self url stream.
#define SELF_URL_STREAM_ID 1

// The identifier for the fetched url stream.
#define FETCHED_URL_STREAM_ID 2

// The maximum chunk size of stream data.
#define STREAM_CHUNK 197

const int kNPNEvaluateTimerID = 100;
const int kNPNEvaluateTimerElapse = 50;

namespace NPAPIClient {

ExecuteGetJavascriptUrl2Test::ExecuteGetJavascriptUrl2Test(
Expand Down
6 changes: 2 additions & 4 deletions content/test/plugin/plugin_get_javascript_url_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,13 @@
// The identifier for the self url stream.
#define SELF_URL_STREAM_ID 1

// The identifier for the fetched url stream.
#define FETCHED_URL_STREAM_ID 2

// The maximum chunk size of stream data.
#define STREAM_CHUNK 197

#if defined(OS_WIN)
const int kNPNEvaluateTimerID = 100;
const int kNPNEvaluateTimerElapse = 50;

#endif

namespace NPAPIClient {

Expand Down
3 changes: 1 addition & 2 deletions net/base/directory_lister.cc
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@ namespace net {

namespace {

const int kFilesPerEvent = 8;

bool IsDotDot(const base::FilePath& path) {
return FILE_PATH_LITERAL("..") == path.BaseName().value();
}
Expand Down Expand Up @@ -169,6 +167,7 @@ void DirectoryLister::Core::StartInternal() {
should be done from JS to give more flexibility in the page. When we do
that, we can uncomment this to send incremental updates to the page.
const int kFilesPerEvent = 8;
if (file_data.size() < kFilesPerEvent)
continue;
Expand Down
6 changes: 0 additions & 6 deletions net/base/filter.cc
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,11 @@ const char kSdch[] = "sdch";
// compress and x-compress are currently not supported. If we decide to support
// them, we'll need the same mime type compatibility hack we have for gzip. For
// more information, see Firefox's nsHttpChannel::ProcessNormal.
const char kCompress[] = "compress";
const char kXCompress[] = "x-compress";
const char kIdentity[] = "identity";
const char kUncompressed[] = "uncompressed";

// Mime types:
const char kApplicationXGzip[] = "application/x-gzip";
const char kApplicationGzip[] = "application/gzip";
const char kApplicationXGunzip[] = "application/x-gunzip";
const char kApplicationXCompress[] = "application/x-compress";
const char kApplicationCompress[] = "application/compress";
const char kTextHtml[] = "text/html";

// Buffer size allocated when de-compressing data.
Expand Down
5 changes: 0 additions & 5 deletions net/base/gzip_filter_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,6 @@ namespace {
const int kDefaultBufferSize = 4096;
const int kSmallBufferSize = 128;

const char kApplicationOctetStream[] = "application/octet-stream";
const char kApplicationXGzip[] = "application/x-gzip";
const char kApplicationGzip[] = "application/gzip";
const char kApplicationXGunzip[] = "application/x-gunzip";

// The GZIP header (see RFC 1952):
// +---+---+---+---+---+---+---+---+---+---+
// |ID1|ID2|CM |FLG| MTIME |XFL|OS |
Expand Down
3 changes: 3 additions & 0 deletions net/cert/ev_root_ca_metadata.cc
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@

namespace net {

#if defined(USE_NSS) || defined(OS_IOS) || defined(OS_WIN)
// Raw metadata.
struct EVMetadata {
// kMaxOIDsPerCA is the number of OIDs that we can support per root CA. At
Expand Down Expand Up @@ -389,6 +390,8 @@ static const EVMetadata ev_root_ca_metadata[] = {
}
};

#endif // defined(USE_NSS) || defined(OS_IOS) || defined(OS_WIN)

static base::LazyInstance<EVRootCAMetadata>::Leaky
g_ev_root_ca_metadata = LAZY_INSTANCE_INITIALIZER;

Expand Down
12 changes: 6 additions & 6 deletions net/cert/ev_root_ca_metadata_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,17 @@ namespace net {

namespace {

static const char kVerisignPolicy[] = "2.16.840.1.113733.1.7.23.6";
static const char kThawtePolicy[] = "2.16.840.1.113733.1.7.48.1";
static const char kFakePolicy[] = "2.16.840.1.42";
static const SHA1HashValue kVerisignFingerprint =
#if defined(USE_NSS) || defined(OS_WIN)
const char kVerisignPolicy[] = "2.16.840.1.113733.1.7.23.6";
const char kThawtePolicy[] = "2.16.840.1.113733.1.7.48.1";
const char kFakePolicy[] = "2.16.840.1.42";
const SHA1HashValue kVerisignFingerprint =
{ { 0x74, 0x2c, 0x31, 0x92, 0xe6, 0x07, 0xe4, 0x24, 0xeb, 0x45,
0x49, 0x54, 0x2b, 0xe1, 0xbb, 0xc5, 0x3e, 0x61, 0x74, 0xe2 } };
static const SHA1HashValue kFakeFingerprint =
const SHA1HashValue kFakeFingerprint =
{ { 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99,
0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99 } };

#if defined(USE_NSS) || defined(OS_WIN)
class EVOidData {
public:
EVOidData();
Expand Down
1 change: 0 additions & 1 deletion net/cookies/cookie_monster_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,6 @@ struct CookieMonsterTestTraits {

static const bool is_cookie_monster = true;
static const bool supports_http_only = true;
static const bool supports_cookies_with_info = true;
static const bool supports_non_dotted_domains = true;
static const bool supports_trailing_dots = true;
static const bool filters_schemes = true;
Expand Down
Loading

0 comments on commit 2bf5a6a

Please sign in to comment.