ReactOS 0.4.16-dev-2104-gb84fa49
utclib.c File Reference
#include "acpi.h"
#include "accommon.h"
Include dependency graph for utclib.c:

Go to the source code of this file.

Macros

#define ACPI_CLIBRARY
 
#define _COMPONENT   ACPI_UTILITIES
 

Functions

int memcmp (void *VBuffer1, void *VBuffer2, ACPI_SIZE Count)
 
voidmemmove (void *Dest, const void *Src, ACPI_SIZE Count)
 
voidmemcpy (void *Dest, const void *Src, ACPI_SIZE Count)
 
voidmemset (void *Dest, int Value, ACPI_SIZE Count)
 
ACPI_SIZE strlen (const char *String)
 
charstrpbrk (const char *String, const char *Delimiters)
 
charstrtok (char *String, const char *Delimiters)
 
charstrcpy (char *DstString, const char *SrcString)
 
charstrncpy (char *DstString, const char *SrcString, ACPI_SIZE Count)
 
int strcmp (const char *String1, const char *String2)
 
charstrchr (const char *String, int ch)
 
int strncmp (const char *String1, const char *String2, ACPI_SIZE Count)
 
charstrcat (char *DstString, const char *SrcString)
 
charstrncat (char *DstString, const char *SrcString, ACPI_SIZE Count)
 
charstrstr (char *String1, char *String2)
 
UINT32 strtoul (const char *String, char **Terminator, UINT32 Base)
 
int toupper (int c)
 
int tolower (int c)
 

Variables

const UINT8 AcpiGbl_Ctypes [257]
 

Macro Definition Documentation

◆ _COMPONENT

#define _COMPONENT   ACPI_UTILITIES

Definition at line 90 of file utclib.c.

◆ ACPI_CLIBRARY

#define ACPI_CLIBRARY

Definition at line 44 of file utclib.c.

Function Documentation

◆ memcmp()

int memcmp ( void VBuffer1,
void VBuffer2,
ACPI_SIZE  Count 
)

Definition at line 112 of file utclib.c.

116{
117 char *Buffer1 = (char *) VBuffer1;
118 char *Buffer2 = (char *) VBuffer2;
119
120
121 for ( ; Count-- && (*Buffer1 == *Buffer2); Buffer1++, Buffer2++)
122 {
123 }
124
125 return ((Count == ACPI_SIZE_MAX) ? 0 : ((unsigned char) *Buffer1 -
126 (unsigned char) *Buffer2));
127}
unsigned char
Definition: typeof.h:29
int Count
Definition: noreturn.cpp:7

Referenced by strstr().

◆ memcpy()

void * memcpy ( void Dest,
const void Src,
ACPI_SIZE  Count 
)

Definition at line 200 of file utclib.c.

204{
205 char *New = (char *) Dest;
206 char *Old = (char *) Src;
207
208
209 while (Count)
210 {
211 *New = *Old;
212 New++;
213 Old++;
214 Count--;
215 }
216
217 return (Dest);
218}

◆ memmove()

void * memmove ( void Dest,
const void Src,
ACPI_SIZE  Count 
)

Definition at line 145 of file utclib.c.

149{
150 char *New = (char *) Dest;
151 char *Old = (char *) Src;
152
153
154 if (Old > New)
155 {
156 /* Copy from the beginning */
157
158 while (Count)
159 {
160 *New = *Old;
161 New++;
162 Old++;
163 Count--;
164 }
165 }
166 else if (Old < New)
167 {
168 /* Copy from the end */
169
170 New = New + Count - 1;
171 Old = Old + Count - 1;
172 while (Count)
173 {
174 *New = *Old;
175 New--;
176 Old--;
177 Count--;
178 }
179 }
180
181 return (Dest);
182}

◆ memset()

void * memset ( void Dest,
int  Value,
ACPI_SIZE  Count 
)

Definition at line 236 of file utclib.c.

240{
241 char *New = (char *) Dest;
242
243
244 while (Count)
245 {
246 *New = (char) Value;
247 New++;
248 Count--;
249 }
250
251 return (Dest);
252}
_Must_inspect_result_ _In_ WDFKEY _In_ PCUNICODE_STRING _Out_opt_ PUSHORT _Inout_opt_ PUNICODE_STRING Value
Definition: wdfregistry.h:413

◆ strcat()

char * strcat ( char DstString,
const char SrcString 
)

Definition at line 568 of file utclib.c.

571{
572 char *String;
573
574
575 /* Find end of the destination string */
576
577 for (String = DstString; *String++; )
578 { ; }
579
580 /* Concatenate the string */
581
582 for (--String; (*String++ = *SrcString++); )
583 { ; }
584
585 return (DstString);
586}
_Must_inspect_result_ _In_ WDFDEVICE _In_ WDFSTRING String
Definition: wdfdevice.h:2439

◆ strchr()

char * strchr ( const char String,
int  ch 
)

Definition at line 501 of file utclib.c.

504{
505
506
507 for ( ; (*String); String++)
508 {
509 if ((*String) == (char) ch)
510 {
511 return ((char *) String);
512 }
513 }
514
515 return (NULL);
516}
#define NULL
Definition: types.h:112
unsigned char ch[4][2]
Definition: console.c:118

Referenced by __Extract_locale_name(), __get_floor_digits(), __getpublickey_real(), _fmtarglist(), _get_next_token(), _getopt_internal_r(), _IRQL_requires_max_(), _mbschr(), _mbschr_l(), _putenv(), _tiffStreamOpen(), _tmain(), add_param(), add_widl_version_define(), AddrStrToAddr(), adns_submit(), ArcGetNextTokenA(), bad_name(), BiosInitialize(), CabinetFindNext(), cache_entry_create(), ccf_sortlist(), cert_mgr_advanced_dlg_proc(), change_section_attribs(), check_in_programs_list(), cleanup(), config_parse_pair(), convert_to_unix_filename(), convert_usages_str_to_usage(), create_locinfo(), create_sic(), CsrParseServerCommandLine(), ctype_822special(), ctype_domainunquoted(), decode_html(), DecodeDirectoryURL(), DecodeServEntFromString(), detect_proxy_autoconfig_url_dns(), DissectArcPath(), DoCommand(), DoDESCRIPTIONS(), DoKEYNAME(), DoLANGUAGENAMES(), DoOpen(), DosBuildSysEnvBlock(), DosChangeDirectory(), dosflags(), DosKRNLInitialize(), doWinMain(), dup_ncp(), enum_gac_assembly_dirs(), env_set(), errflags(), EscapeString(), expect_layeronly_imp(), ext_in_list(), fdom_split(), file_add(), file_cvt(), find_default_printer(), find_input_file(), findend(), findgequal(), fnmatch1(), for(), FTP_ParseNextFile(), FTPChdirAndGetCWD(), FTPDecodeURL(), FTPFtw(), FTPFtwL2(), FTPGetCWD(), FTPListToMemory2(), FTPMkdir2(), FTPRemoteGlob(), generate_xa_rr_attributes(), get_attr(), get_constant_element_by_name(), get_graft(), get_hdrguardtext(), get_key(), get_parameter_element_by_name(), get_session_start(), get_username_and_hostname(), GetBookmark(), tinyxml2::XMLUtil::GetCharacterRef(), getenv(), getenv_helper(), GetExpandedNameA(), GetFunctionFromForwarder(), File::getline(), getline(), GetLineExtentA(), CWineTest::GetNextTest(), getopt(), getopt_internal(), getopt_long(), GetOurHostName(), GetPreviousParamString(), GetProtoGetNextEnt(), GetProtoPatternMatch(), getSection(), GetStartSpoolDate(), gl_do_tab_completion(), gl_histadd(), handle_address_cmd(), handle_child_line(), handle_escape_cmd(), handle_readdir(), has_extension(), HLPFILE_AddHotSpotLinks(), import_file(), inf_process_content(), inf_section_parse(), inf_value_parse(), init(), init_argv0_target(), init_content_type(), init_logger_addr(), initialize_purpose_selection(), InitIgnoreFreeLibrary(), InputChar(), isOffset(), kbd_rc(), KdbpGetCommandLineSettings(), KdpGetTerminalSettings(), LdrpSnapThunk(), LlbEnvRead(), load_persistent_cookie(), LoadFirewallPrefs(), LoadModuleWithSymbols(), locale_to_sname(), MACRO_JumpID(), main(), MakeArgv(), MakeSureDirectoryPathExists(), MayUseFirewall(), menu_ownerdraw_wnd_proc(), MiSnapThunk(), MMDRV_Init(), MSVCRT__create_locale(), MSVCRT_locale_to_LCID(), myTokenize(), NeedCurrentDirectoryForExePathA(), netname2host(), netname2user(), next_arg(), NextLine(), NextOption(), nFTPChdirAndGetCWD(), NSP_GetServiceByNameHeapAllocW(), Output(), XMLStorage::XPathElement::parse(), parse_date(), parse_list_response(), parse_options(), parse_rr(), parse_server_and_port(), parse_stat_response(), parse_target(), parse_uidl_response(), ParseInputFile(), PathParseIconLocationA(), PeLdrpBindImportName(), pf_fill(), pf_output_special_fp(), pf_printf(), pfopen(), PopupError(), PostInit(), pp_add_define(), prepare_rpn_result_2(), print_insn(), print_something(), print_status(), PrintMenu(), PrintStartupBanner(), process_long_option(), processRequest(), read_merging_directory(), read_oid_info(), read_password(), read_prop(), read_reply(), read_stdin(), Bookmark::read_url(), readSection(), RemoteGlobCollapse(), rename_file(), retrieve_cached_basic_authorization(), RtlSplayTreeTest(), scan_directory_tree(), scan_sparc_boot(), scan_sunx86_boot(), seamless_get_token(), search_tree_file(), searchfileinpath(), SetDllDirectoryA(), skipsemi(), sort_n_finish(), stabs_parse(), stabs_parse_type(), stabs_parse_typedef(), stabs_pts_read_aggregate(), stabs_pts_read_method_info(), stime_arg1(), StoreNameInSft(), str_handle_lines(), streamout(), Strntok(), strpbrk(), Strtok(), strtok(), strtok_s(), SymFromName(), test_appsearch_reglocator(), test_currentworkingdir(), test_dde(), test_EM_AUTOURLDETECT(), test_EnumDateFormatsA(), test_EnumTimeFormatsA(), test_environment_manipulation(), test_filename(), test_find_executable(), test_FoldStringA(), test_GetDiskInfoA(), test_GetFileInformationByHandleEx(), test_GetLongPathNameA(), test_listbox_dlgdir(), test_longstrings(), test_mbs_help(), test_PrintDlgA(), test_put_hash(), test_setlocale(), test_tmpnam(), testSetHelper(), testWriteNotWrappedProcessed(), TIFFPrintDirectory(), translate_line(), TranslateFunctionName(), TranslateParameters(), TRIO_ARGS2(), TuiDrawMenuTimeout(), u_strchr(), ui_clip_handle_data(), UnMlsD(), UrlGetLocationA(), UserLoginThread(), ValidChar(), vsyslog(), WinHttpDetectAutoProxyConfigUrl(), WinHttpGetDefaultProxyConfiguration(), WinMain(), wpp_add_cmdline_define(), write_com_interface_end(), WriteDefaultFirewallPrefs(), WriteLine(), WriteToPipeThread(), WspiapiLegacyGetNameInfo(), and xkeymap_read().

◆ strcmp()

int strcmp ( const char String1,
const char String2 
)

Definition at line 469 of file utclib.c.

472{
473
474
475 for ( ; (*String1 == *String2); String2++)
476 {
477 if (!*String1++)
478 {
479 return (0);
480 }
481 }
482
483 return ((unsigned char) *String1 - (unsigned char) *String2);
484}
_In_ const STRING * String2
Definition: rtlfuncs.h:2404

◆ strcpy()

char * strcpy ( char DstString,
const char SrcString 
)

Definition at line 388 of file utclib.c.

391{
392 char *String = DstString;
393
394
395 /* Move bytes brute force */
396
397 while (*SrcString)
398 {
399 *String = *SrcString;
400
401 String++;
402 SrcString++;
403 }
404
405 /* Null terminate */
406
407 *String = 0;
408 return (DstString);
409}

◆ strlen()

ACPI_SIZE strlen ( const char String)

Definition at line 269 of file utclib.c.

271{
272 UINT32 Length = 0;
273
274
275 /* Count the string until a null is encountered */
276
277 while (*String)
278 {
279 Length++;
280 String++;
281 }
282
283 return (Length);
284}
unsigned int UINT32
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:102

Referenced by strstr().

◆ strncat()

char * strncat ( char DstString,
const char SrcString,
ACPI_SIZE  Count 
)

Definition at line 605 of file utclib.c.

609{
610 char *String;
611
612
613 if (Count)
614 {
615 /* Find end of the destination string */
616
617 for (String = DstString; *String++; )
618 { ; }
619
620 /* Concatenate the string */
621
622 for (--String; (*String++ = *SrcString++) && --Count; )
623 { ; }
624
625 /* Null terminate if necessary */
626
627 if (!Count)
628 {
629 *String = 0;
630 }
631 }
632
633 return (DstString);
634}

◆ strncmp()

int strncmp ( const char String1,
const char String2,
ACPI_SIZE  Count 
)

Definition at line 534 of file utclib.c.

538{
539
540
541 for ( ; Count-- && (*String1 == *String2); String2++)
542 {
543 if (!*String1++)
544 {
545 return (0);
546 }
547 }
548
549 return ((Count == ACPI_SIZE_MAX) ? 0 : ((unsigned char) *String1 -
550 (unsigned char) *String2));
551}

◆ strncpy()

char * strncpy ( char DstString,
const char SrcString,
ACPI_SIZE  Count 
)

Definition at line 427 of file utclib.c.

431{
432 char *String = DstString;
433
434
435 /* Copy the string */
436
437 for (String = DstString;
438 Count && (Count--, (*String++ = *SrcString++)); )
439 {;}
440
441 /* Pad with nulls if necessary */
442
443 while (Count--)
444 {
445 *String = 0;
446 String++;
447 }
448
449 /* Return original pointer */
450
451 return (DstString);
452}

◆ strpbrk()

char * strpbrk ( const char String,
const char Delimiters 
)

Definition at line 302 of file utclib.c.

305{
306 const char *Delimiter;
307
308
309 for ( ; *String != '\0'; ++String)
310 {
311 for (Delimiter = Delimiters; *Delimiter != '\0'; Delimiter++)
312 {
313 if (*String == *Delimiter)
314 {
315 return (ACPI_CAST_PTR (char, String));
316 }
317 }
318 }
319
320 return (NULL);
321}
#define ACPI_CAST_PTR(t, p)
Definition: actypes.h:544

Referenced by strtok().

◆ strstr()

char * strstr ( char String1,
char String2 
)

Definition at line 653 of file utclib.c.

656{
657 ACPI_SIZE Length;
658
659
661 if (!Length)
662 {
663 return (String1);
664 }
665
666 while (strlen (String1) >= Length)
667 {
668 if (memcmp (String1, String2, Length) == 0)
669 {
670 return (String1);
671 }
672 String1++;
673 }
674
675 return (NULL);
676}
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
int memcmp(void *VBuffer1, void *VBuffer2, ACPI_SIZE Count)
Definition: utclib.c:112

◆ strtok()

char * strtok ( char String,
const char Delimiters 
)

Definition at line 338 of file utclib.c.

341{
342 char *Begin = String;
343 static char *SavedPtr;
344
345
346 if (Begin == NULL)
347 {
348 if (SavedPtr == NULL)
349 {
350 return (NULL);
351 }
352 Begin = SavedPtr;
353 }
354
355 SavedPtr = strpbrk (Begin, Delimiters);
356 while (SavedPtr == Begin)
357 {
358 *Begin++ = '\0';
359 SavedPtr = strpbrk (Begin, Delimiters);
360 }
361
362 if (SavedPtr)
363 {
364 *SavedPtr++ = '\0';
365 return (Begin);
366 }
367 else
368 {
369 return (NULL);
370 }
371}
ACPI_BUFFER *RetBuffer ACPI_BUFFER *RetBuffer char ACPI_WALK_RESOURCE_CALLBACK void *Context ACPI_BUFFER *RetBuffer UINT16 ACPI_RESOURCE **ResourcePtr ACPI_GENERIC_ADDRESS *Reg UINT32 *ReturnValue UINT8 UINT8 *Slp_TypB ACPI_PHYSICAL_ADDRESS PhysicalAddress64 UINT32 UINT32 *TimeElapsed UINT32 ACPI_STATUS const char UINT32 ACPI_STATUS const char UINT32 const char const char UINT32 const char BOOLEAN Begin
Definition: acpixf.h:1301
char * strpbrk(const char *String, const char *Delimiters)
Definition: utclib.c:302

◆ strtoul()

UINT32 strtoul ( const char String,
char **  Terminator,
UINT32  Base 
)

Definition at line 696 of file utclib.c.

700{
701 UINT32 converted = 0;
703 UINT32 sign;
704 const char *StringStart;
707
708
709 /*
710 * Save the value of the pointer to the buffer's first
711 * character, save the current errno value, and then
712 * skip over any white space in the buffer:
713 */
714 StringStart = String;
715 while (isspace (*String) || *String == '\t')
716 {
717 ++String;
718 }
719
720 /*
721 * The buffer may contain an optional plus or minus sign.
722 * If it does, then skip over it but remember what is was:
723 */
724 if (*String == '-')
725 {
727 ++String;
728 }
729 else if (*String == '+')
730 {
731 ++String;
733 }
734 else
735 {
737 }
738
739 /*
740 * If the input parameter Base is zero, then we need to
741 * determine if it is octal, decimal, or hexadecimal:
742 */
743 if (Base == 0)
744 {
745 if (*String == '0')
746 {
747 if (tolower (*(++String)) == 'x')
748 {
749 Base = 16;
750 ++String;
751 }
752 else
753 {
754 Base = 8;
755 }
756 }
757 else
758 {
759 Base = 10;
760 }
761 }
762 else if (Base < 2 || Base > 36)
763 {
764 /*
765 * The specified Base parameter is not in the domain of
766 * this function:
767 */
768 goto done;
769 }
770
771 /*
772 * For octal and hexadecimal bases, skip over the leading
773 * 0 or 0x, if they are present.
774 */
775 if (Base == 8 && *String == '0')
776 {
777 String++;
778 }
779
780 if (Base == 16 &&
781 *String == '0' &&
782 tolower (*(++String)) == 'x')
783 {
784 String++;
785 }
786
787 /*
788 * Main loop: convert the string to an unsigned long:
789 */
790 while (*String)
791 {
792 if (isdigit (*String))
793 {
794 index = (UINT32) ((UINT8) *String - '0');
795 }
796 else
797 {
798 index = (UINT32) toupper (*String);
799 if (isupper (index))
800 {
801 index = index - 'A' + 10;
802 }
803 else
804 {
805 goto done;
806 }
807 }
808
809 if (index >= Base)
810 {
811 goto done;
812 }
813
814 /*
815 * Check to see if value is out of range:
816 */
817
819 (UINT32) Base))
820 {
822 ReturnValue = 0; /* reset */
823 }
824 else
825 {
826 ReturnValue *= Base;
828 converted = 1;
829 }
830
831 ++String;
832 }
833
834done:
835 /*
836 * If appropriate, update the caller's pointer to the next
837 * unconverted character in the buffer.
838 */
839 if (Terminator)
840 {
841 if (converted == 0 && ReturnValue == 0 && String != NULL)
842 {
843 *Terminator = (char *) StringStart;
844 }
845 else
846 {
847 *Terminator = (char *) String;
848 }
849 }
850
851 if (Status == AE_ERROR)
852 {
854 }
855
856 /*
857 * If a minus sign was present, then "the conversion is negated":
858 */
860 {
862 }
863
864 return (ReturnValue);
865}
unsigned char UINT8
#define isspace(c)
Definition: acclib.h:69
#define isdigit(c)
Definition: acclib.h:68
#define isupper(c)
Definition: acclib.h:71
UINT32 void void ** ReturnValue
Definition: acevents.h:216
#define AE_ERROR
Definition: acexcep.h:109
#define AE_OK
Definition: acexcep.h:97
#define ACPI_SIGN_POSITIVE
Definition: acmacros.h:232
#define ACPI_SIGN_NEGATIVE
Definition: acmacros.h:233
UINT32 ACPI_STATUS
Definition: actypes.h:460
#define ACPI_UINT32_MAX
Definition: actypes.h:66
#define index(s, c)
Definition: various.h:29
Status
Definition: gdiplustypes.h:25
GLuint index
Definition: glext.h:6031
#define sign(x)
Definition: mapdesc.cc:613
_In_opt_ ULONG Base
Definition: rtlfuncs.h:2486
int toupper(int c)
Definition: utclib.c:881
int tolower(int c)
Definition: utclib.c:902

◆ tolower()

int tolower ( int  c)

Definition at line 902 of file utclib.c.

904{
905
906 return (isupper(c) ? ((c)+0x20) : (c));
907}
const GLubyte * c
Definition: glext.h:8905

Referenced by strtoul().

◆ toupper()

int toupper ( int  c)

Definition at line 881 of file utclib.c.

883{
884
885 return (islower(c) ? ((c)-0x20) : (c));
886}
#define islower(c)
Definition: acclib.h:72

Referenced by strtoul().

Variable Documentation

◆ AcpiGbl_Ctypes

const UINT8 AcpiGbl_Ctypes[257]

Definition at line 918 of file utclib.c.