Ruby
1.9.3p448(2013-06-27revision41675)
|
#include "ruby/ruby.h"
#include "ruby/encoding.h"
#include <winbase.h>
#include <wchar.h>
#include <shlwapi.h>
Go to the source code of this file.
Macros | |
#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))) |
Functions | |
static void | replace_wchar (wchar_t *s, int find, int replace) |
static void | convert_mb_to_wchar (VALUE str, wchar_t **wstr, wchar_t **wstr_pos, 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) |
static UINT | code_page (rb_encoding *enc) |
static VALUE | fix_string_encoding (VALUE str, rb_encoding *encoding) |
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) |
int | rb_file_load_ok (const char *path) |
void | rb_w32_init_file (void) |
Variables | |
static VALUE | rb_code_page |
#define insecure_obj_p | ( | obj, | |
level | |||
) | ((level) >= 4 || ((level) > 0 && OBJ_TAINTED(obj))) |
#define INVALID_CODE_PAGE 51932 |
Definition at line 18 of file file.c.
Referenced by code_page(), get_user_from_path(), and rb_file_expand_path_internal().
#define INVALID_FILE_ATTRIBUTES ((DWORD)-1) |
Definition at line 8 of file file.c.
Referenced by rb_file_load_ok().
#define IS_DIR_SEPARATOR_P | ( | c | ) | (c == L'\\' || c == L'/') |
Definition at line 14 of file file.c.
Referenced by get_user_from_path(), rb_file_expand_path_internal(), remove_invalid_alternative_data(), and replace_to_long_name().
#define IS_DIR_UNC_P | ( | c | ) | (IS_DIR_SEPARATOR_P(c[0]) && IS_DIR_SEPARATOR_P(c[1])) |
Definition at line 15 of file file.c.
Referenced by rb_file_expand_path_internal().
#define PATH_BUFFER_SIZE MAX_PATH * 2 |
Definition at line 19 of file file.c.
Referenced by rb_file_expand_path_internal().
|
static |
Definition at line 181 of file file.c.
References RString::as, RString::basic, CONST_ID, ENC_CODERANGE_7BIT, enc_name(), ENCODING_CODERANGE_SET, FIX2INT, RBasic::flags, RString::heap, i, INT2FIX, INVALID_CODE_PAGE, RBasic::klass, name, names, NIL_P, Qnil, Qundef, RARRAY_LEN, RARRAY_PTR, rb_ascii8bit_encoding(), rb_code_page, rb_cString, rb_enc_from_encoding(), rb_enc_name, rb_funcall(), rb_hash_aset(), rb_hash_lookup, rb_usascii_encindex(), rb_usascii_encoding(), rb_usascii_str_new2(), RSTRING_NOEMBED, RSTRING_PTR, strlen(), system_code_page(), and T_STRING.
Referenced by rb_file_expand_path_internal().
|
inlinestatic |
Definition at line 35 of file file.c.
References len, NIL_P, NULL, RSTRING_PTR, and xmalloc.
Referenced by rb_file_expand_path_internal().
|
inlinestatic |
|
inlinestatic |
Definition at line 240 of file file.c.
References Qnil, rb_enc_from_encoding(), rb_enc_str_new(), rb_str_encode(), rb_utf8_encoding(), result, RSTRING_LEN, and RSTRING_PTR.
Referenced by rb_file_expand_path_internal().
|
inlinestatic |
Definition at line 321 of file file.c.
References convert_wchar_to_mb(), INVALID_CODE_PAGE, IS_DIR_SEPARATOR_P, Qnil, rb_enc_from_encoding(), rb_enc_str_new(), rb_str_encode(), rb_str_resize(), rb_utf8_encoding(), result, size, and xfree().
Referenced by rb_file_expand_path_internal().
|
static |
Definition at line 73 of file file.c.
References len, NULL, replace_wchar(), and xmalloc.
Referenced by rb_file_expand_path_internal().
VALUE rb_file_expand_path_internal | ( | VALUE | fname, |
VALUE | dname, | ||
int | abs_mode, | ||
int | long_name, | ||
VALUE | result | ||
) |
Definition at line 352 of file file.c.
References ALLOCA_N, ALLOCV_END, ALLOCV_N, append_fspath(), buf, BUFCHECK, BUFINIT, chompdirsep(), code_page(), convert_mb_to_wchar(), ENC_CODERANGE_7BIT, ENC_CODERANGE_CLEAR, fix_string_encoding(), get_user_from_path(), home_dir(), Inc, INVALID_CODE_PAGE, IS_DIR_SEPARATOR_P, IS_DIR_UNC_P, isdirsep, istrailinggarbage, len, lstat, MAXPATHLEN, my_getcwd, nextdirsep, NIL_P, NULL, OBJ_TAINT, OBJ_TAINTED, p, PATH_BUFFER_SIZE, Qnil, rb_eArgError, rb_enc_associate(), rb_enc_check(), rb_enc_copy(), rb_enc_from_encoding(), rb_enc_get(), rb_enc_str_coderange(), rb_file_expand_path_internal(), rb_filesystem_encoding(), rb_home_dir(), rb_is_absolute_path(), rb_raise(), rb_str_buf_cat(), rb_str_encode(), rb_str_encode_ospath(), rb_str_modify(), rb_str_resize(), rb_str_set_len, rb_utf8_encoding(), remove_invalid_alternative_data(), replace_to_long_name(), replace_wchar(), result, RSTRING_LEN, RSTRING_PTR, S_ISLNK, size, skipprefix, skiproot(), stat, STRCASECMP, StringValuePtr, strlcat(), strlen(), strncasecmp, strrdirsep, system_code_page(), TOLOWER, v, xfree(), and xmalloc.
int rb_file_load_ok | ( | const char * | path | ) |
Definition at line 686 of file file.c.
References fstat, INVALID_FILE_ATTRIBUTES, NULL, rb_update_max_fd(), S_ISREG, and stat.
void rb_w32_init_file | ( | void | ) |
Definition at line 709 of file file.c.
References rb_code_page, rb_gc_register_mark_object(), and rb_hash_new().
Referenced by Init_File().
|
inlinestatic |
Definition at line 138 of file file.c.
References IS_DIR_SEPARATOR_P, and size.
Referenced by rb_file_expand_path_internal().
|
inlinestatic |
Definition at line 255 of file file.c.
References buf, IS_DIR_SEPARATOR_P, size, xfree(), and xmalloc.
Referenced by rb_file_expand_path_internal().
|
inlinestatic |
Definition at line 24 of file file.c.
Referenced by home_dir(), and rb_file_expand_path_internal().
|
inlinestatic |
Definition at line 170 of file file.c.
Referenced by code_page(), and rb_file_expand_path_internal().
|
static |
Definition at line 12 of file file.c.
Referenced by code_page(), and rb_w32_init_file().