Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add an EOF check #2

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions lib/gedcom.rb
Original file line number Diff line number Diff line change
Expand Up @@ -132,10 +132,10 @@ def concat_data tag, rest
@dataStack[-1] << rest
else
if tag == 'CONT'
@dataStack[-1] << "\n" + rest
@dataStack[-1] << "\n" + (rest || "")
elsif tag == 'CONC'
old = @dataStack[-1].chomp
@dataStack[-1] = old + rest
@dataStack[-1] = old + (rest || "")
end
end
end
Expand Down Expand Up @@ -167,7 +167,7 @@ def detect_rs io
rs = "\x0d"
mark = io.pos
begin
while ch = io.readchar
while !io.eof && ch = io.readchar
case ch
when 0x0d
ch2 = io.readchar
Expand Down
4 changes: 2 additions & 2 deletions lib/gedcom_date_parser.rb
Original file line number Diff line number Diff line change
Expand Up @@ -733,7 +733,7 @@ def self.parse_date_part( parser, datePart, type )
end
end

state = ST_DT_ERROR if( !transitionFound )
state = ST_DT_ERROR if( transitionFound == 0 )
end

raise DateParseException, "error parsing datepart, general" if( state == ST_DT_ERROR )
Expand Down Expand Up @@ -899,7 +899,7 @@ def self.parse_gedcom_date( dateString, date, type = GCTDEFAULT )
end
end

state = ST_DV_ERROR if( !transitionFound )
state = ST_DV_ERROR if( transitionFound == 0 )
end

if( state == ST_DV_ERROR )
Expand Down