mirror of
https://github.com/openharmony/third_party_qrcodegen.git
synced 2026-07-01 09:10:48 -04:00
Updated function-level comments in the C language port.
This commit is contained in:
+6
-6
@@ -560,7 +560,7 @@ testable int getAlignmentPatternPositions(int version, uint8_t result[7]) {
|
||||
}
|
||||
|
||||
|
||||
// Sets every pixel in the range [left : left + width] * [top : top + height] to dark.
|
||||
// Sets every module in the range [left : left + width] * [top : top + height] to dark.
|
||||
static void fillRectangle(int left, int top, int width, int height, uint8_t qrcode[]) {
|
||||
for (int dy = 0; dy < height; dy++) {
|
||||
for (int dx = 0; dx < width; dx++)
|
||||
@@ -600,8 +600,8 @@ static void drawCodewords(const uint8_t data[], int dataLen, uint8_t qrcode[]) {
|
||||
}
|
||||
|
||||
|
||||
// XORs the codeword modules in this QR Code with the given mask pattern.
|
||||
// The function modules must be marked and the codeword bits must be drawn
|
||||
// XORs the codeword modules in this QR Code with the given mask pattern
|
||||
// and given pattern of function modules. The codeword bits must be drawn
|
||||
// before masking. Due to the arithmetic of XOR, calling applyMask() with
|
||||
// the same mask value a second time will undo the mask. A final well-formed
|
||||
// QR Code needs exactly one (not zero, two, etc.) mask applied.
|
||||
@@ -766,7 +766,7 @@ bool qrcodegen_getModule(const uint8_t qrcode[], int x, int y) {
|
||||
}
|
||||
|
||||
|
||||
// Gets the module at the given coordinates, which must be in bounds.
|
||||
// Returns the color of the module at the given coordinates, which must be in bounds.
|
||||
testable bool getModuleBounded(const uint8_t qrcode[], int x, int y) {
|
||||
int qrsize = qrcode[0];
|
||||
assert(21 <= qrsize && qrsize <= 177 && 0 <= x && x < qrsize && 0 <= y && y < qrsize);
|
||||
@@ -775,7 +775,7 @@ testable bool getModuleBounded(const uint8_t qrcode[], int x, int y) {
|
||||
}
|
||||
|
||||
|
||||
// Sets the module at the given coordinates, which must be in bounds.
|
||||
// Sets the color of the module at the given coordinates, which must be in bounds.
|
||||
testable void setModuleBounded(uint8_t qrcode[], int x, int y, bool isDark) {
|
||||
int qrsize = qrcode[0];
|
||||
assert(21 <= qrsize && qrsize <= 177 && 0 <= x && x < qrsize && 0 <= y && y < qrsize);
|
||||
@@ -789,7 +789,7 @@ testable void setModuleBounded(uint8_t qrcode[], int x, int y, bool isDark) {
|
||||
}
|
||||
|
||||
|
||||
// Sets the module at the given coordinates, doing nothing if out of bounds.
|
||||
// Sets the color of the module at the given coordinates, doing nothing if out of bounds.
|
||||
testable void setModuleUnbounded(uint8_t qrcode[], int x, int y, bool isDark) {
|
||||
int qrsize = qrcode[0];
|
||||
if (0 <= x && x < qrsize && 0 <= y && y < qrsize)
|
||||
|
||||
+2
-2
@@ -247,8 +247,8 @@ bool qrcodegen_isAlphanumeric(const char *text);
|
||||
/*
|
||||
* Returns the number of bytes (uint8_t) needed for the data buffer of a segment
|
||||
* containing the given number of characters using the given mode. Notes:
|
||||
* - Returns SIZE_MAX on failure, i.e. numChars > INT16_MAX or
|
||||
* the number of needed bits exceeds INT16_MAX (i.e. 32767).
|
||||
* - Returns SIZE_MAX on failure, i.e. numChars > INT16_MAX or the internal
|
||||
* calculation of the number of needed bits exceeds INT16_MAX (i.e. 32767).
|
||||
* - Otherwise, all valid results are in the range [0, ceil(INT16_MAX / 8)], i.e. at most 4096.
|
||||
* - It is okay for the user to allocate more bytes for the buffer than needed.
|
||||
* - For byte mode, numChars measures the number of bytes, not Unicode code points.
|
||||
|
||||
Reference in New Issue
Block a user