Commit Graph

12 Commits

Author SHA1 Message Date
H. Peter Anvin
d46ac3c87d quote: use nasm_assert() instead of plain assert()
We have nasm_assert() now, so use it...

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2009-07-15 16:28:43 -04:00
H. Peter Anvin
13028a5a19 quote: we must do unsigned comparison to get length of octal escape
When computing the length of an octal escape, we need to do an
unsigned compare, otherwise we only allocate space for one character
for bytes in the \200..\377 range, which is obviously incorrect.

Reported-by: Ed Beroset <beroset@mindspring.com>
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2009-07-15 16:22:47 -04:00
H. Peter Anvin
466ba97d68 quote: don't use sprintf()
There is no point in using sprintf(), and it adds the possibility of
either bugs due to the output not matching what the byte count loop is
expecting, or just cause people to freak out due to the notion that
"sprinf is unsafe".

Reported-by: Ed Beroset <beroset@mindspring.com>
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2009-07-14 14:48:26 -04:00
H. Peter Anvin
9e6747ccac Add copyright headers to the *.c/*.h files in the main directory
Add copyright headers to the *.c/*.h files in the main directory.  For
files where I'm sure enough that we have all the approvals, I have
given them the 2-BSD license, the others have been given the "LGPL for
now" license header.  Most of them can probably be changed after
auditing.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2009-06-28 17:13:04 -07:00
H. Peter Anvin
312445a316 quote: fix termination condition for hexadecimal escapes
Fix reversed test for hexadecimal escape sequence termination.
2008-06-14 21:09:39 -07:00
H. Peter Anvin
88c9e1f88c Fix memory management issues with expanded %include
Ownership of the filename string was a bit fuzzy, with the result that
we were freeing it even though it was retained for use by __FILE__.
Clean up a number of other memory management issues with the new
quoting code, and change the stdscan implementation to one pass over
the string.
2008-06-04 11:26:59 -07:00
H. Peter Anvin
fbdd36cf72 quote: Change the definition of escp
Semi-arbitrary change of the definition of escp to the beginning of
the argument sequence instead of the initiator character.  This may
avoid an add in some code paths, and looks slightly cleaner to me.
2008-06-02 13:59:09 -07:00
H. Peter Anvin
2dff954903 quote: be consistent in not using C escapes for bytes
We used numbers in nasm_unquote and C escapes in nasm_quote - use
numbers in both places, just in case some C compiler does something
weird with '\r' and (especially) '\n'.
2008-06-02 10:38:54 -07:00
H. Peter Anvin
e46fec66ca nasm_unquote: make code a little more uniform
Make the code a bit more consistent:

- ndig is now always a countdown, and we always to the (p > escp+1)
  test to see if we got anything at all (this is to deal with stuff
  like \x without a digit.)
- Add missing break; after 'v' (bug!).
- Preinitialize nval to zero.
2008-06-02 10:02:36 -07:00
H. Peter Anvin
1df123bdbf quote: massively simplify nasm_skip_string()
Greatly simplify nasm_skip_string() by observing that for the purpose
of string skipping, all states other than st_backslash are equivalent
to st_start.
2008-06-02 09:57:46 -07:00
H. Peter Anvin
6ecc159a54 qstring: backquoted strings seem to work now...
Hopefully backquoted strings should work correctly now.
2008-06-01 21:34:49 -07:00
H. Peter Anvin
8cad14bbcf qstring: first cut at full quoted string support in the preprocessor
First attempt at properly handle quoted strings in the preprocessor.
This also adds range support in %substr.

No support in the assembler yet.
2008-06-01 17:23:51 -07:00