aboutsummaryrefslogtreecommitdiffstats
path: root/win32/file.c
Commit message (Collapse)AuthorAgeFilesLines
* win32: Use UTF-8 as filesystem encoding [Feature #12654]Nobuyoshi Nakada2020-12-201-1/+1
| | | | Co-Authored-By: Dāvis Mosāns <davispuh@gmail.com>
* Use https instead of httpKazuhiro NISHIYAMA2020-07-281-1/+1
|
* Get rid of redefinition of memcpy on mingwNobuyoshi Nakada2020-05-261-1/+1
|
* Include wchar.h before wrapping memchrNobuyoshi Nakada2020-05-191-1/+1
| | | | | | | | | | | | | On mingw, wmemcpy() is defined as an inline function using memcpy(), and the static inline wrapper causes a warning. ``` In file included from include/ruby/ruby.h:39, from win32/file.c:5: include/ruby/internal/memory.h:284:16: warning: 'ruby_nonempty_memcpy' is static but used in inline function 'wmemcpy' which is not static 284 | #define memcpy ruby_nonempty_memcpy | ^~~~~~~~~~~~~~~~~~~~ ```
* decouple internal.h headers卜部昌平2019-12-261-0/+1
| | | | | | | | | | | | | | | | | | Saves comitters' daily life by avoid #include-ing everything from internal.h to make each file do so instead. This would significantly speed up incremental builds. We take the following inclusion order in this changeset: 1. "ruby/config.h", where _GNU_SOURCE is defined (must be the very first thing among everything). 2. RUBY_EXTCONF_H if any. 3. Standard C headers, sorted alphabetically. 4. Other system headers, maybe guarded by #ifdef 5. Everything else, sorted alphabetically. Exceptions are those win32-related headers, which tend not be self- containing (headers have inclusion order dependencies).
* Fixed misspellingsNobuyoshi Nakada2019-12-201-1/+1
| | | | Fixed misspellings reported at [Bug #16437], only in ruby and rubyspec.
* FindFirstFile cannot glob share namesnobu2019-03-041-0/+14
| | | | | | | | * win32/file.c (replace_to_long_name): do not try to glob host names and share names by FindFirstFile which is useless for that purpose. [ruby-core:91656] [Bug #15633] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67163 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* removed never used variablenobu2018-04-031-4/+0
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63066 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* win32/file.c: relative path with drive letternobu2018-03-281-3/+12
| | | | | | | | * win32/file.c (IS_ABSOLUTE_PATH_P): home directory should not be a relative path regardless a drive letter. PathIsRelativeW returns FALSE on such path. [ruby-core:86356] [Bug #14638] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62952 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* const pointer is not able to be free.usa2016-12-071-1/+1
| | | | | | | * win32/file.c (rb_default_home_dir): should not be marked as const. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57007 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* file.c: home directory from systemnobu2016-11-261-0/+13
| | | | | | | * file.c (rb_default_home_dir): resolve home directory from the system database when HOME is not set. [Feature #12695] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56902 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* win32.c: special folders as home dirnobu2016-11-261-67/+2
| | | | | | | * win32/win32.c (rb_w32_home_dir): move from win32/file.c to try special folders. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56901 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* win32/file.c: use ALLOC_Nnobu2016-08-251-4/+4
| | | | | | | | | * win32/file.c (home_dir, replace_to_long_name): use ALLOC_N instead of casted xmalloc with multiplication. win32/file.c (rb_file_expand_path_internal): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56008 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* win32/file.h: rb_w32_filecpnobu2016-08-251-3/+0
| | | | | | * win32/file.h (rb_w32_filecp): add declaration. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56007 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* win32/file.c: remove a codepage argumentnobu2016-08-241-10/+9
| | | | | | | * win32/file.c (append_wstr): remove a codepage argument, and use INVALID_CODE_PAGE for conversion by econv. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56006 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* win32/file.c: fix result lengthnobu2016-08-241-1/+2
| | | | | | | * win32/file.c (append_wstr): exclude the terminator from the result length when input len == -1. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56004 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* win32/file.c: use enumnobu2016-08-241-23/+16
| | | | | | * win32/file.c (home_dir): use enum instead of magic numbers. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56000 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* win32/file.c: fix reallocation thresholdnobu2016-04-281-5/+8
| | | | | | | * 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
* win32/file.c: remove unnecessary codenobu2016-04-281-9/+4
| | | | | | | * 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
* * file.c, win32/file.c: Removed obsoleted safe level checks.hsbt2016-04-221-1/+1
| | | | | | [fix GH-1327] Patch by @cremno git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54668 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* win32/file.c: fix freenobu2016-04-101-4/+4
| | | | | | | | * 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
* win32/file.c: drop garbagenobu2016-01-291-0/+1
| | | | | | | | | * 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
* * win32/win32.c (fileattr_to_unixmode, rb_w32_reparse_symlink_p): volumeusa2016-01-291-1/+4
| | | | | | | | | | | | | | 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
* file.c: non-blocking opennobu2015-10-161-11/+3
| | | | | | | | | | * 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
* file.c: use filesystem encodingnobu2015-09-021-2/+2
| | | | | | | | * 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
* win32: use ALLOCVnobu2015-09-021-5/+6
| | | | | | | | | | * 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
* win32.c: rb_w32_reparsenobu2015-08-251-7/+19
| | | | | | | * 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
* win32/file.c: use allocv buffer and APInobu2015-08-021-4/+9
| | | | | | | | * 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
* file.c: _wfreopen_s on mingwnobu2015-07-031-0/+4
| | | | | | | * 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
* file.c: not xfreenobu2015-06-301-1/+1
| | | | | | | * 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
* * win32/file.c (rb_freopen): remove debug code.usa2015-06-301-1/+0
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51071 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * win32/file.c (rb_freopen): need to terminate by NUL.usa2015-06-301-1/+4
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51070 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* io.c: reopen OS encoding pathnobu2015-06-301-0/+22
| | | | | | | | | * 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
* * include/ruby/ruby.h: $SAFE=2 is now obsolete.hsbt2015-06-181-1/+0
| | | | | | | | | | * 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
* file.c: open without gvlnobu2015-06-141-3/+11
| | | | | | | * 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
* file.c: include terminatornobu2015-03-301-1/+2
| | | | | | | | * 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
* file.c: move rb_readlink on Windowsnobu2015-03-231-0/+29
| | | | | | | * 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
* file.c: check arguments lengthsnobu2015-03-221-2/+17
| | | | | | | * 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
* win32/file.c: fix drive letternobu2015-02-181-0/+1
| | | | | | | | | * 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
* win32/file.c: fix drive letternobu2015-02-171-6/+7
| | | | | | | | * 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
* never-NULL pointer checknobu2014-12-261-1/+1
| | | | | | | | * 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
* win32: realloc failuresnobu2014-12-261-2/+5
| | | | | | | | * 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
* win32: suppress warningsnobu2014-12-241-5/+5
| | | | | | | | | | * 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
* win32/file.c: fix no user exceptionnobu2014-09-291-8/+8
| | | | | | | | * 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
* win32/file.c: direct conversionnobu2014-08-091-47/+38
| | | | | | | | | | | | * 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
* win32/file.c: share functions with win32.cnobu2014-08-091-57/+32
| | | | | | | * 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
* win32/file.c: code page tablenobu2013-10-191-10/+23
| | | | | | * 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
* encoding.c: defer code page tablenobu2013-10-191-1/+1
| | | | | | | * 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
* file.c: fix memory leaknobu2013-10-171-0/+2
| | | | | | | * 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
* win32/file.c: make mapping at initializationnobu2013-10-071-29/+20
| | | | | | | * 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