no message
parent
8ac3df8244
commit
9fd67c1fc3
|
@ -28,7 +28,7 @@ int PrintDumpObjvoid (void *dst,int rowNum,int num,bool ifAsii){
|
|||
}
|
||||
snprintf(out,5,"LN: ");
|
||||
for (int z = 1;z < rowNum + 1; z++) {
|
||||
char tmp[4] = {0};
|
||||
char tmp[6] = {0};
|
||||
sprintf(tmp,"%02d ",z);
|
||||
strcat(out,tmp);
|
||||
}
|
||||
|
@ -36,7 +36,7 @@ int PrintDumpObjvoid (void *dst,int rowNum,int num,bool ifAsii){
|
|||
|
||||
if (ifAsii) {
|
||||
for (int z = 1;z < rowNum + 1; z++) {
|
||||
char tmp[4] = {0};
|
||||
char tmp[6] = {0};
|
||||
sprintf(tmp,"%02d ",z);
|
||||
strcat(out,tmp);
|
||||
}
|
||||
|
@ -44,13 +44,13 @@ int PrintDumpObjvoid (void *dst,int rowNum,int num,bool ifAsii){
|
|||
strcat(out,"\r\n");
|
||||
for(int i = 0;i < row;i ++) {
|
||||
string rowstr;
|
||||
char tmp[3] = {0};
|
||||
char tmp[6] = {0};
|
||||
sprintf(tmp,"%02x",i + 1);
|
||||
rowstr += string(tmp) + ": ";
|
||||
//last row
|
||||
if (i == row -1 && left != 0){
|
||||
for (int z = 0;z < rowNum; z++) {
|
||||
char tmp[3] = {0};
|
||||
char tmp[6] = {0};
|
||||
if (z < left){
|
||||
sprintf(tmp,"%02x",((unsigned char)(((unsigned char *)dst)[ z + i * rowNum])));
|
||||
}else{
|
||||
|
@ -65,7 +65,7 @@ int PrintDumpObjvoid (void *dst,int rowNum,int num,bool ifAsii){
|
|||
rowstr += " ";
|
||||
if(ifAsii) {
|
||||
for (int z = 0;z < left; z++) {
|
||||
char tmp[3] = {0};
|
||||
char tmp[6] = {0};
|
||||
sprintf(tmp,"%c",((unsigned char)(((unsigned char *)dst)[ z + i * rowNum])));
|
||||
rowstr += string(tmp) + " ";
|
||||
if (z == left - 1){
|
||||
|
@ -75,7 +75,7 @@ int PrintDumpObjvoid (void *dst,int rowNum,int num,bool ifAsii){
|
|||
}
|
||||
}else{
|
||||
for (int z = 0;z < rowNum; z++) {
|
||||
char tmp[3] = {0};
|
||||
char tmp[6] = {0};
|
||||
sprintf(tmp,"%02x",((unsigned char)(((unsigned char *)dst)[ z + i * rowNum])));
|
||||
rowstr += string(tmp) + " ";
|
||||
if (!ifAsii){
|
||||
|
@ -84,10 +84,10 @@ int PrintDumpObjvoid (void *dst,int rowNum,int num,bool ifAsii){
|
|||
}
|
||||
}
|
||||
}
|
||||
rowstr += " ";
|
||||
if(ifAsii){
|
||||
rowstr += " ";
|
||||
for (int z = 0;z < rowNum; z++) {
|
||||
char tmp[1] = {0};
|
||||
char tmp[6] = {0};
|
||||
sprintf(tmp,"%c",((unsigned char)(((unsigned char *)dst)[ z + i * rowNum])));
|
||||
rowstr += string(tmp) + " ";
|
||||
if (z == rowNum - 1){
|
||||
|
@ -129,13 +129,13 @@ int dumpObj(void *dst,int rowNum,int num,bool ifAsii,char *out) {
|
|||
strcat(out,"\r\n");
|
||||
for(int i = 0;i < row;i ++) {
|
||||
string rowstr;
|
||||
char tmp[3] = {0};
|
||||
char tmp[4] = {0};
|
||||
sprintf(tmp,"%02x",i + 1);
|
||||
rowstr += string(tmp) + ": ";
|
||||
//last row
|
||||
if (i == row -1 && left != 0){
|
||||
for (int z = 0;z < rowNum; z++) {
|
||||
char tmp[3] = {0};
|
||||
char tmp[4] = {0};
|
||||
if (z < left){
|
||||
sprintf(tmp,"%02x",((unsigned char)(((unsigned char *)dst)[ z + i * rowNum])));
|
||||
}else{
|
||||
|
@ -150,7 +150,7 @@ int dumpObj(void *dst,int rowNum,int num,bool ifAsii,char *out) {
|
|||
rowstr += " ";
|
||||
if(ifAsii) {
|
||||
for (int z = 0;z < left; z++) {
|
||||
char tmp[3] = {0};
|
||||
char tmp[4] = {0};
|
||||
sprintf(tmp,"%c",((unsigned char)(((unsigned char *)dst)[ z + i * rowNum])));
|
||||
rowstr += string(tmp) + " ";
|
||||
if (z == left - 1){
|
||||
|
@ -172,7 +172,7 @@ int dumpObj(void *dst,int rowNum,int num,bool ifAsii,char *out) {
|
|||
rowstr += " ";
|
||||
if(ifAsii){
|
||||
for (int z = 0;z < rowNum; z++) {
|
||||
char tmp[1] = {0};
|
||||
char tmp[4] = {0};
|
||||
sprintf(tmp,"%c",((unsigned char)(((unsigned char *)dst)[ z + i * rowNum])));
|
||||
rowstr += string(tmp) + " ";
|
||||
if (z == rowNum - 1){
|
||||
|
|
|
@ -17,7 +17,6 @@ namespace general{
|
|||
CThreadPool::CThreadPool(int num) {
|
||||
this->mThreadCnt = num;
|
||||
mStarted = false;
|
||||
|
||||
}
|
||||
|
||||
int CThreadPool::AddTask(Task *t) {
|
||||
|
@ -126,4 +125,3 @@ namespace general{
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -1,10 +1,40 @@
|
|||
#include "loger.h"
|
||||
#include "debug.h"
|
||||
|
||||
#pragma pack(4)
|
||||
typedef struct test1{
|
||||
uint32_t a ;
|
||||
uint32_t b;
|
||||
char c;
|
||||
}Test1;
|
||||
#pragma pack()
|
||||
|
||||
#pragma pack(1)
|
||||
typedef struct testsize2{
|
||||
uint16_t a;
|
||||
uint8_t b;
|
||||
uint32_t c;
|
||||
}Test2;
|
||||
#pragma pack()
|
||||
|
||||
int main(){
|
||||
std::cout<<sizeof(Test1) << " "<< sizeof(Test2)<<std::endl;
|
||||
Test1 x = Test1{
|
||||
1,2,3
|
||||
};
|
||||
Test2 y = Test2{
|
||||
1,2,3
|
||||
};
|
||||
char result[1000] = {0};
|
||||
PrintDumpObjvoid(&x,6,sizeof(Test1),false);
|
||||
dumpObj(&y,6,sizeof(Test2),true,result);
|
||||
std::cout<<result<<std::endl;
|
||||
|
||||
Loger loger1("d://","test",true);
|
||||
loger1.Debug("hello",DEBUG_FILE_POSITION);
|
||||
loger1.SetMinimalLevel(LEVEL_DEBUG);
|
||||
loger1.Debug("hello",FILE_POSITION);
|
||||
loger1<< "12131";
|
||||
loger1 + "12121";
|
||||
loger1.Debug("hello11212",DEBUG_FILE_POSITION);
|
||||
|
||||
loger1.Debug("hello11212",FILE_POSITION);
|
||||
}
|
||||
|
||||
|
|
|
@ -267,13 +267,14 @@ class ASyncProcess {
|
|||
std::cout<<"ASyncProcess construct"<<std::endl;
|
||||
mThread = new std::thread([this,t,&ret](){
|
||||
ret = t();
|
||||
mMutex.lock();
|
||||
this->m_finish = true;
|
||||
mMutex.unlock();
|
||||
});
|
||||
}
|
||||
bool Finish(){
|
||||
return m_finish;
|
||||
}
|
||||
|
||||
virtual ~ASyncProcess() {
|
||||
mThread->detach();
|
||||
}
|
||||
|
@ -281,7 +282,6 @@ class ASyncProcess {
|
|||
bool m_finish = false;
|
||||
std::thread *mThread;
|
||||
std::mutex mMutex;
|
||||
|
||||
};
|
||||
|
||||
template<typename R, typename... Args>
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
#include "threadpool.h"
|
||||
// 参考于https://www.cnblogs.com/bigosprite/p/11071462.html
|
||||
|
||||
unsigned int CoreCount()
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue