• R/O
  • HTTP
  • SSH
  • HTTPS

提交

標籤
無標籤

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

Ruby GTK3移行後のメインリポジトリ


Commit MetaInfo

修訂e492695b5abb72679e6d58d99796a448bf1ad3b2 (tree)
時間2015-07-12 13:11:11
作者Shyouzou Sugitani <shy@user...>
CommiterShyouzou Sugitani

Log Message

assorted fixes(35)

Change Summary

差異

--- a/lib/ninix/dll.rb
+++ b/lib/ninix/dll.rb
@@ -43,12 +43,12 @@ module DLL
4343 end
4444 @dir = dir
4545 result = 0
46- if check_import != 0
46+ if check_import == 0
4747 #pass
4848 elsif @loaded != 0
4949 result = 2
5050 else
51- if setup() != 0
51+ if setup != 0
5252 @loaded = 1
5353 result = 1
5454 end
--- a/lib/ninix/dll/aya.rb
+++ b/lib/ninix/dll/aya.rb
@@ -409,7 +409,7 @@ module Aya
409409 elsif key == 'aitalkinterval' # Ver.3
410410 if not @global_namespace.exists('aitalkinterval')
411411 begin
412- value.to_i
412+ Integer(value)
413413 rescue
414414 Logging::Logging.debug(
415415 'Could not convert ' + value.to_s + ' to an integer')
@@ -419,9 +419,9 @@ module Aya
419419 end
420420 elsif key != nil and not key.empty?
421421 begin
422- value = value.to_i
422+ value = Integer(value)
423423 rescue
424- value = value
424+ value = value.to_s
425425 end
426426 @global_namespace.put(key, value)
427427 end
@@ -485,9 +485,9 @@ module Aya
485485 key, value = line.split(':', 2)
486486 key.strip!
487487 value.strip!
488- if value =~ /[[:digit:]]/
489- value = value.to_i
490- else
488+ begin
489+ value = Integer(value)
490+ rescue
491491 value = value.to_s
492492 end
493493 @req_key << key
@@ -1804,14 +1804,12 @@ module Aya
18041804 if var[0] == TYPE_ARRAY # _argv[n] only
18051805 index = evaluate_token(namespace, var[1][1])
18061806 begin
1807- index = index.to_i
1807+ index = Integer(index)
18081808 rescue
18091809 Logging::Logging.debug(
18101810 'index of array has to be integer: ' \
18111811 '' + var_name.to_s + '[' + var[1][1][0].to_s + ']')
18121812 return nil
1813- else
1814- index = nil
18151813 end
18161814 end
18171815 if value.is_a?(Fixnum) or value.is_a?(Float)
@@ -1899,7 +1897,7 @@ module Aya
18991897 index = evaluate_token(namespace, line[1][0])
19001898 inner_block = line[1][1]
19011899 begin
1902- index = index.to_i
1900+ index = Integer(index)
19031901 rescue
19041902 index = 0
19051903 end
@@ -1984,7 +1982,7 @@ module Aya
19841982 @nonoverlap[0] = list_
19851983 @nonoverlap[2] = []
19861984 end
1987- if not @nonoverlap[2]
1985+ if @nonoverlap[2].empty?
19881986 @nonoverlap[2] << ([0] * result.length)
19891987 while true
19901988 new = []
@@ -2040,7 +2038,7 @@ module Aya
20402038 else
20412039 index = evaluate_token(namespace, left[1][1])
20422040 begin
2043- index = index.to_i
2041+ index = Integer(index)
20442042 rescue
20452043 Logging::Logging.debug('Could not convert ' + index.to_s + ' to an integer')
20462044 else
@@ -2136,7 +2134,7 @@ module Aya
21362134 end
21372135 index = evaluate_token(namespace, token[1][1])
21382136 begin
2139- index = index.to_i
2137+ index = Integer(index)
21402138 rescue
21412139 Logging::Logging.debug(
21422140 'index of array has to be integer: ' + var_name.to_s + '[' + token[1][1].to_s + ']')
@@ -2172,7 +2170,7 @@ module Aya
21722170 end
21732171 index = evaluate_token(namespace, token[1][1])
21742172 begin
2175- index = index.to_i
2173+ index = Integer(index)
21762174 rescue
21772175 Logging::Logging.debug(
21782176 'index of array has to be integer: ' + var_name.to_s + '[' + token[1][1].to_s + ']')
@@ -2444,7 +2442,7 @@ module Aya
24442442 index_token = parse_token(line[startpoint + 2..endpoint-1])
24452443 index = evaluate_token(namespace, index_token)
24462444 begin
2447- index = index.to_i
2445+ index = Integer(index)
24482446 rescue
24492447 Logging::Logging.debug(
24502448 'illegal history index in the string(' + line + ')')
@@ -2576,11 +2574,11 @@ module Aya
25762574 line[endpoint + 1..end_of_block-1])
25772575 index = evaluate_token(namespace, index_token)
25782576 begin
2579- index = index.to_i
2577+ index = Integer(index)
25802578 rescue
25812579 have_index = false
2580+ index = nil
25822581 end
2583- index = nil
25842582 end
25852583 value = target_namespace.get(token, index)
25862584 if value != nil
@@ -3362,13 +3360,13 @@ module Aya
33623360 def REQUESTLIB(namespace, argv)
33633361 response = @aya.saori_library.request(
33643362 argv[0].to_s,
3365- argv[1].to_s.encode('Shift_JIS', 'ignore')) ## FIXME
3366- header = response.encode("UTF-8", :invalid => :replace, :undef => :replace).splitlines()
3363+ argv[1].to_s.encode('Shift_JIS', :invalid => :replace, :undef => :replace)) ## FIXME
3364+ header = response.encode("UTF-8", :invalid => :replace, :undef => :replace).split(/\r?\n/)
33673365 @saori_statuscode = ''
33683366 @saori_header = []
33693367 @saori_value = {}
33703368 @saori_protocol = ''
3371- if header
3369+ if header and not header.empty?
33723370 line = header.shift
33733371 line = line.strip()
33743372 if line.include?(' ')
--- a/lib/ninix/dll/bln.rb
+++ b/lib/ninix/dll/bln.rb
@@ -126,7 +126,7 @@ module Bln
126126 end
127127
128128 def execute(argument)
129- if not argument
129+ if not argument or argument.empty?
130130 return RESPONSE[400]
131131 end
132132 name = argument[0]
@@ -169,7 +169,7 @@ module Bln
169169 bln[bln_id].destroy()
170170 bln.delete(bln_id)
171171 end
172- if text
172+ if not text.empty?
173173 if update == 0 or not bln.include?(bln_id)
174174 bln[bln_id] = Balloon.new(@__sakura, @dir,
175175 data, text,
@@ -810,7 +810,7 @@ module Bln
810810 @text = [@text, @processed_text[0]].join("")
811811 draw_text(@text)
812812 @processed_text = @processed_text[1..-1]
813- @script_wait = time.time() + 0.014
813+ @script_wait = Time.now + 0.014
814814 end
815815 return
816816 end
--- a/lib/ninix/makoto.rb
+++ b/lib/ninix/makoto.rb
@@ -36,7 +36,7 @@ module Makoto
3636 if i + 1 < j and '(|)'.include?(s[i + 1])
3737 buf << s[i + 1]
3838 else
39- buf << s[i, i + 2]
39+ buf << s[i..i + 1]
4040 end
4141 i += 2
4242 elsif s[i] == '('
--- a/lib/ninix/sakura.rb
+++ b/lib/ninix/sakura.rb
@@ -317,15 +317,15 @@ module Sakura
317317 key, value = line.split(',', 2)
318318 key = key.strip()
319319 if key == 'time'
320- if value.strip() =~ /[[:digit:]]/
321- ghost_time = value.strip().to_i
322- else
320+ begin
321+ ghost_time = Integer(value.strip())
322+ rescue
323323 #pass
324324 end
325325 elsif key == 'vanished_count'
326- if value.strip() =~ /[[:digit:]]/
327- ghost_vanished_count = value.strip().to_i
328- else
326+ begin
327+ ghost_vanished_count = Integer(value.strip())
328+ rescue
329329 #pass
330330 end
331331 end
@@ -2343,14 +2343,11 @@ module Sakura
23432343 end
23442344
23452345 def __yen_exclamation(args) ## FIXME
2346- if not args.empty?
2346+ if args.empty?
23472347 return
23482348 end
23492349 argc = args.length
2350- args = []
2351- for s in args
2352- args << expand_meta(s)
2353- end
2350+ args = args.map {|s| expand_meta(s)}
23542351 if args[0] == 'raise' and argc >= 2
23552352 notify_event(*args[1, 9])
23562353 elsif args[0, 2] == ['open', 'readme']