pull/79/head
Christoph Oberhofer 10 years ago
parent 14c207928c
commit 9b128cd577

@ -1,7 +1,7 @@
quaggaJS quaggaJS
======== ========
- [Changelog](#changelog) (2015-11-15) - [Changelog](#changelog) (2015-11-22)
## What is QuaggaJS? ## What is QuaggaJS?
@ -434,6 +434,12 @@ on the ``singleChannel`` flag in the configuration when using ``decodeSingle``.
## <a name="changelog">Changelog</a> ## <a name="changelog">Changelog</a>
### 2015-11-22
- Fixes
- Fixed inconsistencies for Code 128 decoding (See
[\#76](https://github.com/serratus/quaggaJS/issues/76))
### 2015-11-15 ### 2015-11-15
- Fixes - Fixes

24
dist/quagga.js vendored

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

@ -58,7 +58,7 @@
&copy; Copyright by Christoph Oberhofer &copy; Copyright by Christoph Oberhofer
</p> </p>
</footer> </footer>
<script src="../src/vendor/jquery-1.9.0.min.js" type="text/javascript"></script> <script src="vendor/jquery-1.9.0.min.js" type="text/javascript"></script>
<script src="../dist/quagga.js" type="text/javascript"></script> <script src="../dist/quagga.js" type="text/javascript"></script>
<script src="static_images.js" type="text/javascript"></script> <script src="static_images.js" type="text/javascript"></script>
</body> </body>

File diff suppressed because one or more lines are too long

@ -1,6 +1,6 @@
{ {
"name": "quagga", "name": "quagga",
"version": "0.8.1", "version": "0.8.2",
"description": "An advanced barcode-scanner written in JavaScript", "description": "An advanced barcode-scanner written in JavaScript",
"main": "lib/quagga.js", "main": "lib/quagga.js",
"browser": "dist/quagga.min.js", "browser": "dist/quagga.min.js",

@ -247,7 +247,8 @@ Code128Reader.prototype._decode = function() {
rawResult = [], rawResult = [],
decodedCodes = [], decodedCodes = [],
shiftNext = false, shiftNext = false,
unshift; unshift,
removeLastCharacter = true;
if (startInfo === null) { if (startInfo === null) {
return null; return null;
@ -278,6 +279,10 @@ Code128Reader.prototype._decode = function() {
shiftNext = false; shiftNext = false;
code = self._decodeCode(code.end); code = self._decodeCode(code.end);
if (code !== null) { if (code !== null) {
if (code.code !== self.STOP_CODE) {
removeLastCharacter = true;
}
if (code.code !== self.STOP_CODE) { if (code.code !== self.STOP_CODE) {
rawResult.push(code.code); rawResult.push(code.code);
multiplier++; multiplier++;
@ -292,6 +297,9 @@ Code128Reader.prototype._decode = function() {
} else if (code.code < 96) { } else if (code.code < 96) {
result.push(String.fromCharCode(code.code - 64)); result.push(String.fromCharCode(code.code - 64));
} else { } else {
if (code.code !== self.STOP_CODE) {
removeLastCharacter = false;
}
switch (code.code) { switch (code.code) {
case self.CODE_SHIFT: case self.CODE_SHIFT:
shiftNext = true; shiftNext = true;
@ -313,6 +321,9 @@ Code128Reader.prototype._decode = function() {
if (code.code < 96) { if (code.code < 96) {
result.push(String.fromCharCode(32 + code.code)); result.push(String.fromCharCode(32 + code.code));
} else { } else {
if (code.code !== self.STOP_CODE) {
removeLastCharacter = false;
}
switch (code.code) { switch (code.code) {
case self.CODE_SHIFT: case self.CODE_SHIFT:
shiftNext = true; shiftNext = true;
@ -333,6 +344,9 @@ Code128Reader.prototype._decode = function() {
case self.CODE_C: case self.CODE_C:
if (code.code < 100) { if (code.code < 100) {
result.push(code.code < 10 ? "0" + code.code : code.code); result.push(code.code < 10 ? "0" + code.code : code.code);
} else {
if (code.code !== self.STOP_CODE) {
removeLastCharacter = false;
} }
switch (code.code) { switch (code.code) {
case self.CODE_A: case self.CODE_A:
@ -345,6 +359,7 @@ Code128Reader.prototype._decode = function() {
done = true; done = true;
break; break;
} }
}
break; break;
} }
} else { } else {
@ -359,14 +374,11 @@ Code128Reader.prototype._decode = function() {
return null; return null;
} }
// find end bar
code.end = self._nextUnset(self._row, code.end); code.end = self._nextUnset(self._row, code.end);
if (!self._verifyTrailingWhitespace(code)){ if (!self._verifyTrailingWhitespace(code)){
return null; return null;
} }
// checksum
// Does not work correctly yet!!! startcode - endcode?
checksum -= multiplier * rawResult[rawResult.length - 1]; checksum -= multiplier * rawResult[rawResult.length - 1];
if (checksum % 103 !== rawResult[rawResult.length - 1]) { if (checksum % 103 !== rawResult[rawResult.length - 1]) {
return null; return null;
@ -377,7 +389,10 @@ Code128Reader.prototype._decode = function() {
} }
// remove last code from result (checksum) // remove last code from result (checksum)
if (removeLastCharacter) {
result.splice(result.length - 1, 1); result.splice(result.length - 1, 1);
}
return { return {
code: result.join(""), code: result.join(""),

@ -86,7 +86,7 @@ describe('decodeSingle', function () {
{"name": "image-005.jpg", "result": "419055603900009001012999"}, {"name": "image-005.jpg", "result": "419055603900009001012999"},
{"name": "image-006.jpg", "result": "419055603900009001012999"}, {"name": "image-006.jpg", "result": "419055603900009001012999"},
{"name": "image-007.jpg", "result": "T 000003552345"}, {"name": "image-007.jpg", "result": "T 000003552345"},
{"name": "image-008.jpg", "result": "FANAVF1461710"}, {"name": "image-008.jpg", "result": "FANAVF14617104"},
{"name": "image-009.jpg", "result": "0001285112001000040801"}, {"name": "image-009.jpg", "result": "0001285112001000040801"},
{"name": "image-010.jpg", "result": "673023"} {"name": "image-010.jpg", "result": "673023"}
]; ];

Loading…
Cancel
Save