本文整理汇总了C++中LOGW函数 的典型用法代码示例。如果您正苦于以下问题:C++ LOGW函数的具体用法?C++ LOGW怎么用?C++ LOGW使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了LOGW函数 的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: setup_rand
bool Simulation::setup(const GLuint windowWidth, const GLuint windowHeight, const GLuint viewportWidth, const GLuint viewportHeight, AssetLoader& assetLoader)
{
setup_rand();
this->windowWidth = windowWidth;
this->windowHeight = windowHeight;
this->viewportWidth = viewportWidth;
this->viewportHeight = viewportHeight;
const char VertexShaderCode[] =
"attribute vec4 a_position; \n"
"attribute lowp vec4 a_color; \n"
"varying lowp vec4 v_color; \n"
" \n"
"void main() { \n"
" gl_Position = a_position; \n"
" v_color = a_color; \n"
"} \n";
const char FragmentShaderCode[] =
"precision mediump float; \n"
"varying lowp vec4 v_color; \n"
"void main() { \n"
" gl_FragColor = v_color; \n"
"} \n";
program = createProgram(VertexShaderCode, FragmentShaderCode);
if(!program)
{
LOGE("Could not create program.");
return false;
}
// Load shader attribute locations
positionAttribute = glGetAttribLocation(program, "a_position");
checkGlError("glGetAttribLocation");
LOGI("glGetAttribLocation(\"a_position\") = %d\n", positionAttribute);
colorAttribute = glGetAttribLocation(program, "a_color");
checkGlError("glGetAttribLocation");
LOGI("glGetAttribLocation(\"a_color\") = %d\n", colorAttribute);
// Load triangle currentBuffer
glGenBuffers(1, &vboId);
checkGlError("glGenBuffers");
glBindBuffer(GL_ARRAY_BUFFER, vboId);
checkGlError("glBindBuffer");
// Set the currentBuffer's data
glBufferData(GL_ARRAY_BUFFER, Constants::MaximumVertexCount * sizeof(ColorVertex), ¤tVertices[0], GL_DYNAMIC_DRAW);
checkGlError("glBufferData");
// Create image buffers
const int BufferSize = viewportWidth*viewportHeight*4; /* RGBA format*/
currentBuffer = new unsigned char[BufferSize];
std::fill_n(currentBuffer, BufferSize, 0);
targetBuffer = new unsigned char[BufferSize];
std::fill_n(targetBuffer, BufferSize, 0);
if(!create_render_target())
{
LOGE("Could not create render target!");
return false;
}
LOGW("Integer Sizes: %d %d", sizeof(unsigned long), sizeof(unsigned long));
LOGI("Success engine_init_display");
if(!load_content(assetLoader))
{
LOGE("Could not load content!");
return false;
}
create_random_triangles();
copy_current_to_best_triangles();
LOGI("Simulation is ready to go.");
return true;
}
开发者ID:tivtag, 项目名称:TriDraw, 代码行数:81, 代码来源:Simulation.cpp
示例2: GetClassInfo
void WiEngineApp::createWindow() {
WNDCLASS wc;
DWORD flags = 0;
DWORD exFlags = 0;
ATOM atom;
// Grab the window class we have registered on constructor
atom = GetClassInfo(m_module, _T("WiEngine"), &wc);
if(!atom) {
LOGW("WiEngineApp::createWindow: No window class info found, register window class failed?");
return;
}
// basic flags
flags = WS_CLIPSIBLINGS | WS_CLIPCHILDREN;
// if has menu
if(m_hasMenu) {
flags |= WS_POPUP;
exFlags |= WS_EX_TOOLWINDOW;
}
// check border
if(!m_borderless) {
flags |= WS_OVERLAPPEDWINDOW;
}
// check resizable
if(m_resizable) {
flags |= WS_THICKFRAME | WS_MINIMIZEBOX | WS_MAXIMIZEBOX;
} else {
flags ^= WS_THICKFRAME | WS_MINIMIZEBOX | WS_MAXIMIZEBOX;
}
// windows rect
wyScreenConfig& sc = wyDirector::getScreenConfig();
wyRect winRect = wyr((m_desktopWidth - sc.winWidth) / 2,
(m_desktopHeight - sc.winHeight) / 2,
sc.winWidth,
sc.winHeight);
computeWindowRectFromClientArea(flags, &winRect);
// create window
m_hWnd = CreateWindowEx(
exFlags,
_T("WiEngine"),
m_title,
flags,
winRect.x,
winRect.y,
winRect.width,
winRect.height,
NULL,
NULL,
m_module,
NULL);
if(!m_hWnd) {
LOGE("WiEngineApp::createWindow: failed to create window");
return;
}
// Need to set requested style again, apparently Windows doesn't listen when requesting windows without title bar or borders
SetWindowLong(m_hWnd, GWL_STYLE, flags);
SetWindowPos(m_hWnd, HWND_TOP, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER | SWP_FRAMECHANGED);
// Make a menu window always on top
if(m_hasMenu) {
SetWindowPos(m_hWnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE);
}
}
开发者ID:Adoni, 项目名称:WiEngine, 代码行数:70, 代码来源:WiEngineApp.cpp
示例3: dvmDdmHandlePacket
/*
* "buf" contains a full JDWP packet, possibly with multiple chunks. We
* need to process each, accumulate the replies, and ship the whole thing
* back.
*
* Returns "true" if we have a reply. The reply buffer is newly allocated,
* and includes the chunk type/length, followed by the data.
*
* TODO: we currently assume that the request and reply include a single
* chunk. If this becomes inconvenient we will need to adapt.
*/
bool dvmDdmHandlePacket(const u1* buf, int dataLen, u1** pReplyBuf,
int* pReplyLen)
{
Thread* self = dvmThreadSelf();
const int kChunkHdrLen = 8;
ArrayObject* dataArray = NULL;
bool result = false;
assert(dataLen >= 0);
/*
* Prep DdmServer. We could throw this in gDvm.
*/
ClassObject* ddmServerClass;
Method* dispatch;
ddmServerClass =
dvmFindClass("Lorg/apache/harmony/dalvik/ddmc/DdmServer;", NULL);
if (ddmServerClass == NULL) {
LOGW("Unable to find org.apache.harmony.dalvik.ddmc.DdmServer\n");
goto bail;
}
dispatch = dvmFindDirectMethodByDescriptor(ddmServerClass, "dispatch",
"(I[BII)Lorg/apache/harmony/dalvik/ddmc/Chunk;");
if (dispatch == NULL) {
LOGW("Unable to find DdmServer.dispatch\n");
goto bail;
}
/*
* Prep Chunk.
*/
int chunkTypeOff, chunkDataOff, chunkOffsetOff, chunkLengthOff;
ClassObject* chunkClass;
chunkClass = dvmFindClass("Lorg/apache/harmony/dalvik/ddmc/Chunk;", NULL);
if (chunkClass == NULL) {
LOGW("Unable to find org.apache.harmony.dalvik.ddmc.Chunk\n");
goto bail;
}
chunkTypeOff = dvmFindFieldOffset(chunkClass, "type", "I");
chunkDataOff = dvmFindFieldOffset(chunkClass, "data", "[B");
chunkOffsetOff = dvmFindFieldOffset(chunkClass, "offset", "I");
chunkLengthOff = dvmFindFieldOffset(chunkClass, "length", "I");
if (chunkTypeOff < 0 || chunkDataOff < 0 ||
chunkOffsetOff < 0 || chunkLengthOff < 0)
{
LOGW("Unable to find all chunk fields\n");
goto bail;
}
/*
* The chunk handlers are written in the Java programming language, so
* we need to convert the buffer to a byte array.
*/
dataArray = dvmAllocPrimitiveArray('B', dataLen, ALLOC_DEFAULT);
if (dataArray == NULL) {
LOGW("array alloc failed (%d)\n", dataLen);
dvmClearException(self);
goto bail;
}
memcpy(dataArray->contents, buf, dataLen);
/*
* Run through and find all chunks. [Currently just find the first.]
*/
unsigned int offset, length, type;
type = get4BE((u1*)dataArray->contents + 0);
length = get4BE((u1*)dataArray->contents + 4);
offset = kChunkHdrLen;
if (offset+length > (unsigned int) dataLen) {
LOGW("WARNING: bad chunk found (len=%u pktLen=%d)\n", length, dataLen);
goto bail;
}
/*
* Call the handler.
*/
JValue callRes;
dvmCallMethod(self, dispatch, NULL, &callRes, type, dataArray, offset,
length);
if (dvmCheckException(self)) {
LOGI("Exception thrown by dispatcher for 0x%08x\n", type);
dvmLogExceptionStackTrace();
dvmClearException(self);
goto bail;
}
Object* chunk;
ArrayObject* replyData;
//.........这里部分代码省略.........
开发者ID:AndDiSa, 项目名称:GB-platform_dalvik, 代码行数:101, 代码来源:Ddm.c
示例4: LOGV
void AudioSystem::AudioFlingerClient::ioConfigChanged(int event, int ioHandle, void *param2) {
LOGV("ioConfigChanged() event %d", event);
OutputDescriptor *desc;
uint32_t stream;
if (ioHandle == 0) return;
Mutex::Autolock _l(AudioSystem::gLock);
switch (event) {
case STREAM_CONFIG_CHANGED:
if (param2 == 0) break;
stream = *(uint32_t *)param2;
LOGV("ioConfigChanged() STREAM_CONFIG_CHANGED stream %d, output %d", stream, ioHandle);
if (gStreamOutputMap.indexOfKey(stream) >= 0) {
gStreamOutputMap.replaceValueFor(stream, ioHandle);
}
break;
case OUTPUT_OPENED: {
if (gOutputs.indexOfKey(ioHandle) >= 0) {
LOGV("ioConfigChanged() opening already existing output! %d", ioHandle);
break;
}
if (param2 == 0) break;
desc = (OutputDescriptor *)param2;
OutputDescriptor *outputDesc = new OutputDescriptor(*desc);
gOutputs.add(ioHandle, outputDesc);
LOGV("ioConfigChanged() new output samplingRate %d, format %d channels %d frameCount %d latency %d",
outputDesc->samplingRate, outputDesc->format, outputDesc->channels, outputDesc->frameCount, outputDesc->latency);
} break;
case OUTPUT_CLOSED: {
if (gOutputs.indexOfKey(ioHandle) < 0) {
LOGW("ioConfigChanged() closing unknow output! %d", ioHandle);
break;
}
LOGV("ioConfigChanged() output %d closed", ioHandle);
gOutputs.removeItem(ioHandle);
for (int i = gStreamOutputMap.size() - 1; i >= 0 ; i--) {
if (gStreamOutputMap.valueAt(i) == ioHandle) {
gStreamOutputMap.removeItemsAt(i);
}
}
} break;
case OUTPUT_CONFIG_CHANGED: {
int index = gOutputs.indexOfKey(ioHandle);
if (index < 0) {
LOGW("ioConfigChanged() modifying unknow output! %d", ioHandle);
break;
}
if (param2 == 0) break;
desc = (OutputDescriptor *)param2;
LOGV("ioConfigChanged() new config for output %d samplingRate %d, format %d channels %d frameCount %d latency %d",
ioHandle, desc->samplingRate, desc->format,
desc->channels, desc->frameCount, desc->latency);
OutputDescriptor *outputDesc = gOutputs.valueAt(index);
#ifdef STE_HARDWARE
uint32_t oldLatency = outputDesc->latency;
#endif
delete outputDesc;
outputDesc = new OutputDescriptor(*desc);
gOutputs.replaceValueFor(ioHandle, outputDesc);
#ifdef STE_HARDWARE
if (oldLatency == outputDesc->latency) {
break;
}
uint32_t newLatency = outputDesc->latency;
gLock.unlock();
gLatencyLock.lock();
size_t size = gLatencyNotificationClients.size();
for (size_t i = 0; i < size; i++) {
sp<NotificationClient> client = gLatencyNotificationClients.valueAt(i);
(*client->mCb)(client->mCookie, ioHandle, newLatency);
}
gLatencyLock.unlock();
gLock.lock();
#endif
} break;
case INPUT_OPENED:
case INPUT_CLOSED:
case INPUT_CONFIG_CHANGED:
break;
}
}
开发者ID:minicm4pico, 项目名称:android_frameworks_base, 代码行数:88, 代码来源:AudioSystem.cpp
示例5: dvmDumpObject
/*
* Dump some information about an object.
*/
void dvmDumpObject(const Object* obj)
{
ClassObject* clazz;
int i;
if (obj == NULL || obj->clazz == NULL) {
LOGW("Null or malformed object not dumped");
return;
}
clazz = obj->clazz;
LOGD("----- Object dump: %p (%s, %d bytes) -----",
obj, clazz->descriptor, (int) clazz->objectSize);
//printHexDump(obj, clazz->objectSize);
LOGD(" Fields:");
while (clazz != NULL) {
LOGD(" -- %s", clazz->descriptor);
for (i = 0; i < clazz->ifieldCount; i++) {
const InstField* pField = &clazz->ifields[i];
char type = pField->field.signature[0];
if (type == 'F' || type == 'D') {
double dval;
if (type == 'F')
dval = dvmGetFieldFloat(obj, pField->byteOffset);
else
dval = dvmGetFieldDouble(obj, pField->byteOffset);
LOGD(" %2d: '%s' '%s' af=%04x off=%d %.3f", i,
pField->field.name, pField->field.signature,
pField->field.accessFlags, pField->byteOffset, dval);
} else {
u8 lval;
if (type == 'J')
lval = dvmGetFieldLong(obj, pField->byteOffset);
else if (type == 'Z')
lval = dvmGetFieldBoolean(obj, pField->byteOffset);
else
lval = dvmGetFieldInt(obj, pField->byteOffset);
LOGD(" %2d: '%s' '%s' af=%04x off=%d 0x%08llx", i,
pField->field.name, pField->field.signature,
pField->field.accessFlags, pField->byteOffset, lval);
}
}
clazz = clazz->super;
}
if (obj->clazz == gDvm.classJavaLangClass) {
LOGD(" Static fields:");
const StaticField* sfields = &((ClassObject *)obj)->sfields[0];
for (i = 0; i < ((ClassObject *)obj)->sfieldCount; ++i) {
const StaticField* pField = &sfields[i];
size_t byteOffset = (size_t)pField - (size_t)sfields;
char type = pField->field.signature[0];
if (type == 'F' || type == 'D') {
double dval;
if (type == 'F')
dval = pField->value.f;
else
dval = pField->value.d;
LOGD(" %2d: '%s' '%s' af=%04x off=%zd %.3f", i,
pField->field.name, pField->field.signature,
pField->field.accessFlags, byteOffset, dval);
} else {
u8 lval;
if (type == 'J')
lval = pField->value.j;
else if (type == 'Z')
lval = pField->value.z;
else
lval = pField->value.i;
LOGD(" %2d: '%s' '%s' af=%04x off=%zd 0x%08llx", i,
pField->field.name, pField->field.signature,
pField->field.accessFlags, byteOffset, lval);
}
}
}
}
开发者ID:AndDiSa, 项目名称:GB-platform_dalvik, 代码行数:89, 代码来源:Object.c
示例6: onSuplNiRequest
void* onSuplNiRequest(void *data)
{
int err;
int ignore;
char *line;
GpsCtrlSuplNiRequest ni_request;
GpsCtrlContext *context = get_context();
line = (char *) data;
LOGD("%s, %s", __FUNCTION__, line);
err = at_tok_start(&line);
if (err < 0) {
LOGE("%s error parsing data", __FUNCTION__);
return NULL;
}
err = at_tok_nextint(&line, &ignore);
if (err < 0) {
LOGE("%s error parsing data", __FUNCTION__);
return NULL;
}
err = at_tok_nextint(&line, &ni_request.message_id);
if (err < 0) {
LOGE("%s error parsing data message id", __FUNCTION__);
return NULL;
}
err = at_tok_nextint(&line, &ni_request.message_type);
if (err < 0) {
LOGE("%s error parsing data message type", __FUNCTION__);
return NULL;
}
err = at_tok_nextint(&line, &ni_request.requestor_id_type);
if (err < 0) {
LOGW("%s error parsing data requestor id type", __FUNCTION__);
ni_request.requestor_id_type = -1;
}
err = at_tok_nextstr(&line, &ni_request.requestor_id_text);
if (err < 0) {
LOGW("%s error parsing data requestor id text", __FUNCTION__);
ni_request.requestor_id_text = "";
}
err = at_tok_nextint(&line, &ni_request.client_name_type);
if (err < 0) {
LOGW("%s error parsing data client name type", __FUNCTION__);
ni_request.client_name_type = -1;
}
err = at_tok_nextstr(&line, &ni_request.client_name_text);
if (err < 0) {
LOGW("%s error parsing data clien name text", __FUNCTION__);
ni_request.client_name_text = "";
}
context->supl_ni_callback(&ni_request);
return NULL;
}
开发者ID:Adamj311, 项目名称:android_device_malata_smba_common, 代码行数:62, 代码来源:supl.c
示例7: openPlatformInput
//.........这里部分代码省略.........
return true;
}
// Grab the next input event.
for (;;) {
// Consume buffered input events, if any.
if (mInputBufferIndex < mInputBufferCount) {
const struct input_event& iev = mInputBufferData[mInputBufferIndex++];
const device_t* device = mDevices[mInputDeviceIndex];
LOGV("%s got: t0=%d, t1=%d, type=%d, code=%d, v=%d", device->path.string(),
(int) iev.time.tv_sec, (int) iev.time.tv_usec, iev.type, iev.code, iev.value);
if (device->id == mFirstKeyboardId) {
outEvent->deviceId = 0;
} else {
outEvent->deviceId = device->id;
}
outEvent->type = iev.type;
outEvent->scanCode = iev.code;
if (iev.type == EV_KEY) {
status_t err = device->layoutMap->map(iev.code,
& outEvent->keyCode, & outEvent->flags);
LOGV("iev.code=%d keyCode=%d flags=0x%08x err=%d\n",
iev.code, outEvent->keyCode, outEvent->flags, err);
if (err != 0) {
outEvent->keyCode = AKEYCODE_UNKNOWN;
outEvent->flags = 0;
}
} else {
outEvent->keyCode = iev.code;
}
outEvent->value = iev.value;
// Use an event timestamp in the same timebase as
// java.lang.System.nanoTime() and android.os.SystemClock.uptimeMillis()
// as expected by the rest of the system.
outEvent->when = systemTime(SYSTEM_TIME_MONOTONIC);
return true;
}
// Finish reading all events from devices identified in previous poll().
// This code assumes that mInputDeviceIndex is initially 0 and that the
// revents member of pollfd is initialized to 0 when the device is first added.
// Since mFDs[0] is used for inotify, we process regular events starting at index 1.
mInputDeviceIndex += 1;
if (mInputDeviceIndex >= mFDCount) {
break;
}
const struct pollfd& pfd = mFDs[mInputDeviceIndex];
if (pfd.revents & POLLIN) {
int32_t readSize = read(pfd.fd, mInputBufferData,
sizeof(struct input_event) * INPUT_BUFFER_SIZE);
if (readSize < 0) {
if (errno != EAGAIN && errno != EINTR) {
LOGW("could not get event (errno=%d)", errno);
}
} else if ((readSize % sizeof(struct input_event)) != 0) {
LOGE("could not get event (wrong size: %d)", readSize);
} else {
mInputBufferCount = readSize / sizeof(struct input_event);
mInputBufferIndex = 0;
}
}
}
#if HAVE_INOTIFY
// readNotify() will modify mFDs and mFDCount, so this must be done after
// processing all other events.
if(mFDs[0].revents & POLLIN) {
readNotify(mFDs[0].fd);
mFDs[0].revents = 0;
continue; // report added or removed devices immediately
}
#endif
mInputDeviceIndex = 0;
// Poll for events. Mind the wake lock dance!
// We hold a wake lock at all times except during poll(). This works due to some
// subtle choreography. When a device driver has pending (unread) events, it acquires
// a kernel wake lock. However, once the last pending event has been read, the device
// driver will release the kernel wake lock. To prevent the system from going to sleep
// when this happens, the EventHub holds onto its own user wake lock while the client
// is processing events. Thus the system can only sleep if there are no events
// pending or currently being processed.
release_wake_lock(WAKE_LOCK_ID);
int pollResult = poll(mFDs, mFDCount, -1);
acquire_wake_lock(PARTIAL_WAKE_LOCK, WAKE_LOCK_ID);
if (pollResult <= 0) {
if (errno != EINTR) {
LOGW("poll failed (errno=%d)\n", errno);
usleep(100000);
}
}
}
}
开发者ID:JimMing, 项目名称:android_framework_base, 代码行数:101, 代码来源:EventHub.cpp
示例8: ensure_path_mounted
int ensure_path_mounted(const char* path) {
Volume* v = volume_for_path(path);
if (v == NULL) {
// no /sdcard? let's assume /data/media
if (strstr(path, "/sdcard") == path && is_data_media()) {
LOGW("using /data/media, no /sdcard found.\n");
int ret;
if (0 != (ret = ensure_path_mounted("/data")))
return ret;
setup_data_media();
return 0;
}
LOGE("unknown volume for path [%s]\n", path);
return -1;
}
if (strcmp(v->fs_type, "ramdisk") == 0) {
// the ramdisk is always mounted.
return 0;
}
int result;
result = scan_mounted_volumes();
if (result < 0) {
LOGE("failed to scan mounted volumes\n");
return -1;
}
const MountedVolume* mv =
find_mounted_volume_by_mount_point(v->mount_point);
if (mv) {
// volume is already mounted
return 0;
}
mkdir(v->mount_point, 0755); // in case it doesn't already exist
if (strcmp(v->fs_type, "yaffs2") == 0) {
// mount an MTD partition as a YAFFS2 filesystem.
mtd_scan_partitions();
const MtdPartition* partition;
partition = mtd_find_partition_by_name(v->device);
if (partition == NULL) {
LOGE("failed to find \"%s\" partition to mount at \"%s\"\n",
v->device, v->mount_point);
return -1;
}
int ret = mtd_mount_partition(partition, v->mount_point, v->fs_type, 0);
if (strcmp(v->mount_point, "/system") == 0) {
// we need /system mounted rw, thank you SE...
__system("/sbin/mount -o remount,rw /system");
}
return ret;
} else if (strcmp(v->fs_type, "ext4") == 0 ||
strcmp(v->fs_type, "ext3") == 0 ||
strcmp(v->fs_type, "rfs") == 0 ||
strcmp(v->fs_type, "vfat") == 0) {
if ((result = try_mount(v->device, v->mount_point, v->fs_type, v->fs_options)) == 0)
return 0;
if ((result = try_mount(v->device2, v->mount_point, v->fs_type, v->fs_options)) == 0)
return 0;
if ((result = try_mount(v->device, v->mount_point, v->fs_type2, v->fs_options2)) == 0)
return 0;
if ((result = try_mount(v->device2, v->mount_point, v->fs_type2, v->fs_options2)) == 0)
return 0;
return result;
} else {
// let's try mounting with the mount binary and hope for the best.
char mount_cmd[PATH_MAX];
sprintf(mount_cmd, "mount %s", path);
return __system(mount_cmd);
}
LOGE("unknown fs_type \"%s\" for %s\n", v->fs_type, v->mount_point);
return -1;
}
开发者ID:aldee29, 项目名称:android_device_semc_msm7x27-common, 代码行数:75, 代码来源:roots.c
示例9: format_volume
int format_volume(const char* volume) {
Volume* v = volume_for_path(volume);
// Special case for formatting /system
if (strcmp(volume, "/system") == 0) {
// you can't format the system on xperias, thank you SE...
LOGI("Formatting /system ...\n");
ensure_path_mounted("/system");
__system("/sbin/mount -o remount,rw /system");
__system("/sbin/rm -rf /system/*");
ensure_path_unmounted("/system");
return 0;
}
if (v == NULL) {
// no /sdcard? let's assume /data/media
if (strstr(volume, "/sdcard") == volume && is_data_media()) {
return format_unknown_device(NULL, volume, NULL);
}
// silent failure for sd-ext
if (strcmp(volume, "/sd-ext") == 0)
return -1;
LOGE("unknown volume \"%s\"\n", volume);
return -1;
}
if (strcmp(v->fs_type, "ramdisk") == 0) {
// you can't format the ramdisk.
LOGE("can't format_volume \"%s\"", volume);
return -1;
}
if (strcmp(v->mount_point, volume) != 0) {
#if 0
LOGE("can't give path \"%s\" to format_volume\n", volume);
return -1;
#endif
return format_unknown_device(v->device, volume, NULL);
}
if (ensure_path_unmounted(volume) != 0) {
LOGE("format_volume failed to unmount \"%s\"\n", v->mount_point);
return -1;
}
if (strcmp(v->fs_type, "yaffs2") == 0 || strcmp(v->fs_type, "mtd") == 0) {
mtd_scan_partitions();
const MtdPartition* partition = mtd_find_partition_by_name(v->device);
if (partition == NULL) {
LOGE("format_volume: no MTD partition \"%s\"\n", v->device);
return -1;
}
MtdWriteContext *write = mtd_write_partition(partition);
if (write == NULL) {
LOGW("format_volume: can't open MTD \"%s\"\n", v->device);
return -1;
} else if (mtd_erase_blocks(write, -1) == (off_t) -1) {
LOGW("format_volume: can't erase MTD \"%s\"\n", v->device);
mtd_write_close(write);
return -1;
} else if (mtd_write_close(write)) {
LOGW("format_volume: can't close MTD \"%s\"\n", v->device);
return -1;
}
return 0;
}
if (strcmp(v->fs_type, "ext4") == 0) {
reset_ext4fs_info();
int result = make_ext4fs(v->device, NULL, NULL, 0, 0, 0);
if (result != 0) {
LOGE("format_volume: make_extf4fs failed on %s\n", v->device);
return -1;
}
return 0;
}
#if 0
LOGE("format_volume: fs_type \"%s\" unsupported\n", v->fs_type);
return -1;
#endif
return format_unknown_device(v->device, volume, v->fs_type);
}
开发者ID:aldee29, 项目名称:android_device_semc_msm7x27-common, 代码行数:80, 代码来源:roots.c
示例10: show_mount_usb_storage_menu
void show_mount_usb_storage_menu()
{
int fd;
Volume *vol = volume_for_path("/emmc");
if ((fd = open(BOARD_UMS_LUNFILE, O_WRONLY)) < 0) {
LOGE("Unable to open ums lunfile (%s)", strerror(errno));
return -1;
}
if (write(fd, vol->device, strlen(vol->device)) < 0) {
LOGE("Unable to write to ums lunfile (%s)", strerror(errno));
close(fd);
return -1;
}
int fd2;
Volume *vol2 = volume_for_path("/sdcard");
if ((fd2 = open(BOARD_UMS_LUN1FILE, O_WRONLY)) >= 0) {
if ((write(fd2, vol2->device, strlen(vol2->device)) < 0) &&
(!vol2->device2 || (write(fd2, vol2->device, strlen(vol2->device2)) < 0))) {
LOGW("Unable to write to ums lunfile 2 (%s)", strerror(errno));
close(fd2);
//return -1;
}
}
static char* headers[] = { "USB Mass Storage device",
"Leaving this menu unmount",
"your SD card from your PC.",
"",
NULL
};
static char* list[] = { "Unmount", NULL };
for (;;)
{
int chosen_item = get_menu_selection(headers, list, 0, 0);
if (chosen_item == GO_BACK || chosen_item == 0)
break;
}
char ch = 0;
if ((fd2 = open(BOARD_UMS_LUN1FILE, O_WRONLY)) >= 0) {
write(fd2, &ch, 1);
close(fd2);
}
if ((fd = open(BOARD_UMS_LUNFILE, O_WRONLY)) < 0) {
LOGE("Unable to open ums lunfile (%s)", strerror(errno));
return -1;
}
if (write(fd, &ch, 1) < 0) {
LOGE("Unable to write to ums lunfile (%s)", strerror(errno));
close(fd);
return -1;
}
}
开发者ID:vicio74, 项目名称:android_bootable_recovery-cwm5, 代码行数:62, 代码来源:extendedcommands.c
示例11: prepareVertices
void prepareVertices()
{
// Load mesh from compressed asset
AAsset* asset = AAssetManager_open(app->activity->assetManager, "models/vulkanlogo.obj", AASSET_MODE_STREAMING);
assert(asset);
size_t size = AAsset_getLength(asset);
assert(size > 0);
char *assetData = new char[size];
AAsset_read(asset, assetData, size);
AAsset_close(asset);
std::stringstream assetStream(assetData);
std::vector<tinyobj::shape_t> shapes;
std::vector<tinyobj::material_t> materials;
std::string objerr;
tinyobj::MaterialFileReader matFileReader("");
bool ret = tinyobj::LoadObj(shapes, materials, objerr, assetStream, matFileReader, true);
LOGW("shapes %d", shapes.size());
// Setup vertices
float scale = 0.025f;
std::vector<Vertex> vertexBuffer;
std::vector<uint32_t> indexBuffer;
for (auto& shape : shapes)
{
// Vertices
for (size_t i = 0; i < shape.mesh.positions.size() / 3; i++)
{
Vertex v;
v.pos[0] = shape.mesh.positions[3 * i + 0] * scale;
v.pos[1] = -shape.mesh.positions[3 * i + 1] * scale;
v.pos[2] = shape.mesh.positions[3 * i + 2] * scale;
v.normal[0] = shape.mesh.normals[3 * i + 0];
v.normal[1] = shape.mesh.normals[3 * i + 1];
v.normal[2] = shape.mesh.normals[3 * i + 2];
v.color = glm::vec3(1.0f, 0.0f, 0.0f);
vertexBuffer.push_back(v);
}
// Indices
for (size_t i = 0; i < shape.mesh.indices.size() / 3; i++)
{
indexBuffer.push_back(shape.mesh.indices[3 * i + 0]);
indexBuffer.push_back(shape.mesh.indices[3 * i + 1]);
indexBuffer.push_back(shape.mesh.indices[3 * i + 2]);
}
}
uint32_t vertexBufferSize = vertexBuffer.size() * sizeof(Vertex);
uint32_t indexBufferSize = indexBuffer.size() * sizeof(uint32_t);
VkMemoryAllocateInfo memAlloc = {};
memAlloc.sType = VK_STRUCTURE_TYPE_MEMORY_ALLOCATE_INFO;
memAlloc.pNext = NULL;
memAlloc.allocationSize = 0;
memAlloc.memoryTypeIndex = 0;
VkMemoryRequirements memReqs;
VkResult err;
void *data;
// Generate vertex buffer
// Setup
VkBufferCreateInfo bufInfo = {};
bufInfo.sType = VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO;
bufInfo.pNext = NULL;
bufInfo.size = vertexBufferSize;
bufInfo.usage = VK_BUFFER_USAGE_VERTEX_BUFFER_BIT;
bufInfo.flags = 0;
// Copy vertex data to VRAM
memset(&vertices, 0, sizeof(vertices));
err = vkCreateBuffer(device, &bufInfo, nullptr, &vertices.buf);
assert(!err);
vkGetBufferMemoryRequirements(device, vertices.buf, &memReqs);
memAlloc.allocationSize = memReqs.size;
getMemoryType(memReqs.memoryTypeBits, VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT, &memAlloc.memoryTypeIndex);
vkAllocateMemory(device, &memAlloc, nullptr, &vertices.mem);
assert(!err);
err = vkMapMemory(device, vertices.mem, 0, memAlloc.allocationSize, 0, &data);
assert(!err);
memcpy(data, vertexBuffer.data(), vertexBufferSize);
vkUnmapMemory(device, vertices.mem);
assert(!err);
err = vkBindBufferMemory(device, vertices.buf, vertices.mem, 0);
assert(!err);
// Generate index buffer
// Setup
VkBufferCreateInfo indexbufferInfo = {};
indexbufferInfo.sType = VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO;
indexbufferInfo.pNext = NULL;
indexbufferInfo.size = indexBufferSize;
indexbufferInfo.usage = VK_BUFFER_USAGE_INDEX_BUFFER_BIT;
indexbufferInfo.flags = 0;
// Copy index data to VRAM
memset(&indices, 0, sizeof(indices));
err = vkCreateBuffer(device, &bufInfo, nullptr, &indices.buf);
//.........这里部分代码省略.........
开发者ID:prenaux, 项目名称:Vulkan, 代码行数:101, 代码来源:mesh.cpp
示例12: LOGD
BOOL MyApp::InitInstance(void)
{
// Create the main window.
m_pMainWnd = new MainWindow;
m_pMainWnd->ShowWindow(m_nCmdShow);
m_pMainWnd->UpdateWindow();
LOGD("Happily in InitInstance!");
/* find our .EXE file */
//HMODULE hModule = ::GetModuleHandle(NULL);
WCHAR buf[MAX_PATH];
if (::GetModuleFileName(NULL /*hModule*/, buf, NELEM(buf)) != 0) {
LOGD("Module name is '%ls'", buf);
fExeFileName = buf;
WCHAR* cp = wcsrchr(buf, '\\');
if (cp == NULL)
fExeBaseName = L"";
else
fExeBaseName = fExeFileName.Left(cp - buf +1);
} else {
LOGW("GLITCH: GetModuleFileName failed (err=%ld)", ::GetLastError());
}
LogModuleLocation(L"riched.dll");
LogModuleLocation(L"riched20.dll");
LogModuleLocation(L"riched32.dll");
LogModuleLocation(L"msftedit.dll");
// This causes functions like SetProfileInt to use the registry rather
// than a .INI file. The registry key is "usually the name of a company".
#ifdef CAN_UPDATE_FILE_ASSOC
SetRegistryKey(fRegistry.GetAppRegistryKey());
#else
SetRegistryKey(L"faddenSoft");
#endif
//LOGI("Registry key is '%ls'", m_pszRegistryKey);
//LOGI("Profile name is '%ls'", m_pszProfileName);
LOGI("Short command line is '%ls'", m_lpCmdLine);
//LOGI("CP app name is '%ls'", m_pszAppName);
//LOGI("CP exe name is '%ls'", m_pszExeName);
LOGI("CP help file is '%ls'", m_pszHelpFilePath);
LOGI("Command line is '%ls'", ::GetCommandLine());
//if (!WriteProfileString("SectionOne", "MyEntry", "test"))
// LOGI("WriteProfileString failed");
#ifdef CAN_UPDATE_FILE_ASSOC
/*
* If we're installing or uninstalling, do what we need to and then
* bail immediately. This will hemorrhage memory, but I'm sure the
* incredibly robust Windows environment will take it in stride.
*/
if (wcscmp(m_lpCmdLine, L"-install") == 0) {
LOGI("Invoked with INSTALL flag");
fRegistry.OneTimeInstall();
::SHChangeNotify(SHCNE_ASSOCCHANGED, SHCNF_IDLIST, NULL, NULL);
exit(0);
} else if (wcscmp(m_lpCmdLine, L"-uninstall") == 0) {
LOGI("Invoked with UNINSTALL flag");
fRegistry.OneTimeUninstall();
::SHChangeNotify(SHCNE_ASSOCCHANGED, SHCNF_IDLIST, NULL, NULL);
exit(1); // tell DeployMaster to continue with uninstall
}
fRegistry.FixBasicSettings();
#endif
return TRUE;
}
开发者ID:salfter, 项目名称:ciderpress, 代码行数:72, 代码来源:MyApp.cpp
示例13: engine_init_display
/**
* Initialize an EGL context for the current display.
*/
static int engine_init_display(struct engine *engine, bool p_gl2) {
// initialize OpenGL ES and EGL
/*
* Here specify the attributes of the desired configuration.
* Below, we select an EGLConfig with at least 8 bits per color
* component compatible with on-screen windows
*/
const EGLint gl2_attribs[] = {
// EGL_SURFACE_TYPE, EGL_WINDOW_BIT,
EGL_BLUE_SIZE, 4,
EGL_GREEN_SIZE, 4,
EGL_RED_SIZE, 4,
EGL_ALPHA_SIZE, 0,
EGL_DEPTH_SIZE, 16,
EGL_STENCIL_SIZE, EGL_DONT_CARE,
EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT,
EGL_NONE
};
const EGLint gl1_attribs[] = {
// EGL_SURFACE_TYPE, EGL_WINDOW_BIT,
EGL_BLUE_SIZE, 4,
EGL_GREEN_SIZE, 4,
EGL_RED_SIZE, 4,
EGL_ALPHA_SIZE, 0,
EGL_DEPTH_SIZE, 16,
EGL_STENCIL_SIZE, EGL_DONT_CARE,
EGL_NONE
};
const EGLint *attribs = p_gl2 ? gl2_attribs : gl1_attribs;
EGLint w, h, dummy, format;
EGLint numConfigs;
EGLConfig config;
EGLSurface surface;
EGLContext context;
EGLDisplay display = eglGetDisplay(EGL_DEFAULT_DISPLAY);
eglInitialize(display, 0, 0);
/* Here, the application chooses the configuration it desires. In this
* sample, we have a very simplified selection process, where we pick
* the first EGLConfig that matches our criteria */
eglChooseConfig(display, attribs, &config, 1, &numConfigs);
LOGI("Num configs: %i\n", numConfigs);
/* EGL_NATIVE_VISUAL_ID is an attribute of the EGLConfig that is
* guaranteed to be accepted by ANativeWindow_setBuffersGeometry().
* As soon as we picked a EGLConfig, we can safely reconfigure the
* ANativeWindow buffers to match, using EGL_NATIVE_VISUAL_ID. */
eglGetConfigAttrib(display, config, EGL_NATIVE_VISUAL_ID, &format);
ANativeWindow_setBuffersGeometry(engine->app->window, 0, 0, format);
//ANativeWindow_setFlags(engine->app->window, 0, 0, format|);
surface = eglCreateWindowSurface(display, config, engine->app->window, NULL);
const EGLint context_attribs[] = {
EGL_CONTEXT_CLIENT_VERSION, 2,
EGL_NONE
};
context = eglCreateContext(display, config, EGL_NO_CONTEXT, p_gl2 ? context_attribs : NULL);
if (eglMakeCurrent(display, surface, surface, context) == EGL_FALSE) {
LOGW("Unable to eglMakeCurrent");
return -1;
}
eglQuerySurface(display, surface, EGL_WIDTH, &w);
eglQuerySurface(display, surface, EGL_HEIGHT, &h);
print_line("INIT VIDEO MODE: " + itos(w) + "," + itos(h));
//engine->os->set_egl_extensions(eglQueryString(display,EGL_EXTENSIONS));
engine->os->init_video_mode(w, h);
engine->display = display;
engine->context = context;
engine->surface = surface;
engine->width = w;
engine->height = h;
engine->display_active = true;
//engine->state.angle = 0;
// Initialize GL state.
//glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_FASTEST);
glEnable(GL_CULL_FACE);
// glShadeModel(GL_SMOOTH);
glDisable(GL_DEPTH_TEST);
LOGI("GL Version: %s - %s %s\n", glGetString(GL_VERSION), glGetString(GL_VENDOR), glGetString(GL_RENDERER));
return 0;
//.........这里部分代码省略.........
开发者ID:KelinciFX, 项目名称:godot, 代码行数:101, 代码来源:godot_android.cpp
示例14: format_volume
int format_volume(const char* volume) {
if (is_data_media_volume_path(volume)) {
return format_unknown_device(NULL, volume, NULL);
}
// check to see if /data is being formatted, and if it is /data/media
// Note: the /sdcard check is redundant probably, just being safe.
if (strstr(volume, "/data") == volume && is_data_media() && !ignore_data_media) {
return format_unknown_device(NULL, volume, NULL);
}
Volume* v = volume_for_path(volume);
if (v == NULL) {
// silent failure for sd-ext
if (strcmp(volume, "/sd-ext") != 0)
LOGE("unknown volume '%s'\n", volume);
return -1;
}
// silent failure to format non existing sd-ext when defined in recovery.fstab
if (strcmp(volume, "/sd-ext") == 0) {
struct stat s;
if (0 != stat(v->blk_device, &s)) {
LOGI("Skipping format of sd-ext\n");
return -1;
}
}
// Only use vold format for exact matches otherwise /sdcard will be
// formatted instead of /storage/sdcard0/.android_secure
if (fs_mgr_is_voldmanaged(v) && strcmp(volume, v->mount_point) == 0) {
if (ensure_path_unmounted(volume) != 0) {
LOGE("format_volume failed to unmount %s", v->mount_point);
}
return vold_format_volume(v->mount_point, 1) == CommandOkay ? 0 : -1;
}
if (strcmp(v->fs_type, "ramdisk") == 0) {
// you can't format the ramdisk.
LOGE("can't format_volume \"%s\"", volume);
return -1;
}
if (strcmp(v->mount_point, volume) != 0) {
#if 0
LOGE("can't give path \"%s\" to format_volume\n", volume);
return -1;
#endif
return format_unknown_device(v->blk_device, volume, NULL);
}
if (ensure_path_unmounted(volume) != 0) {
LOGE("format_volume failed to unmount \"%s\"\n", v->mount_point);
return -1;
}
if (strcmp(v->fs_type, "yaffs2") == 0 || strcmp(v->fs_type, "mtd") == 0) {
mtd_scan_partitions();
const MtdPartition* partition = mtd_find_partition_by_name(v->blk_device);
if (partition == NULL) {
LOGE("format_volume: no MTD partition \"%s\"\n", v->blk_device);
return -1;
}
MtdWriteContext *write = mtd_write_partition(partition);
if (write == NULL) {
LOGW("format_volume: can't open MTD \"%s\"\n", v->blk_device);
return -1;
} else if (mtd_erase_blocks(write, -1) == (off_t) -1) {
LOGW("format_volume: can't erase MTD \"%s\"\n", v->blk_device);
mtd_write_close(write);
return -1;
} else if (mtd_write_close(write)) {
LOGW("format_volume: can't close MTD \"%s\"\n", v->blk_device);
return -1;
}
return 0;
}
if (strcmp(v->fs_type, "ext4") == 0) {
int result = make_ext4fs(v->blk_device, v->length, volume, sehandle);
if (result != 0) {
LOGE("format_volume: make_extf4fs failed on %s\n", v->blk_device);
return -1;
}
return 0;
}
#ifdef USE_F2FS
if (strcmp(v->fs_type, "f2fs") == 0) {
int result = make_f2fs_main(v->blk_device, v->mount_point);
if (result != 0) {
LOGE("format_volume: mkfs.f2f2 failed on %s\n", v->blk_device);
return -1;
}
return 0;
}
#endif
#if 0
LOGE("format_volume: fs_type \"%s\" unsupported\n", v->fs_type);
return -1;
#endif
//.........这里部分代码省略.........
开发者ID:cherojeong, 项目名称:utopic, 代码行数:101, 代码来源:roots.c
六六分期app的软件客服如何联系?不知道吗?加qq群【895510560】即可!标题:六六分期
阅读:18231| 2023-10-27
今天小编告诉大家如何处理win10系统火狐flash插件总是崩溃的问题,可能很多用户都不知
阅读:9664| 2022-11-06
今天小编告诉大家如何对win10系统删除桌面回收站图标进行设置,可能很多用户都不知道
阅读:8174| 2022-11-06
今天小编告诉大家如何对win10系统电脑设置节能降温的设置方法,想必大家都遇到过需要
阅读:8546| 2022-11-06
我们在使用xp系统的过程中,经常需要对xp系统无线网络安装向导设置进行设置,可能很多
阅读:8452| 2022-11-06
今天小编告诉大家如何处理win7系统玩cf老是与主机连接不稳定的问题,可能很多用户都不
阅读:9381| 2022-11-06
电脑对日常生活的重要性小编就不多说了,可是一旦碰到win7系统设置cf烟雾头的问题,很
阅读:8423| 2022-11-06
我们在日常使用电脑的时候,有的小伙伴们可能在打开应用的时候会遇见提示应用程序无法
阅读:7856| 2022-11-06
今天小编告诉大家如何对win7系统打开vcf文件进行设置,可能很多用户都不知道怎么对win
阅读:8408| 2022-11-06
今天小编告诉大家如何对win10系统s4开启USB调试模式进行设置,可能很多用户都不知道怎
阅读:7393| 2022-11-06
请发表评论