win32/file.c File Reference

#include "ruby/ruby.h"
#include "ruby/encoding.h"
#include "ruby/thread.h"
#include "internal.h"
#include <winbase.h>
#include <wchar.h>
#include <shlwapi.h>

Go to the source code of this file.

Data Structures

struct  code_page_table

Defines

#define INVALID_FILE_ATTRIBUTES   ((DWORD)-1)
#define IS_DIR_SEPARATOR_P(c)   (c == L'\\' || c == L'/')
#define IS_DIR_UNC_P(c)   (IS_DIR_SEPARATOR_P(c[0]) && IS_DIR_SEPARATOR_P(c[1]))
#define INVALID_CODE_PAGE   51932
#define PATH_BUFFER_SIZE   MAX_PATH * 2
#define insecure_obj_p(obj, level)   ((level) >= 4 || ((level) > 0 && OBJ_TAINTED(obj)))
#define fix_string_encoding(str, encoding)   rb_str_conv_enc((str), (encoding), rb_utf8_encoding())

Functions

static void replace_wchar (wchar_t *s, int find, int replace)
static void convert_mb_to_wchar (const char *str, wchar_t **wstr, size_t *wstr_len, UINT code_page)
static void convert_wchar_to_mb (const wchar_t *wstr, char **str, size_t *str_len, UINT code_page)
static wchar_t * home_dir (void)
static size_t remove_invalid_alternative_data (wchar_t *wfullpath, size_t size)
static UINT system_code_page (void)
void rb_enc_foreach_name (int(*func)(st_data_t name, st_data_t idx, st_data_t arg), st_data_t arg)
static int code_page_i (st_data_t name, st_data_t idx, st_data_t arg)
static UINT code_page (rb_encoding *enc)
static size_t replace_to_long_name (wchar_t **wfullpath, size_t size, int heap)
static VALUE get_user_from_path (wchar_t **wpath, int offset, UINT cp, UINT path_cp, rb_encoding *path_encoding)
VALUE rb_file_expand_path_internal (VALUE fname, VALUE dname, int abs_mode, int long_name, VALUE result)
static void * loadopen_func (void *wpath)
int rb_file_load_ok (const char *path)
void Init_w32_codepage (void)

Variables

static struct code_page_table rb_code_page

Define Documentation

#define fix_string_encoding ( str,
encoding   )     rb_str_conv_enc((str), (encoding), rb_utf8_encoding())

Definition at line 225 of file file.c.

Referenced by rb_file_expand_path_internal().

#define insecure_obj_p ( obj,
level   )     ((level) >= 4 || ((level) > 0 && OBJ_TAINTED(obj)))

Definition at line 26 of file file.c.

#define INVALID_CODE_PAGE   51932

Definition at line 23 of file file.c.

Referenced by code_page(), code_page_i(), get_user_from_path(), and rb_file_expand_path_internal().

#define INVALID_FILE_ATTRIBUTES   ((DWORD)-1)

Definition at line 10 of file file.c.

Referenced by rb_file_load_ok().

#define IS_DIR_SEPARATOR_P (  )     (c == L'\\' || c == L'/')
#define IS_DIR_UNC_P (  )     (IS_DIR_SEPARATOR_P(c[0]) && IS_DIR_SEPARATOR_P(c[1]))

Definition at line 20 of file file.c.

Referenced by rb_file_expand_path_internal().

#define PATH_BUFFER_SIZE   MAX_PATH * 2

Definition at line 24 of file file.c.

Referenced by rb_file_expand_path_internal().


Function Documentation

static UINT code_page ( rb_encoding *  enc  )  [static]
static int code_page_i ( st_data_t  name,
st_data_t  idx,
st_data_t  arg 
) [static]
static void convert_mb_to_wchar ( const char *  str,
wchar_t **  wstr,
size_t *  wstr_len,
UINT  code_page 
) [inline, static]

Definition at line 40 of file file.c.

References NULL, and xmalloc.

Referenced by rb_file_expand_path_internal(), and rb_file_load_ok().

static void convert_wchar_to_mb ( const wchar_t *  wstr,
char **  str,
size_t *  str_len,
UINT  code_page 
) [inline, static]

Definition at line 52 of file file.c.

References NULL, and xmalloc.

Referenced by get_user_from_path().

static VALUE get_user_from_path ( wchar_t **  wpath,
int  offset,
UINT  cp,
UINT  path_cp,
rb_encoding *  path_encoding 
) [inline, static]
static wchar_t* home_dir ( void   )  [static]

Definition at line 73 of file file.c.

References NULL, replace_wchar(), and xmalloc.

Referenced by rb_file_expand_path_internal().

void Init_w32_codepage ( void   ) 

Definition at line 712 of file file.c.

References code_page_i(), code_page_table::count, rb_code_page, and rb_enc_foreach_name().

Referenced by rb_locale_encindex().

static void* loadopen_func ( void *  wpath  )  [static]

Definition at line 675 of file file.c.

References NULL.

Referenced by rb_file_load_ok().

void rb_enc_foreach_name ( int(*)(st_data_t name, st_data_t idx, st_data_t arg)  func,
st_data_t  arg 
)

Definition at line 1964 of file encoding.c.

References enc_table, func, and st_foreach().

Referenced by Init_w32_codepage().

VALUE rb_file_expand_path_internal ( VALUE  fname,
VALUE  dname,
int  abs_mode,
int  long_name,
VALUE  result 
)
int rb_file_load_ok ( const char *  path  ) 
static size_t remove_invalid_alternative_data ( wchar_t *  wfullpath,
size_t  size 
) [inline, static]

Definition at line 138 of file file.c.

References IS_DIR_SEPARATOR_P.

Referenced by rb_file_expand_path_internal().

static size_t replace_to_long_name ( wchar_t **  wfullpath,
size_t  size,
int  heap 
) [inline, static]

Definition at line 232 of file file.c.

References buf, IS_DIR_SEPARATOR_P, xfree, and xmalloc.

Referenced by rb_file_expand_path_internal().

static void replace_wchar ( wchar_t *  s,
int  find,
int  replace 
) [inline, static]

Definition at line 29 of file file.c.

Referenced by home_dir(), and rb_file_expand_path_internal().

static UINT system_code_page ( void   )  [inline, static]

Definition at line 170 of file file.c.

Referenced by code_page(), and rb_file_expand_path_internal().


Variable Documentation

struct code_page_table rb_code_page [static]

Referenced by code_page(), and Init_w32_codepage().


Generated on 18 May 2020 for Ruby by  doxygen 1.6.1