From fc5f11b3b2de6bc44a172f68f52e898220a74a3f Mon Sep 17 00:00:00 2001 From: Nayuki Minase Date: Wed, 20 Apr 2016 20:50:42 +0000 Subject: [PATCH] Tweaked line breaking, whitespace, and declaration ordering without changing behavior. --- cpp/QrCodeGeneratorDemo.cpp | 6 +++--- .../nayuki/qrcodegen/QrCodeGeneratorDemo.java | 6 +++--- javascript/qrcodegen.js | 20 +++++++++---------- python/qrcodegen-demo.py | 3 ++- python/qrcodegen.py | 2 +- 5 files changed, 19 insertions(+), 18 deletions(-) diff --git a/cpp/QrCodeGeneratorDemo.cpp b/cpp/QrCodeGeneratorDemo.cpp index 569d205..ee2f89d 100644 --- a/cpp/QrCodeGeneratorDemo.cpp +++ b/cpp/QrCodeGeneratorDemo.cpp @@ -81,14 +81,14 @@ static void doVarietyDemo() { printQr(qrcodegen::QrCode(qr3, 7)); // Moderately large QR Code using longer text (from Lewis Carroll's Alice in Wonderland) - const qrcodegen::QrCode qr4 = qrcodegen::QrCode::encodeText("Alice was beginning to get very tired of sitting by her sister on the bank, " + const qrcodegen::QrCode qr4 = qrcodegen::QrCode::encodeText( + "Alice was beginning to get very tired of sitting by her sister on the bank, " "and of having nothing to do: once or twice she had peeped into the book her sister was reading, " "but it had no pictures or conversations in it, 'and what is the use of a book,' thought Alice " "'without pictures or conversations?' So she was considering in her own mind (as well as she could, " "for the hot day made her feel very sleepy and stupid), whether the pleasure of making a " "daisy-chain would be worth the trouble of getting up and picking the daisies, when suddenly " - "a White Rabbit with pink eyes ran close by her.", - qrcodegen::QrCode::Ecc::HIGH); + "a White Rabbit with pink eyes ran close by her.", qrcodegen::QrCode::Ecc::HIGH); printQr(qr4); } diff --git a/java/io/nayuki/qrcodegen/QrCodeGeneratorDemo.java b/java/io/nayuki/qrcodegen/QrCodeGeneratorDemo.java index e644f9a..c29b971 100644 --- a/java/io/nayuki/qrcodegen/QrCodeGeneratorDemo.java +++ b/java/io/nayuki/qrcodegen/QrCodeGeneratorDemo.java @@ -94,14 +94,14 @@ public final class QrCodeGeneratorDemo { writePng(new QrCode(qr, 7).toImage(10, 3), "unicode-mask7-QR.png"); // Moderately large QR Code using longer text (from Lewis Carroll's Alice in Wonderland) - qr = QrCode.encodeText("Alice was beginning to get very tired of sitting by her sister on the bank, " + qr = QrCode.encodeText( + "Alice was beginning to get very tired of sitting by her sister on the bank, " + "and of having nothing to do: once or twice she had peeped into the book her sister was reading, " + "but it had no pictures or conversations in it, 'and what is the use of a book,' thought Alice " + "'without pictures or conversations?' So she was considering in her own mind (as well as she could, " + "for the hot day made her feel very sleepy and stupid), whether the pleasure of making a " + "daisy-chain would be worth the trouble of getting up and picking the daisies, when suddenly " - + "a White Rabbit with pink eyes ran close by her.", - QrCode.Ecc.HIGH); + + "a White Rabbit with pink eyes ran close by her.", QrCode.Ecc.HIGH); writePng(qr.toImage(6, 10), "alice-wonderland-QR.png"); } diff --git a/javascript/qrcodegen.js b/javascript/qrcodegen.js index 6fbc6b1..5b2af31 100644 --- a/javascript/qrcodegen.js +++ b/javascript/qrcodegen.js @@ -675,16 +675,6 @@ var qrcodegen = new function() { /*---- Public helper enumeration ----*/ - // Private constructor. - function Ecc(ord, fb) { - // (Public) In the range 0 to 3 (unsigned 2-bit integer) - Object.defineProperty(this, "ordinal", {value:ord}); - - // (Package-private) In the range 0 to 3 (unsigned 2-bit integer) - Object.defineProperty(this, "formatBits", {value:fb}); - } - - /* * Represents the error correction level used in a QR Code symbol. */ @@ -697,6 +687,16 @@ var qrcodegen = new function() { }; + // Private constructor. + function Ecc(ord, fb) { + // (Public) In the range 0 to 3 (unsigned 2-bit integer) + Object.defineProperty(this, "ordinal", {value:ord}); + + // (Package-private) In the range 0 to 3 (unsigned 2-bit integer) + Object.defineProperty(this, "formatBits", {value:fb}); + } + + /*---- Data segment class ----*/ diff --git a/python/qrcodegen-demo.py b/python/qrcodegen-demo.py index b8a1542..cd72b53 100644 --- a/python/qrcodegen-demo.py +++ b/python/qrcodegen-demo.py @@ -67,7 +67,8 @@ def do_variety_demo(): print_qr(qrcodegen.QrCode(qrcode=qr, mask=7)) # Moderately large QR Code using longer text (from Lewis Carroll's Alice in Wonderland) - qr = qrcodegen.QrCode.encode_text("Alice was beginning to get very tired of sitting by her sister on the bank, " + qr = qrcodegen.QrCode.encode_text( + "Alice was beginning to get very tired of sitting by her sister on the bank, " "and of having nothing to do: once or twice she had peeped into the book her sister was reading, " "but it had no pictures or conversations in it, 'and what is the use of a book,' thought Alice " "'without pictures or conversations?' So she was considering in her own mind (as well as she could, " diff --git a/python/qrcodegen.py b/python/qrcodegen.py index 9c987c1..59d2338 100644 --- a/python/qrcodegen.py +++ b/python/qrcodegen.py @@ -168,7 +168,7 @@ class QrCode(object): if len(datacodewords) != QrCode._get_num_data_codewords(version, errcorlvl): raise ValueError("Invalid array length") # Initialize grids of modules - self._modules = [[False] * self._size for _ in range(self._size)] # The modules of the QR symbol; start with entirely white grid + self._modules = [[False] * self._size for _ in range(self._size)] # The modules of the QR symbol; start with entirely white grid self._isfunction = [[False] * self._size for _ in range(self._size)] # Indicates function modules that are not subjected to masking # Draw function patterns, draw all codewords self._draw_function_patterns()