Skip to content

Commit 626e027

Browse files
committed
Replace Fixnum with Integer
Fixnum was deprecated in Ruby 2.5 and removed in Ruby 3.2. I'm not sure this is safe, as it is possible Fixnum was used deliberately instead of Integer, maybe because the integers were going to be passed to Tcl/Tk. However, from a partial review, it looks like the code was just using Fixnum instead of Integer. For example, the lib/tkextlib/iwidgets/notebook.rb change passes non-Fixnum instances directly to tk_send_without_enc, so the only change is that large negative integers are now changed to nil instead of being passed directly.
1 parent 5eede1c commit 626e027

File tree

7 files changed

+12
-12
lines changed

7 files changed

+12
-12
lines changed

MANUAL_tcltklib.ja

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ require "tcltklib" すると, 以下のモジュール, クラスが利用可能
135135
メソッド _return_value()
136136
直前の Tcl_Eval の戻り値を返します. 0(TCL_OK) で正常終了です.
137137
引数: 無し
138-
戻り値 (Fixnum): 直前の Tcl_Eval() が返した値.
138+
戻り値 (Integer): 直前の Tcl_Eval() が返した値.
139139

140140
==============================================================
141141

lib/multi-tk.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1279,7 +1279,7 @@ def initialize(master, safeip=true, keys={})
12791279

12801280
name, safe, safe_opts, tk_opts = _parse_slaveopts(keys)
12811281

1282-
safe = 1 if safe && !safe.kind_of?(Fixnum)
1282+
safe = 1 if safe && !safe.kind_of?(Integer)
12831283

12841284
@safe_base = false
12851285

lib/tkextlib/iwidgets/notebook.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ def yscrollbar(bar=nil)
150150
def view(*idxs)
151151
if idxs.size == 0
152152
idx = num_or_str(tk_send_without_enc('view'))
153-
if idx.kind_of?(Fixnum) && idx < 0
153+
if idx.kind_of?(Integer) && idx < 0
154154
nil
155155
else
156156
idx

lib/tkextlib/iwidgets/tabnotebook.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ def yscrollbar(bar=nil)
156156
def view(*index)
157157
if index.size == 0
158158
idx = num_or_str(tk_send_without_enc('view'))
159-
if idx.kind_of?(Fixnum) && idx < 0
159+
if idx.kind_of?(Integer) && idx < 0
160160
nil
161161
else
162162
idx

lib/tkextlib/tcllib/tablelist_core.rb

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -482,15 +482,15 @@ def configrows(*args) # args ==> idx, opt, val, idx, opt, val, ...
482482

483483
def containing(y)
484484
idx = num_or_str(tk_send('containing', y))
485-
(idx.kind_of?(Fixnum) && idx < 0)? nil: idx
485+
(idx.kind_of?(Integer) && idx < 0)? nil: idx
486486
end
487487

488488
def containing_cell(x, y)
489489
idx = _from_idx(tk_send('containingcell', x, y))
490490
if idx.kind_of?(Array)
491491
[
492-
((idx[0].kind_of?(Fixnum) && idx[0] < 0)? nil: idx[0]),
493-
((idx[1].kind_of?(Fixnum) && idx[1] < 0)? nil: idx[1])
492+
((idx[0].kind_of?(Integer) && idx[0] < 0)? nil: idx[0]),
493+
((idx[1].kind_of?(Integer) && idx[1] < 0)? nil: idx[1])
494494
]
495495
else
496496
idx
@@ -500,7 +500,7 @@ def containing_cell(x, y)
500500

501501
def containing_column(x)
502502
idx = num_or_str(tk_send('containingcolumn', x))
503-
(idx.kind_of?(Fixnum) && idx < 0)? nil: idx
503+
(idx.kind_of?(Integer) && idx < 0)? nil: idx
504504
end
505505
alias containingcolumn containing_column
506506

@@ -889,7 +889,7 @@ def sort_by_columnlist(idxlist, orderlist=None)
889889

890890
def sortcolumn
891891
idx = num_or_str(tk_send('sortcolumn'))
892-
(idx.kind_of?(Fixnum) && idx < 0)? nil: idx
892+
(idx.kind_of?(Integer) && idx < 0)? nil: idx
893893
end
894894

895895
def sortcolumnlist

lib/tkextlib/treectrl/tktreectrl.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1170,7 +1170,7 @@ def item_order(item, visible=false)
11701170
ret = num_or_str(tk_send('item', 'order', item))
11711171
end
11721172

1173-
(ret.kind_of?(Fixnum) && ret < 0)? nil: ret
1173+
(ret.kind_of?(Integer) && ret < 0)? nil: ret
11741174
end
11751175
def item_visible_order(item)
11761176
item_order(item, true)

sample/tktextio.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -596,7 +596,7 @@ def printf(*args)
596596

597597
def putc(c)
598598
_check_writable
599-
c = c.chr if c.kind_of?(Fixnum)
599+
c = c.chr if c.kind_of?(Integer)
600600
_write(c)
601601
c
602602
end
@@ -854,7 +854,7 @@ def ungetc(c)
854854
end
855855

856856
_check_readable
857-
c = c.chr if c.kind_of?(Fixnum)
857+
c = c.chr if c.kind_of?(Integer)
858858
if compare(@txtpos, '>', '1.0')
859859
@txtpos.set(@txtpos - '1 char')
860860
delete(@txtpos)

0 commit comments

Comments
 (0)