Permalink
Browse files

Normalize line endings but not JSON files

1 parent 7fb84d3 commit a62777487d58421bcb0bc5eeab739817fb7bada9 @miloyip committed Mar 4, 2016
Showing with 8,276 additions and 8,276 deletions.
  1. +1 −1 .gitattributes
  2. +1 −1 bin/data/readme.txt
  3. +32 −32 example/condense/condense.cpp
  4. +30 −30 example/pretty/pretty.cpp
  5. +56 −56 example/prettyauto/prettyauto.cpp
  6. +173 −173 example/serialize/serialize.cpp
  7. +151 −151 example/tutorial/tutorial.cpp
  8. +263 −263 include/rapidjson/allocators.h
  9. +295 −295 include/rapidjson/encodedstream.h
  10. +712 −712 include/rapidjson/encodings.h
  11. +99 −99 include/rapidjson/filereadstream.h
  12. +104 −104 include/rapidjson/filewritestream.h
  13. +181 −181 include/rapidjson/internal/meta.h
  14. +55 −55 include/rapidjson/internal/pow10.h
  15. +696 −696 include/rapidjson/internal/regex.h
  16. +230 −230 include/rapidjson/internal/stack.h
  17. +55 −55 include/rapidjson/internal/strfunc.h
  18. +46 −46 include/rapidjson/internal/swap.h
  19. +611 −611 include/rapidjson/rapidjson.h
  20. +117 −117 include/rapidjson/stringbuffer.h
  21. +57 −57 license.txt
  22. +974 −974 test/perftest/misctest.cpp
  23. +24 −24 test/perftest/perftest.cpp
  24. +182 −182 test/perftest/perftest.h
  25. +166 −166 test/perftest/platformtest.cpp
  26. +441 −441 test/perftest/rapidjsontest.cpp
  27. +652 −652 test/unittest/documenttest.cpp
  28. +313 −313 test/unittest/encodedstreamtest.cpp
  29. +425 −425 test/unittest/encodingstest.cpp
  30. +112 −112 test/unittest/filestreamtest.cpp
  31. +227 −227 test/unittest/fwdtest.cpp
  32. +99 −99 test/unittest/jsoncheckertest.cpp
  33. +70 −70 test/unittest/namespacetest.cpp
  34. +50 −50 test/unittest/unittest.cpp
  35. +135 −135 test/unittest/unittest.h
  36. +441 −441 test/unittest/writertest.cpp
View
@@ -7,7 +7,6 @@
*.h text
*.txt text
*.md text
-*.json text
*.cmake text
*.svg text
*.dot text
@@ -20,3 +19,4 @@ Dockerfile text
# Denote all files that are truly binary and should not be modified.
*.png binary
*.jpg binary
+*.json binary
View
@@ -1 +1 @@
-sample.json is obtained from http://code.google.com/p/json-test-suite/downloads/detail?name=sample.zip
+sample.json is obtained from http://code.google.com/p/json-test-suite/downloads/detail?name=sample.zip
@@ -1,32 +1,32 @@
-// JSON condenser example
-
-// This example parses JSON text from stdin with validation,
-// and re-output the JSON content to stdout without whitespace.
-
-#include "rapidjson/reader.h"
-#include "rapidjson/writer.h"
-#include "rapidjson/filereadstream.h"
-#include "rapidjson/filewritestream.h"
-#include "rapidjson/error/en.h"
-
-using namespace rapidjson;
-
-int main(int, char*[]) {
- // Prepare JSON reader and input stream.
- Reader reader;
- char readBuffer[65536];
- FileReadStream is(stdin, readBuffer, sizeof(readBuffer));
-
- // Prepare JSON writer and output stream.
- char writeBuffer[65536];
- FileWriteStream os(stdout, writeBuffer, sizeof(writeBuffer));
- Writer<FileWriteStream> writer(os);
-
- // JSON reader parse from the input stream and let writer generate the output.
- if (!reader.Parse(is, writer)) {
- fprintf(stderr, "\nError(%u): %s\n", static_cast<unsigned>(reader.GetErrorOffset()), GetParseError_En(reader.GetParseErrorCode()));
- return 1;
- }
-
- return 0;
-}
+// JSON condenser example
+
+// This example parses JSON text from stdin with validation,
+// and re-output the JSON content to stdout without whitespace.
+
+#include "rapidjson/reader.h"
+#include "rapidjson/writer.h"
+#include "rapidjson/filereadstream.h"
+#include "rapidjson/filewritestream.h"
+#include "rapidjson/error/en.h"
+
+using namespace rapidjson;
+
+int main(int, char*[]) {
+ // Prepare JSON reader and input stream.
+ Reader reader;
+ char readBuffer[65536];
+ FileReadStream is(stdin, readBuffer, sizeof(readBuffer));
+
+ // Prepare JSON writer and output stream.
+ char writeBuffer[65536];
+ FileWriteStream os(stdout, writeBuffer, sizeof(writeBuffer));
+ Writer<FileWriteStream> writer(os);
+
+ // JSON reader parse from the input stream and let writer generate the output.
+ if (!reader.Parse(is, writer)) {
+ fprintf(stderr, "\nError(%u): %s\n", static_cast<unsigned>(reader.GetErrorOffset()), GetParseError_En(reader.GetParseErrorCode()));
+ return 1;
+ }
+
+ return 0;
+}
@@ -1,30 +1,30 @@
-// JSON pretty formatting example
-// This example can only handle UTF-8. For handling other encodings, see prettyauto example.
-
-#include "rapidjson/reader.h"
-#include "rapidjson/prettywriter.h"
-#include "rapidjson/filereadstream.h"
-#include "rapidjson/filewritestream.h"
-#include "rapidjson/error/en.h"
-
-using namespace rapidjson;
-
-int main(int, char*[]) {
- // Prepare reader and input stream.
- Reader reader;
- char readBuffer[65536];
- FileReadStream is(stdin, readBuffer, sizeof(readBuffer));
-
- // Prepare writer and output stream.
- char writeBuffer[65536];
- FileWriteStream os(stdout, writeBuffer, sizeof(writeBuffer));
- PrettyWriter<FileWriteStream> writer(os);
-
- // JSON reader parse from the input stream and let writer generate the output.
- if (!reader.Parse<kParseValidateEncodingFlag>(is, writer)) {
- fprintf(stderr, "\nError(%u): %s\n", static_cast<unsigned>(reader.GetErrorOffset()), GetParseError_En(reader.GetParseErrorCode()));
- return 1;
- }
-
- return 0;
-}
+// JSON pretty formatting example
+// This example can only handle UTF-8. For handling other encodings, see prettyauto example.
+
+#include "rapidjson/reader.h"
+#include "rapidjson/prettywriter.h"
+#include "rapidjson/filereadstream.h"
+#include "rapidjson/filewritestream.h"
+#include "rapidjson/error/en.h"
+
+using namespace rapidjson;
+
+int main(int, char*[]) {
+ // Prepare reader and input stream.
+ Reader reader;
+ char readBuffer[65536];
+ FileReadStream is(stdin, readBuffer, sizeof(readBuffer));
+
+ // Prepare writer and output stream.
+ char writeBuffer[65536];
+ FileWriteStream os(stdout, writeBuffer, sizeof(writeBuffer));
+ PrettyWriter<FileWriteStream> writer(os);
+
+ // JSON reader parse from the input stream and let writer generate the output.
+ if (!reader.Parse<kParseValidateEncodingFlag>(is, writer)) {
+ fprintf(stderr, "\nError(%u): %s\n", static_cast<unsigned>(reader.GetErrorOffset()), GetParseError_En(reader.GetParseErrorCode()));
+ return 1;
+ }
+
+ return 0;
+}
@@ -1,56 +1,56 @@
-// JSON pretty formatting example
-// This example can handle UTF-8/UTF-16LE/UTF-16BE/UTF-32LE/UTF-32BE.
-// The input firstly convert to UTF8, and then write to the original encoding with pretty formatting.
-
-#include "rapidjson/reader.h"
-#include "rapidjson/prettywriter.h"
-#include "rapidjson/filereadstream.h"
-#include "rapidjson/filewritestream.h"
-#include "rapidjson/encodedstream.h" // NEW
-#include "rapidjson/error/en.h"
-#ifdef _WIN32
-#include <fcntl.h>
-#include <io.h>
-#endif
-
-using namespace rapidjson;
-
-int main(int, char*[]) {
-#ifdef _WIN32
- // Prevent Windows converting between CR+LF and LF
- _setmode(_fileno(stdin), _O_BINARY); // NEW
- _setmode(_fileno(stdout), _O_BINARY); // NEW
-#endif
-
- // Prepare reader and input stream.
- //Reader reader;
- GenericReader<AutoUTF<unsigned>, UTF8<> > reader; // CHANGED
- char readBuffer[65536];
- FileReadStream is(stdin, readBuffer, sizeof(readBuffer));
- AutoUTFInputStream<unsigned, FileReadStream> eis(is); // NEW
-
- // Prepare writer and output stream.
- char writeBuffer[65536];
- FileWriteStream os(stdout, writeBuffer, sizeof(writeBuffer));
-
-#if 1
- // Use the same Encoding of the input. Also use BOM according to input.
- typedef AutoUTFOutputStream<unsigned, FileWriteStream> OutputStream; // NEW
- OutputStream eos(os, eis.GetType(), eis.HasBOM()); // NEW
- PrettyWriter<OutputStream, UTF8<>, AutoUTF<unsigned> > writer(eos); // CHANGED
-#else
- // You may also use static bound encoding type, such as output to UTF-16LE with BOM
- typedef EncodedOutputStream<UTF16LE<>,FileWriteStream> OutputStream; // NEW
- OutputStream eos(os, true); // NEW
- PrettyWriter<OutputStream, UTF8<>, UTF16LE<> > writer(eos); // CHANGED
-#endif
-
- // JSON reader parse from the input stream and let writer generate the output.
- //if (!reader.Parse<kParseValidateEncodingFlag>(is, writer)) {
- if (!reader.Parse<kParseValidateEncodingFlag>(eis, writer)) { // CHANGED
- fprintf(stderr, "\nError(%u): %s\n", static_cast<unsigned>(reader.GetErrorOffset()), GetParseError_En(reader.GetParseErrorCode()));
- return 1;
- }
-
- return 0;
-}
+// JSON pretty formatting example
+// This example can handle UTF-8/UTF-16LE/UTF-16BE/UTF-32LE/UTF-32BE.
+// The input firstly convert to UTF8, and then write to the original encoding with pretty formatting.
+
+#include "rapidjson/reader.h"
+#include "rapidjson/prettywriter.h"
+#include "rapidjson/filereadstream.h"
+#include "rapidjson/filewritestream.h"
+#include "rapidjson/encodedstream.h" // NEW
+#include "rapidjson/error/en.h"
+#ifdef _WIN32
+#include <fcntl.h>
+#include <io.h>
+#endif
+
+using namespace rapidjson;
+
+int main(int, char*[]) {
+#ifdef _WIN32
+ // Prevent Windows converting between CR+LF and LF
+ _setmode(_fileno(stdin), _O_BINARY); // NEW
+ _setmode(_fileno(stdout), _O_BINARY); // NEW
+#endif
+
+ // Prepare reader and input stream.
+ //Reader reader;
+ GenericReader<AutoUTF<unsigned>, UTF8<> > reader; // CHANGED
+ char readBuffer[65536];
+ FileReadStream is(stdin, readBuffer, sizeof(readBuffer));
+ AutoUTFInputStream<unsigned, FileReadStream> eis(is); // NEW
+
+ // Prepare writer and output stream.
+ char writeBuffer[65536];
+ FileWriteStream os(stdout, writeBuffer, sizeof(writeBuffer));
+
+#if 1
+ // Use the same Encoding of the input. Also use BOM according to input.
+ typedef AutoUTFOutputStream<unsigned, FileWriteStream> OutputStream; // NEW
+ OutputStream eos(os, eis.GetType(), eis.HasBOM()); // NEW
+ PrettyWriter<OutputStream, UTF8<>, AutoUTF<unsigned> > writer(eos); // CHANGED
+#else
+ // You may also use static bound encoding type, such as output to UTF-16LE with BOM
+ typedef EncodedOutputStream<UTF16LE<>,FileWriteStream> OutputStream; // NEW
+ OutputStream eos(os, true); // NEW
+ PrettyWriter<OutputStream, UTF8<>, UTF16LE<> > writer(eos); // CHANGED
+#endif
+
+ // JSON reader parse from the input stream and let writer generate the output.
+ //if (!reader.Parse<kParseValidateEncodingFlag>(is, writer)) {
+ if (!reader.Parse<kParseValidateEncodingFlag>(eis, writer)) { // CHANGED
+ fprintf(stderr, "\nError(%u): %s\n", static_cast<unsigned>(reader.GetErrorOffset()), GetParseError_En(reader.GetParseErrorCode()));
+ return 1;
+ }
+
+ return 0;
+}
Oops, something went wrong.

0 comments on commit a627774

Please sign in to comment.