本文整理汇总了C++中ACPI_STRLEN函数的典型用法代码示例。如果您正苦于以下问题:C++ ACPI_STRLEN函数的具体用法?C++ ACPI_STRLEN怎么用?C++ ACPI_STRLEN使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ACPI_STRLEN函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: AcpiDbAddToHistory
void
AcpiDbAddToHistory (
char *CommandLine)
{
UINT16 CmdLen;
UINT16 BufferLen;
/* Put command into the next available slot */
CmdLen = (UINT16) ACPI_STRLEN (CommandLine);
if (AcpiGbl_HistoryBuffer[AcpiGbl_NextHistoryIndex].Command != NULL)
{
BufferLen = (UINT16) ACPI_STRLEN (
AcpiGbl_HistoryBuffer[AcpiGbl_NextHistoryIndex].Command);
if (CmdLen > BufferLen)
{
AcpiOsFree (AcpiGbl_HistoryBuffer[AcpiGbl_NextHistoryIndex].
Command);
AcpiGbl_HistoryBuffer[AcpiGbl_NextHistoryIndex].Command =
AcpiOsAllocate (CmdLen + 1);
}
}
else
{
AcpiGbl_HistoryBuffer[AcpiGbl_NextHistoryIndex].Command =
AcpiOsAllocate (CmdLen + 1);
}
ACPI_STRCPY (AcpiGbl_HistoryBuffer[AcpiGbl_NextHistoryIndex].Command,
CommandLine);
AcpiGbl_HistoryBuffer[AcpiGbl_NextHistoryIndex].CmdNum =
AcpiGbl_NextCmdNum;
/* Adjust indexes */
if ((AcpiGbl_NumHistory == HISTORY_SIZE) &&
(AcpiGbl_NextHistoryIndex == AcpiGbl_LoHistory))
{
AcpiGbl_LoHistory++;
if (AcpiGbl_LoHistory >= HISTORY_SIZE)
{
AcpiGbl_LoHistory = 0;
}
}
AcpiGbl_NextHistoryIndex++;
if (AcpiGbl_NextHistoryIndex >= HISTORY_SIZE)
{
AcpiGbl_NextHistoryIndex = 0;
}
AcpiGbl_NextCmdNum++;
if (AcpiGbl_NumHistory < HISTORY_SIZE)
{
AcpiGbl_NumHistory++;
}
}
示例2: acpi_tb_find_table
acpi_status
acpi_tb_find_table(char *signature,
char *oem_id,
char *oem_table_id, struct acpi_table_header ** table_ptr)
{
acpi_status status;
struct acpi_table_header *table;
ACPI_FUNCTION_TRACE("tb_find_table");
/* Validate string lengths */
if ((ACPI_STRLEN(signature) > ACPI_NAME_SIZE) ||
(ACPI_STRLEN(oem_id) > sizeof(table->oem_id)) ||
(ACPI_STRLEN(oem_table_id) > sizeof(table->oem_table_id))) {
return_ACPI_STATUS(AE_AML_STRING_LIMIT);
}
if (!ACPI_STRNCMP(signature, DSDT_SIG, ACPI_NAME_SIZE)) {
/*
* The DSDT pointer is contained in the FADT, not the RSDT.
* This code should suffice, because the only code that would perform
* a "find" on the DSDT is the data_table_region() AML opcode -- in
* which case, the DSDT is guaranteed to be already loaded.
* If this becomes insufficient, the FADT will have to be found first.
*/
if (!acpi_gbl_DSDT) {
return_ACPI_STATUS(AE_NO_ACPI_TABLES);
}
table = acpi_gbl_DSDT;
} else {
/* Find the table */
status = acpi_get_firmware_table(signature, 1,
ACPI_LOGICAL_ADDRESSING,
&table);
if (ACPI_FAILURE(status)) {
return_ACPI_STATUS(status);
}
}
/* Check oem_id and oem_table_id */
if ((oem_id[0] && ACPI_STRNCMP(oem_id, table->oem_id,
sizeof(table->oem_id))) ||
(oem_table_id[0] && ACPI_STRNCMP(oem_table_id, table->oem_table_id,
sizeof(table->oem_table_id)))) {
return_ACPI_STATUS(AE_AML_NAME_NOT_FOUND);
}
ACPI_DEBUG_PRINT((ACPI_DB_TABLES, "Found table [%4.4s]\n",
table->signature));
*table_ptr = table;
return_ACPI_STATUS(AE_OK);
}
示例3: acpi_ut_safe_strcat
u8 acpi_ut_safe_strcat(char *dest, acpi_size dest_size, char *source)
{
if ((ACPI_STRLEN(dest) + ACPI_STRLEN(source)) >= dest_size) {
return (TRUE);
}
ACPI_STRCAT(dest, source);
return (FALSE);
}
示例4: AcpiUtSafeStrcat
BOOLEAN
AcpiUtSafeStrcat (
char *Dest,
ACPI_SIZE DestSize,
char *Source)
{
if ((ACPI_STRLEN (Dest) + ACPI_STRLEN (Source)) >= DestSize)
{
return (TRUE);
}
ACPI_STRCAT (Dest, Source);
return (FALSE);
}
示例5: AcpiDbFindNameInNamespace
ACPI_STATUS
AcpiDbFindNameInNamespace (
char *NameArg)
{
char AcpiName[5] = "____";
char *AcpiNamePtr = AcpiName;
if (ACPI_STRLEN (NameArg) > 4)
{
AcpiOsPrintf ("Name must be no longer than 4 characters\n");
return (AE_OK);
}
/* Pad out name with underscores as necessary to create a 4-char name */
AcpiUtStrupr (NameArg);
while (*NameArg)
{
*AcpiNamePtr = *NameArg;
AcpiNamePtr++;
NameArg++;
}
/* Walk the namespace from the root */
(void) AcpiWalkNamespace (ACPI_TYPE_ANY, ACPI_ROOT_OBJECT, ACPI_UINT32_MAX,
AcpiDbWalkAndMatchName, NULL, AcpiName, NULL);
AcpiDbSetOutputDestination (ACPI_DB_CONSOLE_OUTPUT);
return (AE_OK);
}
示例6: AcpiUtInstallInterface
ACPI_STATUS
AcpiUtInstallInterface (
ACPI_STRING InterfaceName)
{
ACPI_INTERFACE_INFO *InterfaceInfo;
/* Allocate info block and space for the name string */
InterfaceInfo = ACPI_ALLOCATE_ZEROED (sizeof (ACPI_INTERFACE_INFO));
if (!InterfaceInfo)
{
return (AE_NO_MEMORY);
}
InterfaceInfo->Name = ACPI_ALLOCATE_ZEROED (ACPI_STRLEN (InterfaceName) + 1);
if (!InterfaceInfo->Name)
{
ACPI_FREE (InterfaceInfo);
return (AE_NO_MEMORY);
}
/* Initialize new info and insert at the head of the global list */
ACPI_STRCPY (InterfaceInfo->Name, InterfaceName);
InterfaceInfo->Flags = ACPI_OSI_DYNAMIC;
InterfaceInfo->Next = AcpiGbl_SupportedInterfaces;
AcpiGbl_SupportedInterfaces = InterfaceInfo;
return (AE_OK);
}
示例7: AcpiDbConvertToObject
static ACPI_STATUS
AcpiDbConvertToObject (
ACPI_OBJECT_TYPE Type,
char *String,
ACPI_OBJECT *Object)
{
ACPI_STATUS Status = AE_OK;
switch (Type)
{
case ACPI_TYPE_STRING:
Object->Type = ACPI_TYPE_STRING;
Object->String.Pointer = String;
Object->String.Length = (UINT32) ACPI_STRLEN (String);
break;
case ACPI_TYPE_BUFFER:
Status = AcpiDbConvertToBuffer (String, Object);
break;
case ACPI_TYPE_PACKAGE:
Status = AcpiDbConvertToPackage (String, Object);
break;
default:
Object->Type = ACPI_TYPE_INTEGER;
Status = AcpiUtStrtoul64 (String, 16, &Object->Integer.Value);
break;
}
return (Status);
}
示例8: acpi_ut_install_interface
acpi_status acpi_ut_install_interface(acpi_string interface_name)
{
struct acpi_interface_info *interface_info;
/* Allocate info block and space for the name string */
interface_info =
ACPI_ALLOCATE_ZEROED(sizeof(struct acpi_interface_info));
if (!interface_info) {
return (AE_NO_MEMORY);
}
interface_info->name =
ACPI_ALLOCATE_ZEROED(ACPI_STRLEN(interface_name) + 1);
if (!interface_info->name) {
ACPI_FREE(interface_info);
return (AE_NO_MEMORY);
}
/* Initialize new info and insert at the head of the global list */
ACPI_STRCPY(interface_info->name, interface_name);
interface_info->flags = ACPI_OSI_DYNAMIC;
interface_info->next = acpi_gbl_supported_interfaces;
acpi_gbl_supported_interfaces = interface_info;
return (AE_OK);
}
示例9: acpi_ut_install_interface
acpi_status acpi_ut_install_interface(acpi_string interface_name)
{
struct acpi_interface_info *interface_info;
interface_info =
ACPI_ALLOCATE_ZEROED(sizeof(struct acpi_interface_info));
if (!interface_info) {
return (AE_NO_MEMORY);
}
interface_info->name =
ACPI_ALLOCATE_ZEROED(ACPI_STRLEN(interface_name) + 1);
if (!interface_info->name) {
ACPI_FREE(interface_info);
return (AE_NO_MEMORY);
}
ACPI_STRCPY(interface_info->name, interface_name);
interface_info->flags = ACPI_OSI_DYNAMIC;
interface_info->next = acpi_gbl_supported_interfaces;
acpi_gbl_supported_interfaces = interface_info;
return (AE_OK);
}
示例10: acpi_ut_safe_strncat
u8
acpi_ut_safe_strncat(char *dest,
acpi_size dest_size,
char *source, acpi_size max_transfer_length)
{
acpi_size actual_transfer_length;
actual_transfer_length =
ACPI_MIN(max_transfer_length, ACPI_STRLEN(source));
if ((ACPI_STRLEN(dest) + actual_transfer_length) >= dest_size) {
return (TRUE);
}
ACPI_STRNCAT(dest, source, max_transfer_length);
return (FALSE);
}
示例11: acpi_ut_safe_strcpy
u8 acpi_ut_safe_strcpy(char *dest, acpi_size dest_size, char *source)
{
if (ACPI_STRLEN(source) >= dest_size) {
return (TRUE);
}
ACPI_STRCPY(dest, source);
return (FALSE);
}
示例12: AcpiTbFindTable
ACPI_STATUS
AcpiTbFindTable (
char *Signature,
char *OemId,
char *OemTableId,
ACPI_TABLE_HEADER **TablePtr)
{
ACPI_STATUS Status;
ACPI_TABLE_HEADER *Table;
ACPI_FUNCTION_TRACE ("TbFindTable");
/* Validate string lengths */
if ((ACPI_STRLEN (Signature) > ACPI_NAME_SIZE) ||
(ACPI_STRLEN (OemId) > sizeof (Table->OemId)) ||
(ACPI_STRLEN (OemTableId) > sizeof (Table->OemTableId)))
{
return_ACPI_STATUS (AE_AML_STRING_LIMIT);
}
/* Find the table */
Status = AcpiGetFirmwareTable (Signature, 1,
ACPI_LOGICAL_ADDRESSING, &Table);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
}
/* Check OemId and OemTableId */
if ((OemId[0] && ACPI_STRCMP (OemId, Table->OemId)) ||
(OemTableId[0] && ACPI_STRCMP (OemTableId, Table->OemTableId)))
{
return_ACPI_STATUS (AE_AML_NAME_NOT_FOUND);
}
*TablePtr = Table;
return_ACPI_STATUS (AE_OK);
}
示例13: AcpiUtSafeStrncat
BOOLEAN
AcpiUtSafeStrncat (
char *Dest,
ACPI_SIZE DestSize,
char *Source,
ACPI_SIZE MaxTransferLength)
{
ACPI_SIZE ActualTransferLength;
ActualTransferLength = ACPI_MIN (MaxTransferLength, ACPI_STRLEN (Source));
if ((ACPI_STRLEN (Dest) + ActualTransferLength) >= DestSize)
{
return (TRUE);
}
ACPI_STRNCAT (Dest, Source, MaxTransferLength);
return (FALSE);
}
示例14: acpi_tb_find_table
acpi_status
acpi_tb_find_table (
char *signature,
char *oem_id,
char *oem_table_id,
struct acpi_table_header **table_ptr)
{
acpi_status status;
struct acpi_table_header *table;
ACPI_FUNCTION_TRACE ("tb_find_table");
/* Validate string lengths */
if ((ACPI_STRLEN (signature) > ACPI_NAME_SIZE) ||
(ACPI_STRLEN (oem_id) > sizeof (table->oem_id)) ||
(ACPI_STRLEN (oem_table_id) > sizeof (table->oem_table_id))) {
return_ACPI_STATUS (AE_AML_STRING_LIMIT);
}
/* Find the table */
status = acpi_get_firmware_table (signature, 1,
ACPI_LOGICAL_ADDRESSING, &table);
if (ACPI_FAILURE (status)) {
return_ACPI_STATUS (status);
}
/* Check oem_id and oem_table_id */
if ((oem_id[0] && ACPI_STRCMP (oem_id, table->oem_id)) ||
(oem_table_id[0] && ACPI_STRCMP (oem_table_id, table->oem_table_id))) {
return_ACPI_STATUS (AE_AML_NAME_NOT_FOUND);
}
*table_ptr = table;
return_ACPI_STATUS (AE_OK);
}
示例15: DtNormalizeBuffer
static char *
DtNormalizeBuffer (
char *Buffer,
UINT32 *Count)
{
char *NewBuffer;
char *TmpBuffer;
UINT32 BufferCount = 0;
BOOLEAN Separator = TRUE;
char c;
NewBuffer = UtLocalCalloc (ACPI_STRLEN (Buffer) + 1);
TmpBuffer = NewBuffer;
while ((c = *Buffer++))
{
switch (c)
{
/* Valid separators */
case '[':
case ']':
case ' ':
case ',':
Separator = TRUE;
break;
default:
if (Separator)
{
/* Insert blank as the standard separator */
if (NewBuffer[0])
{
*TmpBuffer++ = ' ';
BufferCount++;
}
Separator = FALSE;
}
*TmpBuffer++ = c;
break;
}
}
*Count = BufferCount + 1;
return (NewBuffer);
}