diff --git a/c/qrcodegen.h b/c/qrcodegen.h index 70b1ce8..3215a6c 100644 --- a/c/qrcodegen.h +++ b/c/qrcodegen.h @@ -84,12 +84,12 @@ enum qrcodegen_Mode { * bit length is 32767, because even the largest QR Code (version 40) has only 31329 modules. */ struct qrcodegen_Segment { - // The mode indicator for this segment. + // The mode indicator of this segment. enum qrcodegen_Mode mode; - // The length of this segment's unencoded data, measured in characters for + // The length of this segment's unencoded data. Measured in characters for // numeric/alphanumeric/kanji mode, bytes for byte mode, and 0 for ECI mode. - // Always zero or positive. + // Always zero or positive. Not the same as the data's bit length. int numChars; // The data bits of this segment, packed in bitwise big endian. diff --git a/cpp/QrSegment.hpp b/cpp/QrSegment.hpp index 4f56e97..47c41b0 100644 --- a/cpp/QrSegment.hpp +++ b/cpp/QrSegment.hpp @@ -139,15 +139,16 @@ class QrSegment final { /*---- Instance fields ----*/ - /* The mode indicator for this segment. */ + /* The mode indicator of this segment. Accessed through getMode(). */ private: Mode mode; - /* The length of this segment's unencoded data, measured in characters for + /* The length of this segment's unencoded data. Measured in characters for * numeric/alphanumeric/kanji mode, bytes for byte mode, and 0 for ECI mode. - * Always zero or positive. */ + * Always zero or positive. Not the same as the data's bit length. + * Accessed through getNumChars(). */ private: int numChars; - /* The data bits of this segment. */ + /* The data bits of this segment. Accessed through getData(). */ private: std::vector data; diff --git a/java/io/nayuki/qrcodegen/QrSegment.java b/java/io/nayuki/qrcodegen/QrSegment.java index 251d1a1..605ab71 100644 --- a/java/io/nayuki/qrcodegen/QrSegment.java +++ b/java/io/nayuki/qrcodegen/QrSegment.java @@ -156,15 +156,15 @@ public final class QrSegment { /*---- Instance fields ----*/ - /** The mode indicator for this segment. Never {@code null}. */ + /** The mode indicator of this segment. Not {@code null}. */ public final Mode mode; - /** The length of this segment's unencoded data, measured in characters for + /** The length of this segment's unencoded data. Measured in characters for * numeric/alphanumeric/kanji mode, bytes for byte mode, and 0 for ECI mode. - * Always zero or positive. */ + * Always zero or positive. Not the same as the data's bit length. */ public final int numChars; - /** The data bits of this segment. Accessed through {@link getBits()}. Not {@code null}. */ + /** The data bits of this segment. Not {@code null}. Accessed through {@link getBits()}. */ final BitBuffer data; diff --git a/javascript/qrcodegen.js b/javascript/qrcodegen.js index afa2ba3..f54d9a4 100644 --- a/javascript/qrcodegen.js +++ b/javascript/qrcodegen.js @@ -710,12 +710,12 @@ var qrcodegen = new function() { throw "Invalid argument"; bitData = bitData.slice(); // Make defensive copy - // The mode indicator for this segment. + // The mode indicator of this segment. Object.defineProperty(this, "mode", {value:mode}); - // The length of this segment's unencoded data, measured in characters for + // The length of this segment's unencoded data. Measured in characters for // numeric/alphanumeric/kanji mode, bytes for byte mode, and 0 for ECI mode. - // Always zero or positive. + // Always zero or positive. Not the same as the data's bit length. Object.defineProperty(this, "numChars", {value:numChars}); // Returns a copy of all bits, which is an array of 0s and 1s. diff --git a/python/qrcodegen.py b/python/qrcodegen.py index debc3a4..8a9fc37 100644 --- a/python/qrcodegen.py +++ b/python/qrcodegen.py @@ -688,12 +688,13 @@ class QrSegment(object): if numch < 0: raise ValueError() - # The mode indicator for this segment. + # The mode indicator of this segment. Accessed through get_mode(). self._mode = mode - # The length of this segment's unencoded data, measured in characters for + # The length of this segment's unencoded data. Measured in characters for # numeric/alphanumeric/kanji mode, bytes for byte mode, and 0 for ECI mode. - # Always zero or positive. + # Always zero or positive. Not the same as the data's bit length. + # Accessed through get_num_chars(). self._numchars = numch # The data bits of this segment. Accessed through get_bits(). diff --git a/rust/src/lib.rs b/rust/src/lib.rs index ca74cf7..33c73c2 100644 --- a/rust/src/lib.rs +++ b/rust/src/lib.rs @@ -833,14 +833,15 @@ impl ReedSolomonGenerator { #[derive(Clone)] pub struct QrSegment { - // The mode indicator for this segment. + // The mode indicator of this segment. Accessed through mode(). mode: QrSegmentMode, - // The length of this segment's unencoded data, measured in characters for + // The length of this segment's unencoded data. Measured in characters for // numeric/alphanumeric/kanji mode, bytes for byte mode, and 0 for ECI mode. + // Not the same as the data's bit length. Accessed through num_chars(). numchars: usize, - // The bits of this segment. + // The data bits of this segment. Accessed through data(). data: Vec, } diff --git a/typescript/qrcodegen.ts b/typescript/qrcodegen.ts index a587360..b831050 100644 --- a/typescript/qrcodegen.ts +++ b/typescript/qrcodegen.ts @@ -742,14 +742,15 @@ namespace qrcodegen { // The character count (numChars) must agree with the mode and the bit buffer length, // but the constraint isn't checked. The given bit buffer is cloned and stored. public constructor( - // The mode indicator for this segment. + // The mode indicator of this segment. public readonly mode: QrSegment.Mode, - // The length of this segment's unencoded data, measured in characters for + // The length of this segment's unencoded data. Measured in characters for // numeric/alphanumeric/kanji mode, bytes for byte mode, and 0 for ECI mode. - // Always zero or positive. + // Always zero or positive. Not the same as the data's bit length. public readonly numChars: int, + // The data bits of this segment. Accessed through getBits(). private readonly bitData: Array) { if (numChars < 0)