help the compiler create more efficient code

Patch from Michael <virtual_worlds@gmx.de>
Full text: As usual I have modified only minor things to remove warnigs when compiled as C++ code, have added some const-specifiers where possible to help the compiler create more efficient code and added some static-specifiers to make functions invisible to other modules.
This commit is contained in:
Robin Stuart 2017-05-29 10:43:47 +01:00
parent d08237d06e
commit b3a1b24d18
29 changed files with 275 additions and 298 deletions

View file

@ -49,7 +49,7 @@ static const char *MSITable[10] = {
};
/* Not MSI/Plessey but the older Plessey standard */
int plessey(struct zint_symbol *symbol, unsigned char source[], int length) {
int plessey(struct zint_symbol *symbol, unsigned char source[], const size_t length) {
unsigned int i, check;
unsigned char *checkptr;
@ -110,9 +110,9 @@ int plessey(struct zint_symbol *symbol, unsigned char source[], int length) {
}
/* Plain MSI Plessey - does not calculate any check character */
int msi_plessey(struct zint_symbol *symbol, unsigned char source[], int length) {
int msi_plessey(struct zint_symbol *symbol, unsigned char source[], const size_t length) {
unsigned int i;
size_t i;
char dest[512]; /* 2 + 55 * 8 + 3 + 1 ~ 512 */
if (length > 55) {
@ -368,7 +368,8 @@ int msi_plessey_mod11(struct zint_symbol *symbol, unsigned char source[], const
* Verified against http://www.bokai.com/BarcodeJSP/applet/BarcodeSampleApplet.htm */
int msi_plessey_mod1110(struct zint_symbol *symbol, unsigned char source[], const unsigned int src_len) {
/* Weighted using the IBM system */
unsigned long i, weight, x, check, wright, dau, pedwar, pump, h;
unsigned long i, weight, x, check, wright, dau, pedwar, pump;
size_t h;
long si;
char un[16], tri[16];
int error_number;