Merge "Fix warnings on unused variables and parameters."

This commit is contained in:
Chih-Hung Hsieh 2014-09-12 00:13:40 +00:00 committed by Gerrit Code Review
commit 07c9557f60
3 changed files with 25 additions and 28 deletions

View File

@ -144,7 +144,6 @@ int fix_uid(const char *pkgname, uid_t uid, gid_t gid)
{ {
char pkgdir[PKG_PATH_MAX]; char pkgdir[PKG_PATH_MAX];
struct stat s; struct stat s;
int rc = 0;
if ((uid < AID_SYSTEM) || (gid < AID_SYSTEM)) { if ((uid < AID_SYSTEM) || (gid < AID_SYSTEM)) {
ALOGE("invalid uid/gid: %d %d\n", uid, gid); ALOGE("invalid uid/gid: %d %d\n", uid, gid);
@ -623,7 +622,7 @@ static void run_dexopt(int zip_fd, int odex_fd, const char* input_file_name,
} }
static void run_patchoat(int input_fd, int oat_fd, const char* input_file_name, static void run_patchoat(int input_fd, int oat_fd, const char* input_file_name,
const char* output_file_name, const char *pkgname, const char *instruction_set) const char* output_file_name, const char *pkgname __unused, const char *instruction_set)
{ {
static const int MAX_INT_LEN = 12; // '-'+10dig+'\0' -OR- 0x+8dig static const int MAX_INT_LEN = 12; // '-'+10dig+'\0' -OR- 0x+8dig
static const unsigned int MAX_INSTRUCTION_SET_LEN = 7; static const unsigned int MAX_INSTRUCTION_SET_LEN = 7;

View File

@ -26,58 +26,58 @@
#define TOKEN_MAX 8 /* max number of arguments in buffer */ #define TOKEN_MAX 8 /* max number of arguments in buffer */
#define REPLY_MAX 256 /* largest reply allowed */ #define REPLY_MAX 256 /* largest reply allowed */
static int do_ping(char **arg, char reply[REPLY_MAX]) static int do_ping(char **arg __unused, char reply[REPLY_MAX] __unused)
{ {
return 0; return 0;
} }
static int do_install(char **arg, char reply[REPLY_MAX]) static int do_install(char **arg, char reply[REPLY_MAX] __unused)
{ {
return install(arg[0], atoi(arg[1]), atoi(arg[2]), arg[3]); /* pkgname, uid, gid, seinfo */ return install(arg[0], atoi(arg[1]), atoi(arg[2]), arg[3]); /* pkgname, uid, gid, seinfo */
} }
static int do_dexopt(char **arg, char reply[REPLY_MAX]) static int do_dexopt(char **arg, char reply[REPLY_MAX] __unused)
{ {
/* apk_path, uid, is_public, pkgname, instruction_set, vm_safe_mode, should_relocate */ /* apk_path, uid, is_public, pkgname, instruction_set, vm_safe_mode, should_relocate */
return dexopt(arg[0], atoi(arg[1]), atoi(arg[2]), arg[3], arg[4], atoi(arg[5]), 0); return dexopt(arg[0], atoi(arg[1]), atoi(arg[2]), arg[3], arg[4], atoi(arg[5]), 0);
} }
static int do_move_dex(char **arg, char reply[REPLY_MAX]) static int do_move_dex(char **arg, char reply[REPLY_MAX] __unused)
{ {
return move_dex(arg[0], arg[1], arg[2]); /* src, dst, instruction_set */ return move_dex(arg[0], arg[1], arg[2]); /* src, dst, instruction_set */
} }
static int do_rm_dex(char **arg, char reply[REPLY_MAX]) static int do_rm_dex(char **arg, char reply[REPLY_MAX] __unused)
{ {
return rm_dex(arg[0], arg[1]); /* pkgname, instruction_set */ return rm_dex(arg[0], arg[1]); /* pkgname, instruction_set */
} }
static int do_remove(char **arg, char reply[REPLY_MAX]) static int do_remove(char **arg, char reply[REPLY_MAX] __unused)
{ {
return uninstall(arg[0], atoi(arg[1])); /* pkgname, userid */ return uninstall(arg[0], atoi(arg[1])); /* pkgname, userid */
} }
static int do_rename(char **arg, char reply[REPLY_MAX]) static int do_rename(char **arg, char reply[REPLY_MAX] __unused)
{ {
return renamepkg(arg[0], arg[1]); /* oldpkgname, newpkgname */ return renamepkg(arg[0], arg[1]); /* oldpkgname, newpkgname */
} }
static int do_fixuid(char **arg, char reply[REPLY_MAX]) static int do_fixuid(char **arg, char reply[REPLY_MAX] __unused)
{ {
return fix_uid(arg[0], atoi(arg[1]), atoi(arg[2])); /* pkgname, uid, gid */ return fix_uid(arg[0], atoi(arg[1]), atoi(arg[2])); /* pkgname, uid, gid */
} }
static int do_free_cache(char **arg, char reply[REPLY_MAX]) /* TODO int:free_size */ static int do_free_cache(char **arg, char reply[REPLY_MAX] __unused) /* TODO int:free_size */
{ {
return free_cache((int64_t)atoll(arg[0])); /* free_size */ return free_cache((int64_t)atoll(arg[0])); /* free_size */
} }
static int do_rm_cache(char **arg, char reply[REPLY_MAX]) static int do_rm_cache(char **arg, char reply[REPLY_MAX] __unused)
{ {
return delete_cache(arg[0], atoi(arg[1])); /* pkgname, userid */ return delete_cache(arg[0], atoi(arg[1])); /* pkgname, userid */
} }
static int do_get_size(char **arg, char reply[REPLY_MAX]) static int do_get_size(char **arg, char reply[REPLY_MAX] __unused)
{ {
int64_t codesize = 0; int64_t codesize = 0;
int64_t datasize = 0; int64_t datasize = 0;
@ -98,38 +98,38 @@ static int do_get_size(char **arg, char reply[REPLY_MAX])
return res; return res;
} }
static int do_rm_user_data(char **arg, char reply[REPLY_MAX]) static int do_rm_user_data(char **arg, char reply[REPLY_MAX] __unused)
{ {
return delete_user_data(arg[0], atoi(arg[1])); /* pkgname, userid */ return delete_user_data(arg[0], atoi(arg[1])); /* pkgname, userid */
} }
static int do_mk_user_data(char **arg, char reply[REPLY_MAX]) static int do_mk_user_data(char **arg, char reply[REPLY_MAX] __unused)
{ {
return make_user_data(arg[0], atoi(arg[1]), atoi(arg[2]), arg[3]); return make_user_data(arg[0], atoi(arg[1]), atoi(arg[2]), arg[3]);
/* pkgname, uid, userid, seinfo */ /* pkgname, uid, userid, seinfo */
} }
static int do_mk_user_config(char **arg, char reply[REPLY_MAX]) static int do_mk_user_config(char **arg, char reply[REPLY_MAX] __unused)
{ {
return make_user_config(atoi(arg[0])); /* userid */ return make_user_config(atoi(arg[0])); /* userid */
} }
static int do_rm_user(char **arg, char reply[REPLY_MAX]) static int do_rm_user(char **arg, char reply[REPLY_MAX] __unused)
{ {
return delete_user(atoi(arg[0])); /* userid */ return delete_user(atoi(arg[0])); /* userid */
} }
static int do_movefiles(char **arg, char reply[REPLY_MAX]) static int do_movefiles(char **arg __unused, char reply[REPLY_MAX] __unused)
{ {
return movefiles(); return movefiles();
} }
static int do_linklib(char **arg, char reply[REPLY_MAX]) static int do_linklib(char **arg, char reply[REPLY_MAX] __unused)
{ {
return linklib(arg[0], arg[1], atoi(arg[2])); return linklib(arg[0], arg[1], atoi(arg[2]));
} }
static int do_idmap(char **arg, char reply[REPLY_MAX]) static int do_idmap(char **arg, char reply[REPLY_MAX] __unused)
{ {
return idmap(arg[0], arg[1], atoi(arg[2])); return idmap(arg[0], arg[1], atoi(arg[2]));
} }
@ -140,7 +140,7 @@ static int do_restorecon_data(char **arg, char reply[REPLY_MAX] __attribute__((u
/* pkgName, seinfo, uid*/ /* pkgName, seinfo, uid*/
} }
static int do_patchoat(char **arg, char reply[REPLY_MAX]) { static int do_patchoat(char **arg, char reply[REPLY_MAX] __unused) {
/* apk_path, uid, is_public, pkgname, instruction_set, vm_safe_mode, should_relocate */ /* apk_path, uid, is_public, pkgname, instruction_set, vm_safe_mode, should_relocate */
return dexopt(arg[0], atoi(arg[1]), atoi(arg[2]), arg[3], arg[4], 0, 1); return dexopt(arg[0], atoi(arg[1]), atoi(arg[2]), arg[3], arg[4], 0, 1);
} }
@ -634,11 +634,11 @@ static int log_callback(int type, const char *fmt, ...) {
return 0; return 0;
} }
int main(const int argc, const char *argv[]) { int main(const int argc __unused, const char *argv[] __unused) {
char buf[BUFFER_MAX]; char buf[BUFFER_MAX];
struct sockaddr addr; struct sockaddr addr;
socklen_t alen; socklen_t alen;
int lsocket, s, count; int lsocket, s;
int selinux_enabled = (is_selinux_enabled() > 0); int selinux_enabled = (is_selinux_enabled() > 0);
ALOGI("installd firing up\n"); ALOGI("installd firing up\n");

View File

@ -163,7 +163,7 @@ int create_user_config_path(char path[PATH_MAX], userid_t userid) {
int create_move_path(char path[PKG_PATH_MAX], int create_move_path(char path[PKG_PATH_MAX],
const char* pkgname, const char* pkgname,
const char* leaf, const char* leaf,
userid_t userid) userid_t userid __unused)
{ {
if ((android_data_dir.len + strlen(PRIMARY_USER_PREFIX) + strlen(pkgname) + strlen(leaf) + 1) if ((android_data_dir.len + strlen(PRIMARY_USER_PREFIX) + strlen(pkgname) + strlen(leaf) + 1)
>= PKG_PATH_MAX) { >= PKG_PATH_MAX) {
@ -239,7 +239,7 @@ static int _delete_dir_contents(DIR *d,
} }
if (de->d_type == DT_DIR) { if (de->d_type == DT_DIR) {
int r, subfd; int subfd;
DIR *subdir; DIR *subdir;
/* always skip "." and ".." */ /* always skip "." and ".." */
@ -783,7 +783,7 @@ void clear_cache_files(cache_t* cache, int64_t free_size)
void finish_cache_collection(cache_t* cache) void finish_cache_collection(cache_t* cache)
{ {
size_t i; CACHE_NOISY(size_t i;)
CACHE_NOISY(ALOGI("clear_cache_files: %d dirs, %d files\n", cache->numDirs, cache->numFiles)); CACHE_NOISY(ALOGI("clear_cache_files: %d dirs, %d files\n", cache->numDirs, cache->numFiles));
CACHE_NOISY( CACHE_NOISY(
@ -1004,7 +1004,6 @@ char *build_string3(char *s1, char *s2, char *s3) {
/* Ensure that /data/media directories are prepared for given user. */ /* Ensure that /data/media directories are prepared for given user. */
int ensure_media_user_dirs(userid_t userid) { int ensure_media_user_dirs(userid_t userid) {
char media_user_path[PATH_MAX]; char media_user_path[PATH_MAX];
char path[PATH_MAX];
// Ensure /data/media/<userid> exists // Ensure /data/media/<userid> exists
create_user_media_path(media_user_path, userid); create_user_media_path(media_user_path, userid);
@ -1017,7 +1016,6 @@ int ensure_media_user_dirs(userid_t userid) {
int ensure_config_user_dirs(userid_t userid) { int ensure_config_user_dirs(userid_t userid) {
char config_user_path[PATH_MAX]; char config_user_path[PATH_MAX];
char path[PATH_MAX];
// writable by system, readable by any app within the same user // writable by system, readable by any app within the same user
const int uid = (userid * AID_USER) + AID_SYSTEM; const int uid = (userid * AID_USER) + AID_SYSTEM;