第一条输出到console的日志添加前缀#;bool变量分配4字节空间
This commit is contained in:
parent
c00a568005
commit
57d8b5b51f
|
@ -619,7 +619,7 @@ extern "C"
|
|||
}
|
||||
if(ind == sizeof(paths) / sizeof(paths[0]))
|
||||
{
|
||||
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "Try PE, scanner and temporary path failed(%d), log to console\n", errno);
|
||||
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "# Try PE, scanner and temporary path failed(%d), log to console\n", errno);
|
||||
type = LOG_TYPE_CONSOLE;
|
||||
}
|
||||
|
||||
|
@ -630,7 +630,7 @@ extern "C"
|
|||
else
|
||||
path += PATH_SEPARATOR + name + ".log";
|
||||
file = &path[0];
|
||||
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "Log to file: '%s'\n", path.c_str());
|
||||
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "# Log to file: '%s'\n", path.c_str());
|
||||
}
|
||||
}
|
||||
log_cls::instance()->set_log_level(level);
|
||||
|
|
|
@ -99,7 +99,12 @@ namespace local_utility
|
|||
// info = "";
|
||||
//hg_sane_middleware::log(strlen(info) + 80, "allocate memory with %u bytes from %s\n", bytes, info);
|
||||
|
||||
return malloc(bytes);
|
||||
void* buf = malloc(bytes);
|
||||
|
||||
if (buf)
|
||||
memset(buf, 0, bytes);
|
||||
|
||||
return buf;
|
||||
}
|
||||
void free_memory(void* m)
|
||||
{
|
||||
|
@ -1122,7 +1127,7 @@ void* hg_sane_middleware::get_default_value(scanner_handle handle, int option)
|
|||
bool v = false;
|
||||
jsn->get_value("default", v);
|
||||
|
||||
data = local_utility::acquire_memory(sizeof(v), "");
|
||||
data = local_utility::acquire_memory(/*sizeof(v)*/4, "");
|
||||
memcpy(data, &v, sizeof(v));
|
||||
VLOG_MINI_2(LOG_LEVEL_DEBUG_INFO, "option %d default value is: %s\n", option, v ? "true" : "false");
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue