Граф коммитов

66 Коммитов

Автор SHA1 Сообщение Дата
nobu 5bcb76ebbd removed never used variable
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63066 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-04-03 06:25:10 +00:00
nobu ebf5348528 win32/file.c: relative path with drive letter
* 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
2018-03-28 07:01:48 +00:00
usa 3826f17790 const pointer is not able to be free.
* 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
2016-12-07 02:03:40 +00:00
nobu 6b88dd2698 file.c: home directory from system
* 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
2016-11-26 11:37:01 +00:00
nobu 58742627af win32.c: special folders as home dir
* 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
2016-11-26 11:37:01 +00:00
nobu 8e0601b7e5 win32/file.c: use ALLOC_N
* 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
2016-08-25 02:57:41 +00:00
nobu 70d840afd5 win32/file.h: rb_w32_filecp
* 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
2016-08-25 02:11:19 +00:00
nobu 638f67211b win32/file.c: remove a codepage argument
* 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
2016-08-24 15:42:33 +00:00
nobu b34321a221 win32/file.c: fix result length
* 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
2016-08-24 15:39:52 +00:00
nobu a3b84cff15 win32/file.c: use enum
* 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
2016-08-24 13:04:36 +00:00
nobu 9ef7c87d67 win32/file.c: fix reallocation threshold
* 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-28 06:54:05 +00:00
nobu 1e775c18e5 win32/file.c: remove unnecessary code
* 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-28 06:54:03 +00:00
hsbt 48d22f8360 * file.c, win32/file.c: Removed obsoleted safe level checks.
[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-22 01:43:31 +00:00
nobu 75dc429f3e win32/file.c: fix free
* 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-04-10 07:30:42 +00:00
nobu ec943ac668 win32/file.c: drop garbage
* 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 08:41:10 +00:00
usa 47f6196cf0 * win32/win32.c (fileattr_to_unixmode, rb_w32_reparse_symlink_p): volume
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
2016-01-29 08:13:42 +00:00
nobu abf832f435 file.c: non-blocking open
* 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-10-16 06:54:38 +00:00
nobu f9ac2106bf file.c: use filesystem encoding
* 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-02 07:58:24 +00:00
nobu 6bbd9104cb win32: use ALLOCV
* 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-09-02 04:14:42 +00:00
nobu 2f6fdd3aeb win32.c: rb_w32_reparse
* 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-25 05:11:19 +00:00
nobu e60d35e302 win32/file.c: use allocv buffer and API
* 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-08-02 05:15:02 +00:00
nobu 3e5988b29d file.c: _wfreopen_s on mingw
* 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-07-03 05:30:21 +00:00
nobu 24a72a177d file.c: not xfree
* 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 14:04:00 +00:00
usa b4718bf4f0 * win32/file.c (rb_freopen): remove debug code.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51071 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-06-30 09:41:40 +00:00
usa 3e01334fae * win32/file.c (rb_freopen): need to terminate by NUL.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51070 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-06-30 09:38:51 +00:00
nobu 93446fedd3 io.c: reopen OS encoding path
* 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-30 08:28:28 +00:00
hsbt 5d6ca9e950 * include/ruby/ruby.h: $SAFE=2 is now obsolete.
* 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-18 14:21:03 +00:00
nobu 0b3ef899f2 file.c: open without gvl
* 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-06-14 08:20:43 +00:00
nobu 5dc51d821e file.c: include terminator
* 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-30 05:27:21 +00:00
nobu 2ffb87995a file.c: move rb_readlink on Windows
* 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-23 12:22:10 +00:00
nobu cfa3ebf47c file.c: check arguments lengths
* 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-03-22 04:54:35 +00:00
nobu 0998c2dd06 win32/file.c: fix drive letter
* 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-18 16:58:13 +00:00
nobu f7a73f3e8b win32/file.c: fix drive letter
* 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
2015-02-17 01:53:32 +00:00
nobu 859f3d14ed never-NULL pointer check
* 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-26 05:51:36 +00:00
nobu ea9ff28f80 win32: realloc failures
* 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-26 05:48:12 +00:00
nobu fa13cb050d win32: suppress warnings
* 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-12-24 10:18:35 +00:00
nobu edae1c7200 win32/file.c: fix no user exception
* 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-09-29 13:54:50 +00:00
nobu 8f0543a364 win32/file.c: direct conversion
* 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-09 11:50:13 +00:00
nobu b136c5cd48 win32/file.c: share functions with win32.c
* 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
2014-08-09 10:10:11 +00:00
nobu cb4b55d3d8 win32/file.c: code page table
* 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-19 10:59:06 +00:00
nobu eeb3156eca encoding.c: defer code page table
* 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-19 10:55:39 +00:00
nobu 36862468a8 file.c: fix memory leak
* 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-17 05:21:38 +00:00
nobu 6531e12e0b win32/file.c: make mapping at initialization
* 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-07 07:20:59 +00:00
nobu 98e4a412e4 win32/file.c: use encoding index
* 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-07 06:50:18 +00:00
nobu 6d07beb4c1 win32/file.c: using st_table
* 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-07 06:28:11 +00:00
nobu 1c7b42e2bc win32/file.c: check ASCII encodings first
* 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-10-07 06:09:01 +00:00
nobu 48443714b7 win32/file.c: suppress warning
* 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-26 08:50:33 +00:00
nobu c4c78f758f win32/file.c: fix target encoding
* 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-26 08:49:31 +00:00
nobu e9b8488fe5 win32/file.c: adjust indent
* 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-26 06:43:33 +00:00
nobu 8948280c67 load.c: search in OS path encoding
* 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-26 04:04:23 +00:00