Author: janderwald
Date: Tue Oct 24 15:27:23 2006
New Revision: 24642
URL:
http://svn.reactos.org/svn/reactos?rev=24642&view=rev
Log:
- set svn:eol-style properties
- update makefile
- fix warning
Modified:
trunk/reactos/tools/sysreg/file_reader.cpp (contents, props changed)
trunk/reactos/tools/sysreg/file_reader.h (contents, props changed)
trunk/reactos/tools/sysreg/sysreg.mak
trunk/reactos/tools/sysreg/user_types.h (contents, props changed)
Modified: trunk/reactos/tools/sysreg/file_reader.cpp
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/tools/sysreg/file_reader.c…
==============================================================================
--- trunk/reactos/tools/sysreg/file_reader.cpp (original)
+++ trunk/reactos/tools/sysreg/file_reader.cpp Tue Oct 24 15:27:23 2006
@@ -1,168 +1,168 @@
-/* $Id: pipe_reader.cpp 24589 2006-10-21 08:34:00Z janderwald $
- *
- * PROJECT: System regression tool for ReactOS
- * LICENSE: GPL - See COPYING in the top level directory
- * FILE: tools/sysreg/conf_parser.h
- * PURPOSE: file reading support
- * PROGRAMMERS: Johannes Anderwald (johannes.anderwald at sbox tugraz at)
- */
-
-#include "file_reader.h"
-#include <assert.h>
-
-namespace System_
-{
-//---------------------------------------------------------------------------------------
- FileReader::FileReader() : m_File(NULL)
- {
- }
-//---------------------------------------------------------------------------------------
- FileReader::~FileReader()
- {
- }
-//---------------------------------------------------------------------------------------
- bool FileReader::openFile(TCHAR const * filename)
- {
-#ifdef UNICODE
- m_File = _tfopen(filename, _T("rb,ccs=UNICODE"));
-#else
- m_File = _tfopen(filename, _T("rb"));
-#endif
-
- if (m_File)
- {
- return true;
- }
- else
- {
- return false;
- }
- }
-//---------------------------------------------------------------------------------------
- bool FileReader::closeFile()
- {
- if (!m_File)
- {
- return false;
- }
-
- if (!fclose(m_File))
- {
- m_File = NULL;
- return true;
- }
-
- return false;
- }
-//---------------------------------------------------------------------------------------
- bool FileReader::readFile(vector<string> & lines)
- {
- if (!m_File)
- {
- return false;
- }
-
- bool ret = true;
- size_t total_length = 0;
- size_t line_count = lines.size();
- size_t num = 0;
- char szBuffer[256];
- int readoffset = 0;
-
-#ifdef UNICODE
- wchar_t wbuf[512];
- int wbuf_offset = 0;
-
- if (m_BufferedLines.length ())
- {
- wcscpy(wbuf, m_BufferedLines.c_str ());
- wbuf_offset = m_BufferedLines.length ();
- }
-#else
- if (m_BufferedLines.length())
- {
- strcpy(szBuffer, m_BufferedLines.c_str());
- readoffset = m_BufferedLines.length();
- }
-#endif
-
- do
- {
- if (total_length < num)
- {
-#ifdef UNICODE
- memmove(wbuf, &wbuf[total_length], (num - total_length) * sizeof(wchar_t));
- wbuf_offset = num - total_length;
-#else
- memmove(szBuffer, &szBuffer[total_length], num - total_length);
- readoffset = num - total_length;
-#endif
- }
-
- num = fread(&szBuffer[readoffset],
- sizeof(char), sizeof(szBuffer)/sizeof(char) - (readoffset+1) * sizeof(char),
- m_File);
-
- szBuffer[num] = L'\0';
-
- if (!num)
- {
- if (line_count == lines.size ())
- {
- ret = false;
- }
- break;
- }
- TCHAR * ptr;
-#ifdef UNICODE
- int i = 0;
- int conv;
- while((conv = mbtowc(&wbuf[wbuf_offset+i], &szBuffer[i], num)))
- {
- i += conv;
- if (i == num)
- break;
-
- assert(wbuf_offset + i < 512);
- }
- wbuf[wbuf_offset + num] = L'\0';
-
- TCHAR * offset = wbuf;
-#else
-
- TCHAR * offset = szBuffer;
-#endif
- total_length = 0;
- while(ptr = _tcsstr(offset, _T("\x0D\x0A")))
- {
- int length = ((unsigned)ptr - (unsigned)offset);
- length /= sizeof(TCHAR);
-
- offset[length] = L'\0';
-
- string line = offset;
- lines.push_back (line);
-
- offset += length + 2;
- total_length += length + 2;
-
- if (total_length == num)
- {
- break;
- }
- }
- }while(num );
-
- if (total_length < num)
- {
-#ifdef UNICODE
- m_BufferedLines = &wbuf[total_length];
-#else
- m_BufferedLines = &szBuffer[total_length];
-#endif
- }
-
- return ret;
- }
-
-} // end of namespace System_
+/* $Id$
+ *
+ * PROJECT: System regression tool for ReactOS
+ * LICENSE: GPL - See COPYING in the top level directory
+ * FILE: tools/sysreg/conf_parser.h
+ * PURPOSE: file reading support
+ * PROGRAMMERS: Johannes Anderwald (johannes.anderwald at sbox tugraz at)
+ */
+
+#include "file_reader.h"
+#include <assert.h>
+
+namespace System_
+{
+//---------------------------------------------------------------------------------------
+ FileReader::FileReader() : m_File(NULL)
+ {
+ }
+//---------------------------------------------------------------------------------------
+ FileReader::~FileReader()
+ {
+ }
+//---------------------------------------------------------------------------------------
+ bool FileReader::openFile(TCHAR const * filename)
+ {
+#ifdef UNICODE
+ m_File = _tfopen(filename, _T("rb,ccs=UNICODE"));
+#else
+ m_File = _tfopen(filename, _T("rb"));
+#endif
+
+ if (m_File)
+ {
+ return true;
+ }
+ else
+ {
+ return false;
+ }
+ }
+//---------------------------------------------------------------------------------------
+ bool FileReader::closeFile()
+ {
+ if (!m_File)
+ {
+ return false;
+ }
+
+ if (!fclose(m_File))
+ {
+ m_File = NULL;
+ return true;
+ }
+
+ return false;
+ }
+//---------------------------------------------------------------------------------------
+ bool FileReader::readFile(vector<string> & lines)
+ {
+ if (!m_File)
+ {
+ return false;
+ }
+
+ bool ret = true;
+ size_t total_length = 0;
+ size_t line_count = lines.size();
+ size_t num = 0;
+ char szBuffer[256];
+ int readoffset = 0;
+
+#ifdef UNICODE
+ wchar_t wbuf[512];
+ int wbuf_offset = 0;
+
+ if (m_BufferedLines.length ())
+ {
+ wcscpy(wbuf, m_BufferedLines.c_str ());
+ wbuf_offset = m_BufferedLines.length ();
+ }
+#else
+ if (m_BufferedLines.length())
+ {
+ strcpy(szBuffer, m_BufferedLines.c_str());
+ readoffset = m_BufferedLines.length();
+ }
+#endif
+
+ do
+ {
+ if (total_length < num)
+ {
+#ifdef UNICODE
+ memmove(wbuf, &wbuf[total_length], (num - total_length) * sizeof(wchar_t));
+ wbuf_offset = num - total_length;
+#else
+ memmove(szBuffer, &szBuffer[total_length], num - total_length);
+ readoffset = num - total_length;
+#endif
+ }
+
+ num = fread(&szBuffer[readoffset],
+ sizeof(char), sizeof(szBuffer)/sizeof(char) - (readoffset+1) * sizeof(char),
+ m_File);
+
+ szBuffer[num] = L'\0';
+
+ if (!num)
+ {
+ if (line_count == lines.size ())
+ {
+ ret = false;
+ }
+ break;
+ }
+ TCHAR * ptr;
+#ifdef UNICODE
+ int i = 0;
+ int conv;
+ while((conv = mbtowc(&wbuf[wbuf_offset+i], &szBuffer[i], num)))
+ {
+ i += conv;
+ if (i == num)
+ break;
+
+ assert(wbuf_offset + i < 512);
+ }
+ wbuf[wbuf_offset + num] = L'\0';
+
+ TCHAR * offset = wbuf;
+#else
+
+ TCHAR * offset = szBuffer;
+#endif
+ total_length = 0;
+ while(ptr = _tcsstr(offset, _T("\x0D\x0A")))
+ {
+ int length = ((unsigned)ptr - (unsigned)offset);
+ length /= sizeof(TCHAR);
+
+ offset[length] = L'\0';
+
+ string line = offset;
+ lines.push_back (line);
+
+ offset += length + 2;
+ total_length += length + 2;
+
+ if (total_length == num)
+ {
+ break;
+ }
+ }
+ }while(num );
+
+ if (total_length < num)
+ {
+#ifdef UNICODE
+ m_BufferedLines = &wbuf[total_length];
+#else
+ m_BufferedLines = &szBuffer[total_length];
+#endif
+ }
+
+ return ret;
+ }
+
+} // end of namespace System_
Propchange: trunk/reactos/tools/sysreg/file_reader.cpp
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: trunk/reactos/tools/sysreg/file_reader.cpp
------------------------------------------------------------------------------
svn:keywords = author date id revision
Modified: trunk/reactos/tools/sysreg/file_reader.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/tools/sysreg/file_reader.h…
==============================================================================
--- trunk/reactos/tools/sysreg/file_reader.h (original)
+++ trunk/reactos/tools/sysreg/file_reader.h Tue Oct 24 15:27:23 2006
@@ -1,91 +1,91 @@
-#ifndef FILE_READER_H__
-#define FILE_READER_H__
-
-/* $Id: pipe_reader.h 24587 2006-10-20 21:14:08Z janderwald $
- *
- * PROJECT: System regression tool for ReactOS
- * LICENSE: GPL - See COPYING in the top level directory
- * FILE: tools/sysreg/conf_parser.h
- * PURPOSE: pipe reader support
- * PROGRAMMERS: Johannes Anderwald (johannes.anderwald at sbox tugraz at)
- */
-
-
-#include "user_types.h"
-
-#include <vector>
-
-namespace System_
-{
- using std::vector;
-//---------------------------------------------------------------------------------------
-///
-/// class FileReader
-///
-/// Description: this class implements reading from a file
-
- class FileReader
- {
- public:
-//---------------------------------------------------------------------------------------
-///
-/// FileReader
-///
-/// Description: constructor of class FileReader
-
- FileReader();
-
-//---------------------------------------------------------------------------------------
-///
-/// ~FileReader
-///
-/// Description: destructor of class FileReader
-
- virtual ~FileReader();
-
-//---------------------------------------------------------------------------------------
-///
-/// openFile
-///
-/// Description: attempts to open a file. Returns true on success
-///
-/// @param filename name of the file to open
-/// @return bool
-
- bool openFile(TCHAR const * filename);
-
-//---------------------------------------------------------------------------------------
-///
-/// closeFile
-///
-/// Description: attempts to close a file. Returns true on success
-///
-/// @return bool
-
- bool closeFile();
-
-//---------------------------------------------------------------------------------------
-///
-/// readFile
-///
-/// Description: reads from file. The result is stored in a vector of strings
-///
-/// Note: returns true on success
-///
-
- bool readFile(vector<string> & lines);
-
-
-
- protected:
- FILE * m_File;
- string m_BufferedLines;
-
-
- }; // end of class FileReader
-
-
-} // end of namespace System_
-
-
-#endif /* end of FILE_READER_H__ */
+#ifndef FILE_READER_H__
+#define FILE_READER_H__
+
+/* $Id$
+ *
+ * PROJECT: System regression tool for ReactOS
+ * LICENSE: GPL - See COPYING in the top level directory
+ * FILE: tools/sysreg/conf_parser.h
+ * PURPOSE: pipe reader support
+ * PROGRAMMERS: Johannes Anderwald (johannes.anderwald at sbox tugraz at)
+ */
+
+
+#include "user_types.h"
+
+#include <vector>
+
+namespace System_
+{
+ using std::vector;
+//---------------------------------------------------------------------------------------
+///
+/// class FileReader
+///
+/// Description: this class implements reading from a file
+
+ class FileReader
+ {
+ public:
+//---------------------------------------------------------------------------------------
+///
+/// FileReader
+///
+/// Description: constructor of class FileReader
+
+ FileReader();
+
+//---------------------------------------------------------------------------------------
+///
+/// ~FileReader
+///
+/// Description: destructor of class FileReader
+
+ virtual ~FileReader();
+
+//---------------------------------------------------------------------------------------
+///
+/// openFile
+///
+/// Description: attempts to open a file. Returns true on success
+///
+/// @param filename name of the file to open
+/// @return bool
+
+ bool openFile(TCHAR const * filename);
+
+//---------------------------------------------------------------------------------------
+///
+/// closeFile
+///
+/// Description: attempts to close a file. Returns true on success
+///
+/// @return bool
+
+ bool closeFile();
+
+//---------------------------------------------------------------------------------------
+///
+/// readFile
+///
+/// Description: reads from file. The result is stored in a vector of strings
+///
+/// Note: returns true on success
+///
+
+ bool readFile(vector<string> & lines);
+
+
+
+ protected:
+ FILE * m_File;
+ string m_BufferedLines;
+
+
+ }; // end of class FileReader
+
+
+} // end of namespace System_
+
+
+#endif /* end of FILE_READER_H__ */
Propchange: trunk/reactos/tools/sysreg/file_reader.h
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: trunk/reactos/tools/sysreg/file_reader.h
------------------------------------------------------------------------------
svn:keywords = author date id revision
Modified: trunk/reactos/tools/sysreg/sysreg.mak
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/tools/sysreg/sysreg.mak?re…
==============================================================================
--- trunk/reactos/tools/sysreg/sysreg.mak (original)
+++ trunk/reactos/tools/sysreg/sysreg.mak Tue Oct 24 15:27:23 2006
@@ -25,6 +25,7 @@
rosboot_test.cpp \
sym_file.cpp \
sysreg.cpp \
+ file_reader.cpp \
)
SYSREGBUILD_OBJECTS = \
@@ -66,6 +67,10 @@
$(ECHO_CC)
${host_gpp} $(SYSREGBUILD_HOST_CFLAGS) -c $< -o $@
+$(SYSREGBUILD_INT_)file_reader.o: $(SYSREGBUILD_BASE_)file_reader.cpp |
$(SYSREGBUILD_INT)
+ $(ECHO_CC)
+ ${host_gpp} $(SYSREGBUILD_HOST_CFLAGS) -c $< -o $@
+
.PHONY: sysregbuild_clean
sysreg_clean:
-@$(rm) $(SYSREGBUILD_TARGET) $(SYSREGBUILD_OBJECTS) 2>$(NUL)
Modified: trunk/reactos/tools/sysreg/user_types.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/tools/sysreg/user_types.h?…
==============================================================================
--- trunk/reactos/tools/sysreg/user_types.h (original)
+++ trunk/reactos/tools/sysreg/user_types.h Tue Oct 24 15:27:23 2006
@@ -1,19 +1,18 @@
-#ifndef USER_TYPES_H__
-#define USER_TYPES_H__
-
-/* $Id: rosboot_test.cpp 24585 2006-10-20 19:40:33Z janderwald $
- *
- * PROJECT: System regression tool for ReactOS
- * LICENSE: GPL - See COPYING in the top level directory
- * FILE: tools/sysreg/user_types.h
- * PURPOSE: user types
- * PROGRAMMERS: Johannes Anderwald (johannes.anderwald at sbox tugraz at)
- */
-
-#include <string>
-#include <tchar.h>
-
- typedef std::basic_string<TCHAR> string;
-
-
-#endif
+#ifndef USER_TYPES_H__
+#define USER_TYPES_H__
+
+/* $Id$
+ *
+ * PROJECT: System regression tool for ReactOS
+ * LICENSE: GPL - See COPYING in the top level directory
+ * FILE: tools/sysreg/user_types.h
+ * PURPOSE: user types
+ * PROGRAMMERS: Johannes Anderwald (johannes.anderwald at sbox tugraz at)
+ */
+
+#include <string>
+#include <tchar.h>
+
+ typedef std::basic_string<TCHAR> string;
+
+#endif
Propchange: trunk/reactos/tools/sysreg/user_types.h
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: trunk/reactos/tools/sysreg/user_types.h
------------------------------------------------------------------------------
svn:keywords = author date id revision