Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
SUSE:SLE-15-SP1:Update
libdmtx.25270
libdmtx-DmtxPropRowPadBytes.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File libdmtx-DmtxPropRowPadBytes.patch of Package libdmtx.25270
diff -u libdmtx-0.7.4.orig/dmtxencode.c libdmtx-0.7.4/dmtxencode.c --- libdmtx-0.7.4.orig/dmtxencode.c 2011-06-02 09:09:36.000000000 +0200 +++ libdmtx-0.7.4/dmtxencode.c 2014-06-04 08:06:47.306788067 +0200 @@ -157,7 +157,7 @@ dmtxEncodeDataMatrix(DmtxEncode *enc, int inputSize, unsigned char *inputString) { int sizeIdx; - int width, height, bitsPerPixel; + int width, height, bitsPerPixel, rowSizeBytes; unsigned char *pxl; DmtxByte outputStorage[4096]; DmtxByteList output = dmtxByteListBuild(outputStorage, sizeof(outputStorage)); @@ -202,8 +202,12 @@ return DmtxFail; assert(bitsPerPixel % 8 == 0); + rowSizeBytes = width * (bitsPerPixel/8); + /* Align to next multiple of enc->rowPadBytes */ + if(enc->rowPadBytes > 0) + rowSizeBytes = (((rowSizeBytes + enc->rowPadBytes - 1) / enc->rowPadBytes ) * enc->rowPadBytes ); /* Allocate memory for the image to be generated */ - pxl = (unsigned char *)malloc(width * height * (bitsPerPixel/8) + enc->rowPadBytes); + pxl = (unsigned char *)malloc(height * rowSizeBytes); if(pxl == NULL) { perror("pixel malloc error"); return DmtxFail; diff -u libdmtx-0.7.4.orig/dmtximage.c libdmtx-0.7.4/dmtximage.c --- libdmtx-0.7.4.orig/dmtximage.c 2011-06-02 09:09:36.000000000 +0200 +++ libdmtx-0.7.4/dmtximage.c 2014-06-04 08:04:17.289783266 +0200 @@ -76,7 +76,7 @@ img->bitsPerPixel = GetBitsPerPixel(pack); img->bytesPerPixel = img->bitsPerPixel/8; img->rowPadBytes = 0; - img->rowSizeBytes = img->width * img->bytesPerPixel + img->rowPadBytes; + img->rowSizeBytes = img->width * img->bytesPerPixel; img->imageFlip = DmtxFlipNone; /* Leave channelStart[] and bitsPerChannel[] with zeros from calloc */ @@ -192,7 +192,10 @@ switch(prop) { case DmtxPropRowPadBytes: img->rowPadBytes = value; - img->rowSizeBytes = img->width * (img->bitsPerPixel/8) + img->rowPadBytes; + img->rowSizeBytes = img->width * (img->bitsPerPixel/8); + /* Align to next multiple of img->rowPadBytes */ + if(img->rowPadBytes > 0) + img->rowSizeBytes = (((img->rowSizeBytes + img->rowPadBytes - 1) / img->rowPadBytes ) * img->rowPadBytes); break; case DmtxPropImageFlip: img->imageFlip = value;
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor