ReactOS 0.4.16-dev-814-g656a5dc
fullpath.cpp File Reference
#include <stdio.h>
#include <direct.h>
#include <errno.h>
#include <stdlib.h>
#include <corecrt_internal_traits.h>
#include <windows.h>
Include dependency graph for fullpath.cpp:

Go to the source code of this file.

Functions

template<typename Character >
 _Success_ (return !=0) static Character *__cdecl common_fullpath(_Out_writes_z_(max_count) Character *const user_buffer
 
Character const *const size_t const int const char const *const int const line_number throw ()
 
char *__cdecl _fullpath (char *const user_buffer, char const *const path, size_t const max_count)
 
wchar_t *__cdecl _wfullpath (wchar_t *const user_buffer, wchar_t const *const path, size_t const max_count)
 

Variables

Character const *const path
 
Character const *const size_t const max_count
 
Character const *const size_t const int const block_use
 
Character const *const size_t const int const char const *const file_name
 

Function Documentation

◆ _fullpath()

char *__cdecl _fullpath ( char *const  user_buffer,
char const *const  path,
size_t const  max_count 
)

Definition at line 106 of file fullpath.cpp.

111{
112 return common_fullpath(user_buffer, path, max_count, _NORMAL_BLOCK, nullptr, 0);
113}
#define _NORMAL_BLOCK
Definition: crtdbg.h:67
Character const *const size_t const max_count
Definition: fullpath.cpp:66

◆ _Success_()

template<typename Character >
_Success_ ( return = 0) const

◆ _wfullpath()

wchar_t *__cdecl _wfullpath ( wchar_t *const  user_buffer,
wchar_t const *const  path,
size_t const  max_count 
)

Definition at line 115 of file fullpath.cpp.

120{
121 return common_fullpath(user_buffer, path, max_count, _NORMAL_BLOCK, nullptr, 0);
122}

◆ throw()

Definition at line 70 of file fullpath.cpp.

71{
72 // These are referenced only in the Debug CRT build
76
77 typedef __crt_char_traits<Character> traits;
78
79 // If the path is empty, we have no work to do:
80 if (path == nullptr || path[0] == '\0')
81 {
82#pragma warning(suppress:__WARNING_POSTCONDITION_NULLTERMINATION_VIOLATION) // 26036 Prefast does not understand perfect forwarding.
83 return traits::tgetcwd(user_buffer, static_cast<int>(__min(max_count, INT_MAX)));
84 }
85
86 if (user_buffer != nullptr) {
87 // Using user buffer. Fail if not enough space.
89 if (!traits::get_full_path_name(path, buffer)) {
90 return user_buffer;
91 } else {
92 return nullptr;
93 }
94 } else {
95 // Always new memory suitable for debug mode and releasing to the user.
98 );
99 traits::get_full_path_name(path, buffer);
100 return buffer.detach();
101 }
102}
int const char const *const int const line_number
Definition: debug_heap.cpp:499
Character const *const size_t const int const block_use
Definition: fullpath.cpp:67
Character const *const size_t const int const char const *const file_name
Definition: fullpath.cpp:68
GLuint buffer
Definition: glext.h:5915
#define __min(a, b)
Definition: stdlib.h:102
#define INT_MAX
Definition: intsafe.h:150
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:325

Variable Documentation

◆ block_use

Character const* const size_t const int const block_use

Definition at line 67 of file fullpath.cpp.

Referenced by throw().

◆ file_name

Character const* const size_t const int const char const* const file_name

Definition at line 68 of file fullpath.cpp.

Referenced by throw().

◆ max_count

◆ path

Character const* const path

Definition at line 65 of file fullpath.cpp.