求助,这段java转换成c语言

//luying add vip process list
String []vipProcesses = {"com.xxx","com.yyy "};

String []importantProperties = {
"ro.epay.mode",
"ro.epay.mockup.mode",
"ro.epay.product.debug",
"ro.epay.product.mode",
"ro.epay.authmode",

    "persist.sys.usb.config",
    "sys.usb.config"

};

//luying start inquire process name by pid
String pname = getProcessName(cr.pid+"");

//先判断访问的属性是否敏感属性
for(int i = 0;i<importantProperties.length;i++){
if("".equals(importantProperties[i])){
//敏感属性,需要进程白名单校验
boolean isVip = false;
for(int j=0;j<vipProcesses.length;j++){

        if(pname.equals(vipProcesses[j])){
            //这个进程可以访问该属性
            isVip = true;
            break;
        }

    }
    if(!isVip){
        return;
    }
    break;
}

}

2个回答

//luying add vip process list
//String []vipProcesses = {"com.xxx", "com.yyy "};
#define VIP_PROCESSES_LEN 2
char* vipProcesses[VIP_PROCESSES_LEN] = {"com.xxx", "com.yyy "};

/*String []importantProperties =
{
"ro.epay.mode",
"ro.epay.mockup.mode",
"ro.epay.product.debug",
"ro.epay.product.mode",
"ro.epay.authmode",

"persist.sys.usb.config",
"sys.usb.config"

};*/

#define IMPORTANT_PROPERTIES_LEN 7
char* importantProperties[IMPORTANT_PROPERTIES_LEN] =
{
"ro.epay.mode",
"ro.epay.mockup.mode",
"ro.epay.product.debug",
"ro.epay.product.mode",
"ro.epay.authmode",
"persist.sys.usb.config",
"sys.usb.config"
};

//luying start inquire process name by pid
//String pname = getProcessName(cr.pid + "");
char pid_str[100] = {0};
sprintf(pid_str,"%d", cr.pid);
char* pname = getProcessName(pid_str);

//先判断访问的属性是否敏感属性
//for(int i = 0; i < importantProperties.length; i++)
for(int i = 0; i < IMPORTANT_PROPERTIES_LEN; i++)
{
//if("".equals(importantProperties[i]))
if(strlen(importantProperties[i]) <= 0)
{
//敏感属性,需要进程白名单校验
//boolean isVip = false;
char isVip = false;
//for(int j = 0; j < vipProcesses.length; j++)
for(int j = 0; j < VIP_PROCESSES_LEN; j++)
{
//if(pname.equals(vipProcesses[j]))
if(strcmp(pname, vipProcesses[j]) == 0)
{
//这个进程可以访问该属性
isVip = true;
break;
}
}
if(!isVip)
{
return;
}
break;
}

}

你复制下来格式化以下就可以了,java代码帮你注释掉了

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!