parse SOCVendor/GPUVendor needs len param.

This commit is contained in:
HuYingzhuo(hugo/hyzboy) 2023-11-30 18:27:11 +08:00
parent 5e8b83cce4
commit c9a1298e02
4 changed files with 7 additions and 8 deletions

View File

@ -41,7 +41,7 @@ namespace hgl
"JLQ", "JLQ",
}; };
const SOCVendor ParseSOCVendor(const char *str); const SOCVendor ParseSOCVendor(const char *str,const int len=0);
enum class CpuArch enum class CpuArch
{ {
@ -173,7 +173,7 @@ namespace hgl
"Maleoon", "Maleoon",
}; };
const SOCGPUVendor ParseSOCGPUVendor(const char *str); const SOCGPUVendor ParseSOCGPUVendor(const char *str,const int len=0);
struct SOCGPUInfo struct SOCGPUInfo
{ {

View File

@ -127,7 +127,6 @@ IF(CM_PLATFORM_SOC)
SET(SOC_SOURCE ${CMPLATFORM_ROOT_INCLUDE_PATH}/hgl/platform/SOC.h SET(SOC_SOURCE ${CMPLATFORM_ROOT_INCLUDE_PATH}/hgl/platform/SOC.h
SOC/SOC.cpp SOC/SOC.cpp
SOC/ARMCpuInfo.cpp SOC/ARMCpuInfo.cpp
SOC/Kryo.cpp
) )
SOURCE_GROUP("SOC" FILES ${SOC_SOURCE}) SOURCE_GROUP("SOC" FILES ${SOC_SOURCE})

View File

@ -150,11 +150,11 @@ namespace
namespace hgl namespace hgl
{ {
const SOCVendor ParseSOCVendor(const char *str) const SOCVendor ParseSOCVendor(const char *str,const int len)
{ {
if(!str||!*str)return(SOCVendor::Unknow); if(!str||!*str)return(SOCVendor::Unknow);
int index=hgl::find_str_in_array<char>(int(SOCVendor::RANGE_SIZE),(const char **)SOCVendorName,str); int index=hgl::find_str_in_array<char>(int(SOCVendor::RANGE_SIZE),(const char **)SOCVendorName,str,len);
if(index<0||index>=int(SOCVendor::RANGE_SIZE)) if(index<0||index>=int(SOCVendor::RANGE_SIZE))
return(SOCVendor::Unknow); return(SOCVendor::Unknow);
@ -162,11 +162,11 @@ namespace hgl
return SOCVendor(index); return SOCVendor(index);
} }
const SOCGPUVendor ParseSOCGPUVendor(const char *str) const SOCGPUVendor ParseSOCGPUVendor(const char *str,const int len)
{ {
if(!str||!*str)return(SOCGPUVendor::Unknow); if(!str||!*str)return(SOCGPUVendor::Unknow);
int index=hgl::find_str_in_array<char>(int(SOCGPUVendor::RANGE_SIZE),(const char **)SOCGPUVendorName,str); int index=hgl::find_str_in_array<char>(int(SOCGPUVendor::RANGE_SIZE),(const char **)SOCGPUVendorName,str,len);
if(index<0||index>=int(SOCGPUVendor::RANGE_SIZE)) if(index<0||index>=int(SOCGPUVendor::RANGE_SIZE))
return(SOCGPUVendor::Unknow); return(SOCGPUVendor::Unknow);

View File

@ -1,4 +1,4 @@
#include<Windows.h> #include<hgl/platform/Platform.h>
#include<hgl/text/FontInfo.h> #include<hgl/text/FontInfo.h>
#include<hgl/type/StrChar.h> #include<hgl/type/StrChar.h>