Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(92)

Side by Side Diff: tools/android/memconsumer/memconsumer_hook.cc

Issue 1551313002: Enable -Wformat in linux, android, chromeos, cast builds. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « tools/android/file_poller/file_poller.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include <android/log.h> 5 #include <android/log.h>
6 #include <jni.h> 6 #include <jni.h>
7 #include <stdio.h> 7 #include <stdio.h>
8 #include <string.h> 8 #include <string.h>
9 9
10 extern "C" { 10 extern "C" {
(...skipping 24 matching lines...) Expand all
35 if (g_memory) 35 if (g_memory)
36 free(g_memory); 36 free(g_memory);
37 if (memory == 0) { 37 if (memory == 0) {
38 g_memory = NULL; 38 g_memory = NULL;
39 return; 39 return;
40 } 40 }
41 g_memory = static_cast<uint32_t*>(malloc(memory)); 41 g_memory = static_cast<uint32_t*>(malloc(memory));
42 if (!g_memory) { 42 if (!g_memory) {
43 __android_log_print(ANDROID_LOG_WARN, 43 __android_log_print(ANDROID_LOG_WARN,
44 "MemConsumer", 44 "MemConsumer",
45 "Unable to allocate %ld bytes", 45 "Unable to allocate %lld bytes",
46 memory); 46 memory);
47 } 47 }
48 // If memory allocation failed, try to allocate as much as possible. 48 // If memory allocation failed, try to allocate as much as possible.
49 while (!g_memory) { 49 while (!g_memory) {
50 memory /= 2; 50 memory /= 2;
51 g_memory = static_cast<uint32_t*>(malloc(memory)); 51 g_memory = static_cast<uint32_t*>(malloc(memory));
52 } 52 }
53 for (int i = 0; i < memory / sizeof(uint32_t); ++i) 53 for (int i = 0; i < memory / sizeof(uint32_t); ++i)
54 *(g_memory + i) = get_random(); 54 *(g_memory + i) = get_random();
55 } 55 }
OLDNEW
« no previous file with comments | « tools/android/file_poller/file_poller.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698