Merge "Ignore another stupid lint warning."
diff --git a/adb/file_sync_client.c b/adb/file_sync_client.c
index f93c876..f7828a6 100644
--- a/adb/file_sync_client.c
+++ b/adb/file_sync_client.c
@@ -529,17 +529,12 @@
} else {
memcpy(buffer, &id, 4);
buffer[4] = 0;
-// strcpy(buffer,"unknown reason");
}
fprintf(stderr,"failed to copy '%s' to '%s': %s\n", rpath, lpath, buffer);
return 0;
}
-
-
/* --- */
-
-
static void do_sync_ls_cb(unsigned mode, unsigned size, unsigned time,
const char *name, void *cookie)
{
@@ -573,7 +568,6 @@
unsigned int mode;
unsigned int size;
int flag;
- //char data[0];
};
copyinfo *mkcopyinfo(const char *spath, const char *dpath,
@@ -601,7 +595,6 @@
snprintf((char*) ci->src, ssize, isdir ? "%s%s/" : "%s%s", spath, name);
snprintf((char*) ci->dst, dsize, isdir ? "%s%s/" : "%s%s", dpath, name);
-// fprintf(stderr,"mkcopyinfo('%s','%s')\n", ci->src, ci->dst);
return ci;
}
@@ -615,8 +608,6 @@
copyinfo *dirlist = 0;
copyinfo *ci, *next;
-// fprintf(stderr,"local_build_list('%s','%s')\n", lpath, rpath);
-
d = opendir(lpath);
if(d == 0) {
fprintf(stderr,"cannot open '%s': %s\n", lpath, strerror(errno));
diff --git a/adb/sockets.c b/adb/sockets.c
index 6cdde97..1598c3c 100644
--- a/adb/sockets.c
+++ b/adb/sockets.c
@@ -45,8 +45,6 @@
return writex(fd, reason, len);
}
-//extern int online;
-
static unsigned local_socket_next_id = 1;
static asocket local_socket_list = {
@@ -196,10 +194,9 @@
static void local_socket_ready(asocket *s)
{
- /* far side is ready for data, pay attention to
- readable events */
+ /* far side is ready for data, pay attention to
+ readable events */
fdevent_add(&s->fde, FDE_READ);
-// D("LS(%d): ready()\n", s->id);
}
static void local_socket_close(asocket *s)
@@ -240,7 +237,7 @@
static void local_socket_close_locked(asocket *s)
{
- D("entered. LS(%d) fd=%d\n", s->id, s->fd);
+ D("entered local_socket_close_locked. LS(%d) fd=%d\n", s->id, s->fd);
if(s->peer) {
D("LS(%d): closing peer. peer->id=%d peer->fd=%d\n",
s->id, s->peer->id, s->peer->fd);
@@ -403,7 +400,6 @@
** catching it here means we may skip the last few
** bytes of readable data.
*/
-// s->close(s);
D("LS(%d): FDE_ERROR (fd=%d)\n", s->id, s->fd);
return;
@@ -422,8 +418,6 @@
install_local_socket(s);
fdevent_install(&s->fde, fd, local_socket_event_func, s);
-/* fdevent_add(&s->fde, FDE_ERROR); */
- //fprintf(stderr, "Created local socket in create_local_socket \n");
D("LS(%d): created (fd=%d)\n", s->id, s->fd);
return s;
}
diff --git a/adb/usb_linux.c b/adb/usb_linux.c
index 7d13a5d..d242c8a 100644
--- a/adb/usb_linux.c
+++ b/adb/usb_linux.c
@@ -379,6 +379,7 @@
struct usbdevfs_urb *out = NULL;
int res;
+ D("++ usb_bulk_read ++\n");
memset(urb, 0, sizeof(*urb));
urb->type = USBDEVFS_URB_TYPE_BULK;
urb->endpoint = h->ep_in;
@@ -441,6 +442,7 @@
}
fail:
adb_mutex_unlock(&h->lock);
+ D("-- usb_bulk_read --\n");
return res;
}
@@ -451,6 +453,7 @@
int n;
int need_zero = 0;
+ D("++ usb_write ++\n");
if(h->zero_mask) {
/* if we need 0-markers and our transfer
** is an even multiple of the packet size,
@@ -480,6 +483,7 @@
return n;
}
+ D("-- usb_write --\n");
return 0;
}
@@ -554,7 +558,7 @@
int usb_close(usb_handle *h)
{
- D("[ usb close ... ]\n");
+ D("++ usb close ++\n");
adb_mutex_lock(&usb_lock);
h->next->prev = h->prev;
h->prev->next = h->next;
@@ -562,7 +566,7 @@
h->next = 0;
adb_close(h->desc);
- D("[ usb closed %p (fd = %d) ]\n", h, h->desc);
+ D("-- usb closed %p (fd = %d) --\n", h, h->desc);
adb_mutex_unlock(&usb_lock);
free(h);
diff --git a/include/utils/FileMap.h b/include/utils/FileMap.h
index 6c0aa52..f70fc92 100644
--- a/include/utils/FileMap.h
+++ b/include/utils/FileMap.h
@@ -63,6 +63,8 @@
bool create(const char* origFileName, int fd,
off64_t offset, size_t length, bool readOnly);
+ ~FileMap(void);
+
/*
* Return the name of the file this map came from, if known.
*/
@@ -84,19 +86,6 @@
off64_t getDataOffset(void) const { return mDataOffset; }
/*
- * Get a "copy" of the object.
- */
- FileMap* acquire(void) { mRefCount++; return this; }
-
- /*
- * Call this when mapping is no longer needed.
- */
- void release(void) {
- if (--mRefCount <= 0)
- delete this;
- }
-
- /*
* This maps directly to madvise() values, but allows us to avoid
* including <sys/mman.h> everywhere.
*/
@@ -112,15 +101,12 @@
int advise(MapAdvice advice);
protected:
- // don't delete objects; call release()
- ~FileMap(void);
private:
// these are not implemented
FileMap(const FileMap& src);
const FileMap& operator=(const FileMap& src);
- int mRefCount; // reference count
char* mFileName; // original file name, if known
void* mBasePtr; // base of mmap area; page aligned
size_t mBaseLength; // length, measured from "mBasePtr"
diff --git a/libcutils/loghack.h b/libcutils/loghack.h
deleted file mode 100644
index 750cab0..0000000
--- a/libcutils/loghack.h
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * Copyright (C) 2007 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/**
- * This is a temporary hack to enable logging from cutils.
- */
-
-#ifndef _CUTILS_LOGHACK_H
-#define _CUTILS_LOGHACK_H
-
-#ifdef HAVE_ANDROID_OS
-#include <cutils/log.h>
-#else
-#include <stdio.h>
-#define ALOG(level, ...) \
- ((void)printf("cutils:" level "/" LOG_TAG ": " __VA_ARGS__))
-#define ALOGV(...) ALOG("V", __VA_ARGS__)
-#define ALOGD(...) ALOG("D", __VA_ARGS__)
-#define ALOGI(...) ALOG("I", __VA_ARGS__)
-#define ALOGW(...) ALOG("W", __VA_ARGS__)
-#define ALOGE(...) ALOG("E", __VA_ARGS__)
-#define LOG_ALWAYS_FATAL(...) do { ALOGE(__VA_ARGS__); exit(1); } while (0)
-#endif
-
-#endif // _CUTILS_LOGHACK_H
diff --git a/libcutils/properties.c b/libcutils/properties.c
index 1190ab7..4e46e02 100644
--- a/libcutils/properties.c
+++ b/libcutils/properties.c
@@ -28,7 +28,7 @@
#include <cutils/properties.h>
#include <stdbool.h>
#include <inttypes.h>
-#include "loghack.h"
+#include <log/log.h>
int8_t property_get_bool(const char *key, int8_t default_value) {
if (!key) {
@@ -104,8 +104,6 @@
return (int32_t)property_get_imax(key, INT32_MIN, INT32_MAX, default_value);
}
-#ifdef __BIONIC__
-
#define _REALLY_INCLUDE_SYS__SYSTEM_PROPERTIES_H_
#include <sys/_system_properties.h>
@@ -156,83 +154,3 @@
struct property_list_callback_data data = { propfn, cookie };
return __system_property_foreach(property_list_callback, &data);
}
-
-#else
-
-/* SUPER-cheesy place-holder implementation for glibc/Mac OS/Windows. */
-
-#include <cutils/threads.h>
-
-static mutex_t env_lock = MUTEX_INITIALIZER;
-
-int property_get(const char *key, char *value, const char *default_value)
-{
- char ename[PROPERTY_KEY_MAX + 6];
- char *p;
- int len;
-
- len = strlen(key);
- if(len >= PROPERTY_KEY_MAX) return -1;
- memcpy(ename, "PROP_", 5);
- memcpy(ename + 5, key, len + 1);
-
- mutex_lock(&env_lock);
-
- p = getenv(ename);
- if(p == 0) p = "";
- len = strlen(p);
- if(len >= PROPERTY_VALUE_MAX) {
- len = PROPERTY_VALUE_MAX - 1;
- }
-
- if((len == 0) && default_value) {
- len = strlen(default_value);
- memcpy(value, default_value, len + 1);
- } else {
- memcpy(value, p, len);
- value[len] = 0;
- }
-
- mutex_unlock(&env_lock);
-
- return len;
-}
-
-
-int property_set(const char *key, const char *value)
-{
- char ename[PROPERTY_KEY_MAX + 6];
- char *p;
- int len;
- int r;
-
- if(strlen(value) >= PROPERTY_VALUE_MAX) return -1;
-
- len = strlen(key);
- if(len >= PROPERTY_KEY_MAX) return -1;
- memcpy(ename, "PROP_", 5);
- memcpy(ename + 5, key, len + 1);
-
- mutex_lock(&env_lock);
-#ifdef HAVE_MS_C_RUNTIME
- {
- char temp[256];
- snprintf( temp, sizeof(temp), "%s=%s", ename, value);
- putenv(temp);
- r = 0;
- }
-#else
- r = setenv(ename, value, 1);
-#endif
- mutex_unlock(&env_lock);
-
- return r;
-}
-
-int property_list(void (*propfn)(const char *key, const char *value, void *cookie),
- void *cookie)
-{
- return 0;
-}
-
-#endif
diff --git a/libutils/FileMap.cpp b/libutils/FileMap.cpp
index 0af066f..91e45d8 100644
--- a/libutils/FileMap.cpp
+++ b/libutils/FileMap.cpp
@@ -48,7 +48,7 @@
// Constructor. Create an empty object.
FileMap::FileMap(void)
- : mRefCount(1), mFileName(NULL), mBasePtr(NULL), mBaseLength(0),
+ : mFileName(NULL), mBasePtr(NULL), mBaseLength(0),
mDataPtr(NULL), mDataLength(0)
{
}
@@ -56,11 +56,6 @@
// Destructor.
FileMap::~FileMap(void)
{
- assert(mRefCount == 0);
-
- //printf("+++ removing FileMap %p %zu\n", mDataPtr, mDataLength);
-
- mRefCount = -100; // help catch double-free
if (mFileName != NULL) {
free(mFileName);
}
@@ -134,7 +129,6 @@
void* ptr;
- assert(mRefCount == 1);
assert(fd >= 0);
assert(offset >= 0);
assert(length > 0);
diff --git a/libutils/Tokenizer.cpp b/libutils/Tokenizer.cpp
index 7067533..610002f 100644
--- a/libutils/Tokenizer.cpp
+++ b/libutils/Tokenizer.cpp
@@ -43,9 +43,7 @@
}
Tokenizer::~Tokenizer() {
- if (mFileMap) {
- mFileMap->release();
- }
+ delete mFileMap;
if (mOwnBuffer) {
delete[] mBuffer;
}
@@ -74,7 +72,7 @@
fileMap->advise(FileMap::SEQUENTIAL);
buffer = static_cast<char*>(fileMap->getDataPtr());
} else {
- fileMap->release();
+ delete fileMap;
fileMap = NULL;
// Fall back to reading into a buffer since we can't mmap files in sysfs.
diff --git a/libziparchive/zip_archive.cc b/libziparchive/zip_archive.cc
index afc122d..ebbab9f 100644
--- a/libziparchive/zip_archive.cc
+++ b/libziparchive/zip_archive.cc
@@ -321,9 +321,7 @@
close(fd);
}
- if (directory_map != NULL) {
- directory_map->release();
- }
+ delete directory_map;
free(hash_table);
}
};
@@ -335,7 +333,7 @@
android::FileMap* file_map = new android::FileMap;
const bool success = file_map->create(debug_file_name, fd, start, length, read_only);
if (!success) {
- file_map->release();
+ delete file_map;
return NULL;
}
@@ -1170,7 +1168,7 @@
const int32_t error = ExtractToMemory(handle, entry,
reinterpret_cast<uint8_t*>(map->getDataPtr()),
map->getDataLength());
- map->release();
+ delete map;
return error;
}