Apply fixes to preproc for Windows compatibility
This commit is contained in:
@@ -679,7 +679,7 @@ void AsmFile::RaiseWarning(const char* format, ...)
|
|||||||
int AsmFile::SkipWhitespaceAndEol()
|
int AsmFile::SkipWhitespaceAndEol()
|
||||||
{
|
{
|
||||||
int newlines = 0;
|
int newlines = 0;
|
||||||
while (m_buffer[m_pos] == '\t' || m_buffer[m_pos] == ' ' || m_buffer[m_pos] == '\n')
|
while (m_buffer[m_pos] == '\t' || m_buffer[m_pos] == ' ' || m_buffer[m_pos] == '\r' || m_buffer[m_pos] == '\n')
|
||||||
{
|
{
|
||||||
if (m_buffer[m_pos] == '\n')
|
if (m_buffer[m_pos] == '\n')
|
||||||
newlines++;
|
newlines++;
|
||||||
|
|||||||
@@ -26,6 +26,11 @@
|
|||||||
#include "c_file.h"
|
#include "c_file.h"
|
||||||
#include "charmap.h"
|
#include "charmap.h"
|
||||||
|
|
||||||
|
#ifdef _WIN32
|
||||||
|
#include <io.h>
|
||||||
|
#include <fcntl.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
static void UsageAndExit(const char *program);
|
static void UsageAndExit(const char *program);
|
||||||
|
|
||||||
Charmap* g_charmap;
|
Charmap* g_charmap;
|
||||||
@@ -179,6 +184,11 @@ int main(int argc, char **argv)
|
|||||||
|
|
||||||
g_charmap = new Charmap(charmap);
|
g_charmap = new Charmap(charmap);
|
||||||
|
|
||||||
|
#ifdef _WIN32
|
||||||
|
// On Windows, piping from stdout can break newlines. Treat stdout as binary stream to avoid this.
|
||||||
|
_setmode(_fileno(stdout), _O_BINARY);
|
||||||
|
#endif
|
||||||
|
|
||||||
const char* extension = GetFileExtension(source);
|
const char* extension = GetFileExtension(source);
|
||||||
|
|
||||||
if (!extension)
|
if (!extension)
|
||||||
|
|||||||
Reference in New Issue
Block a user