summaryrefslogtreecommitdiff
path: root/win32/file.c
AgeCommit message (Collapse)Author
2016-04-28win32/file.c: fix reallocation thresholdnobu
* win32/file.c (replace_to_long_name): fix reallocation threshold. dereferenced size of a pointer is not same as the buffer size. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54807 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-04-28win32/file.c: remove unnecessary codenobu
* win32/file.c (replace_to_long_name): remove unnecessary backward scan for the last directory separator. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54806 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-04-22* file.c, win32/file.c: Removed obsoleted safe level checks.hsbt
[fix GH-1327] Patch by @cremno git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54668 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-04-10win32/file.c: fix freenobu
* win32/file.c (rb_file_expand_path_internal): should free wpath, but not xfree, corresponding to rb_w32_mbstr_to_wstr which allocates by malloc. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54526 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-01-29win32/file.c: drop garbagenobu
* win32/file.c (rb_readlink): drop garbage after the substitute name, as rb_w32_read_reparse_point returns the expected buffer size but "\??\" prefix is dropped from the result. * win32/win32.c (w32_readlink): ditto, including NUL-terminator. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53689 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-01-29* win32/win32.c (fileattr_to_unixmode, rb_w32_reparse_symlink_p): volumeusa
mount point should be treated as directory, not symlink. [ruby-core:72483] [Bug #11874] * win32/win32.c (rb_w32_read_reparse_point): check the reparse point is a volume mount point or not. * win32/file.c (rb_readlink): follow above change (but this pass won't be used). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53688 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-10-16file.c: non-blocking opennobu
* file.c (rb_file_load_ok): open in non-blocking mode withoout releasing GVL. don't care about others than regular files and directories. [ruby-dev:49272] [Bug #11559] * ruby.c (load_file_internal): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52139 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-09-02file.c: use filesystem encodingnobu
* file.c (rb_realpath_internal): use filesystem encoding if the argument is in ASCII encodings. * win32/file.c (rb_readlink): needs the result encoding. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51738 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-09-02win32: use ALLOCVnobu
* win32/file.c (rb_readlink): use ALLOCV to get rid potential memory leak by NoMemoryError in ALLOCV. * win32/win32.c (w32_readlink): allocate WCHAR path name and reparse buffer together. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51737 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-08-25win32.c: rb_w32_reparsenobu
* win32/win32.c (rb_w32_reparse): read reparse point in a dynamic buffer. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51676 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-08-02win32/file.c: use allocv buffer and APInobu
* win32/file.c (rb_freopen): convert path name into allocv buffer and get rid of conversion failure in the case non-terminated string. [ruby-core:69780] [Bug #11320] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51469 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-07-03file.c: _wfreopen_s on mingwnobu
* win32/file.c: some mingw compilers need a tweek for the declarations of _wfreopen_s. [Bug #11320] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51117 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-06-30file.c: not xfreenobu
* win32/file.c (rb_freopen): should free rb_w32_mbstr_to_wstr result instead of xfree. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51072 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-06-30* win32/file.c (rb_freopen): remove debug code.usa
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51071 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-06-30* win32/file.c (rb_freopen): need to terminate by NUL.usa
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51070 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-06-30io.c: reopen OS encoding pathnobu
* io.c (rb_io_reopen): freopen(3) with OS encoding path. [ruby-core:69780] [Bug #11320] * win32/file.c (rb_freopen): wrapper of wchar version freopen(3). use _wfreopen_s() if available. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51069 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-06-18* include/ruby/ruby.h: $SAFE=2 is now obsolete.hsbt
* dir.c, ext/fiddle/handle.c, ext/socket/basicsocket.c, file.c gc.c, io.c, process.c, safe.c, signal.c, win32/file.c: removed code for $SAFE=2 * test/erb/test_erb.rb, test/fiddle/test_handle.rb test/ruby/test_env.rb: removed tests for $SAFE=2. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50958 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-06-14file.c: open without gvlnobu
* file.c (rb_file_load_ok): try opening file without gvl not to lock entire process. [Bug #11060] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50887 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-03-30file.c: include terminatornobu
* win32/file.c (rb_readlink): include the terminator, since rb_w32_mbstr_to_wstr appends a terminator only when the length is not given explicitly. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50119 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-03-23file.c: move rb_readlink on Windowsnobu
* win32/file.c (rb_readlink): move from file.c for better buffer allocation and the result encoding. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50063 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-03-22file.c: check arguments lengthsnobu
* win32/file.c (rb_file_expand_path_internal): check arguments lengths and should not loose preci quielty. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50054 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-02-18win32/file.c: fix drive letternobu
* win32/file.c (rb_file_expand_path_internal): neither the drive of base directory nor the current drive are involved in the result if different than the drive of path. [ruby-core:68130] [Bug #10858] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49640 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-02-17win32/file.c: fix drive letternobu
* win32/file.c (rb_file_expand_path_internal): do not make invalid (or ADS) path if the path has a drive letter, the result also should have be under it. [ruby-core:68130] [Bug #10858] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49618 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-12-26never-NULL pointer checknobu
* dir.c (ruby_glob0): no need to check never-NULL pointer. reported by Denis Denisov <denji0k AT gmail.com>. * win32/file.c (rb_file_expand_path_internal): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49024 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-12-26win32: realloc failuresnobu
* win32/file.c (code_page_i): handle realloc failure. reported by Denis Denisov <denji0k AT gmail.com>. * win32/stub.c (stub_sysinit): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49023 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-12-24win32: suppress warningsnobu
* win32/file.c (home_dir, code_page_i): parenthesize to suppress warnings. * win32/win32.c (is_command_com, join_argv, w32_cmdvector, kill), (constat_attr_color_reverse, constat_attr): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48971 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-09-29win32/file.c: fix no user exceptionnobu
* win32/file.c (append_wstr): set expanded length, not length of appended string. fix "probable buffer overflow" bug. [ruby-core:65317] [Bug #10304] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47738 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-08-09win32/file.c: direct conversionnobu
* win32/file.c (user_length_in_path): count user name length in path. * win32/file.c (append_wstr): append WCHAR string to Ruby string directly without an intermediate buffer, if possible. * win32/file.c (rb_file_expand_path_internal): use above functions. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47118 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-08-09win32/file.c: share functions with win32.cnobu
* win32/file.c (rb_file_expand_path_internal, rb_file_load_ok): use functions defined in win32/win32.c. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47117 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-10-19win32/file.c: code page tablenobu
* win32/file.c (code_page): use simple array instead of st_table. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43363 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-10-19encoding.c: defer code page tablenobu
* encoding.c (rb_locale_encindex): defer initialization of win32 code page table until encoding db loaded. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43362 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-10-17file.c: fix memory leaknobu
* win32/file.c (rb_file_expand_path_internal): fix memory leaks at a non-absolute home exception. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43328 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-10-07win32/file.c: make mapping at initializationnobu
* win32/file.c (code_page_i, rb_w32_init_file): make encoding to code page mapping at initialization directly. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43169 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-10-07win32/file.c: use encoding indexnobu
* win32/file.c (code_page): use encoding index, which is primary entity, instead of encoding name. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43168 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-10-07win32/file.c: using st_tablenobu
* win32/file.c (code_page): cache using st_table, not RHash. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43166 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-10-07win32/file.c: check ASCII encodings firstnobu
* win32/file.c (code_page): check US-ASCII and ASCII-8bit before ordinary mapping. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43165 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-07-26win32/file.c: suppress warningnobu
* win32/file.c (convert_mb_to_wchar): omit never-true NULL check to suppress maybe-uninitialized warning in rb_file_load_ok(). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42191 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-07-26win32/file.c: fix target encodingnobu
* win32/file.c (fix_string_encoding): fix target encoding. the parameter `encoding' is not the target encoding but the original encoding. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42190 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-07-26win32/file.c: adjust indentnobu
* win32/file.c (get_user_from_path): adjust indent. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42189 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-07-26load.c: search in OS path encodingnobu
* load.c (rb_load_internal): use rb_load_file_str() to keep path encoding. * load.c (rb_require_safe): search in OS path encoding for Windows. * ruby.c (rb_load_file_str): load file with keeping path encoding. * win32/file.c (rb_file_load_ok): use WCHAR type API assuming incoming path is encoded in UTF-8. [ruby-core:56136] [Bug #8676] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42183 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-07-26win32/file.c: refine fix_string_encodingnobu
* win32/file.c (fix_string_encoding): simplify with rb_str_conv_enc(). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42180 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-07-26win32/file.c: refine convert_mb_to_wcharnobu
* win32/file.c (convert_mb_to_wchar): use bare pointer instead of VALUE, and remove useless argument. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42179 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-05-19fix typos. Patch by k_takata.ktsj
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40825 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-05-13* include/ruby/ruby.h: constify RBasic::klass and addko1
RBASIC_CLASS(obj) macro which returns a class of `obj'. This change is a part of RGENGC branch [ruby-trunk - Feature #8339]. * object.c: add new function rb_obj_reveal(). This function reveal interal (hidden) object by rb_obj_hide(). Note that do not change class before and after hiding. Only permitted example is: klass = RBASIC_CLASS(obj); rb_obj_hide(obj); .... rb_obj_reveal(obj, klass); TODO: API design. rb_obj_reveal() should be replaced with others. TODO: modify constified variables using cast may be harmful for compiler's analysis and optimizaton. Any idea to prohibt inserting RBasic::klass directly? If rename RBasic::klass and force to use RBASIC_CLASS(obj), then all codes such as `RBASIC(obj)->klass' will be compilation error. Is it acceptable? (We have similar experience at Ruby 1.9, for example "RARRAY(ary)->ptr" to "RARRAY_PTR(ary)". * internal.h: add some macros. * RBASIC_CLEAR_CLASS(obj) clear RBasic::klass to make it internal object. * RBASIC_SET_CLASS(obj, cls) set RBasic::klass. * RBASIC_SET_CLASS_RAW(obj, cls) same as RBASIC_SET_CLASS without write barrier (planned). * RCLASS_SET_SUPER(a, b) set super class of a. * array.c, class.c, compile.c, encoding.c, enum.c, error.c, eval.c, file.c, gc.c, hash.c, io.c, iseq.c, marshal.c, object.c, parse.y, proc.c, process.c, random.c, ruby.c, sprintf.c, string.c, thread.c, transcode.c, vm.c, vm_eval.c, win32/file.c: Use above macros and functions to access RBasic::klass. * ext/coverage/coverage.c, ext/readline/readline.c, ext/socket/ancdata.c, ext/socket/init.c, * ext/zlib/zlib.c: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40691 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-03-29* win32/file.c (code_page): use cp1252 instead of cp20127 as US-ASCII.usa
fix [ruby-core:53079] [Bug #7996] reported and patched by mmeltner (Michael Meltner). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40003 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-03-14Refactor rb_file_expand_path_internal for dir_string corner casesluislavena
* win32/file.c (get_user_from_path): add internal function that retrieves username from supplied path (refactored). * win32/file.c (rb_file_expand_path_internal): refactor expansion of user home to use get_user_from_path and cover dir_string corner cases. [ruby-core:53168] [Bug #8034] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39751 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-03-10Expand home directory when used in dir_stringluislavena
* win32/file.c (rb_file_expand_path_internal): Expand home directory when used as second parameter (dir_string). [ruby-core:53168] [Bug #8034] * test/ruby/test_file_exhaustive.rb: add test to verify. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39697 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-11-17Swap logic around wildcard character detectionluislavena
* win32/file.c (replace_to_long_name): correct logic around wildcard characters detection and ensure wide-chars are used as pattern. [ruby-core:49451] [Bug #7374] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37706 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-11-17Skip path expansion for all wildcard charactersluislavena
* win32/file.c (replace_to_long_name): skip expansion for all wildcard characters. [ruby-core:49451] [Bug #7374] * test/ruby/test_file_exhaustive.rb: add more assertions to test. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37700 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-11-16skip long name conversion if last character is a wildcard oneluislavena
* win32/file.c (replace_to_long_name): skip automatic path expansion when wildcard character is used. [ruby-core:49451] [Bug #7374] * test/ruby/test_file_exhaustive.rb: add a test for above. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37692 b2dd03c8-39d4-4d8f-98ff-823fe69b080e