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

!uc-def:lines - remove usage of file.tell() - this is buggy on windows #43

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

alexrayne
Copy link

on windows file.tell() ,i guess, makes 1byte ovehead on each line. therefore reposition to line begin is broken.
now read whole file and split to lines at once. it is risky for memory, but we not intends use infinite definitions.

! :unsigned longs - now bit-masks are use 'ul' suffix if it is larger 16bit. it away some compile warnings about integers arith overload, and integer sign chages

…s.(i guess it 1byte ovehead on each line.).

        now read whole file and split to lines at once. it is risky for memory, but we not intends use infinite definitions.
!       :unsigned longs - now bit-masks are use 'ul' suffix if it is larger 16bit. it away some compile warnings about
                integers arith overload, and integer sign chages
@@ -47,10 +47,19 @@ def verify_access_flags(data):
raise Exception("'%c' flag of flags '%s' not valid" % (i, data))

def next_useful_line(tag, strip_newline=True, strip_comment=True):
if not ('input_lines' in tag):
tag['input_lines'] = tag['input_file'].readlines()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we can parse the file in stream style, why would we go for read the whole content to memory file.
file.tell() - this is buggy on windows any pointer on the specific problem?
also, i guess it 1byte ovehead on each line. if we talk of overhead, we should convert the script in C program.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i dont want spend my time making bugreport and testsuit to python.
short: on my winXP git has checkoput .ucf with linux \n lienends. looks like python string engine converts somehow internaly to windows \r\n lineneds. therefore tell() counts 1 more byte per string. after 20 strings tell() position points after actual string begin about 20bytes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants