void test_encode_kanji(int num) { QRcode *qrcode; QRdata *qrdata; int len, ret; len = fill8bitString(); qrcode = QRcode_encodeString((char *)data, 0, num % 4, QR_MODE_8, 1); if(qrcode == NULL) { if(errno == ERANGE) return; perror("test_encdoe_kanji aborted at QRcode_encodeString():"); return; } qrdata = QRcode_decode(qrcode); if(qrdata == NULL) { printf("#%d: Failed to decode this code.\n", num); QRcode_free(qrcode); return; } if(qrdata->size != len) { printf("#%d: length mismatched (orig: %d, decoded: %d)\n", num, len, qrdata->size); } ret = memcmp(qrdata->data, data, len); if(ret != 0) { printf("#%d: data mismatched.\n", num); } QRdata_free(qrdata); QRcode_free(qrcode); }
void test_encodeLongData(void) { QRinput *stream; unsigned char data[7090]; int maxlength[4][4] = {{7089,5596,3993,3057}, {4296,3391,2420,1852}, {2953,2331,1663,1273}, {1817*2,1435*2,1024*2, 784*2}}; int i, l, len, ret; QRcode *qrcode; testStart("Encoding long data."); for(i=QR_MODE_NUM; i<=QR_MODE_KANJI; i++) { if(i != QR_MODE_KANJI) { memset(data, '0', maxlength[i][0] + 1); } else { for(l=0; l<=maxlength[i][0]/2+1; l++) { data[l*2] = 0x93; data[l*2+1] = 0x5f; } } for(l=QR_ECLEVEL_L; l<=QR_ECLEVEL_H; l++) { stream = QRinput_new2(0, l); ret = QRinput_append(stream, i, maxlength[i][l], data); assert_zero(ret, "Failed to add %d-byte %s to a QRinput\n", maxlength[i][l], modeStr[i]); qrcode = QRcode_encodeInput(stream); assert_nonnull(qrcode, "(QRcode_encodeInput) failed to encode %d-byte %s in level %d.\n", maxlength[i][l], modeStr[i], l); if(qrcode != NULL) { QRcode_free(qrcode); } QRinput_free(stream); stream = QRinput_new2(0, l); len = maxlength[i][l]; if(i == QR_MODE_KANJI) { len += 2; } else { len += 1; } ret = QRinput_append(stream, i, len, data); if(ret == 0) { qrcode = QRcode_encodeInput(stream); assert_null(qrcode, "(QRcode_encodeInput) incorrectly succeeded to encode %d-byte %s in level %d.\n", len, modeStr[i], l); if(qrcode != NULL) { printf("version: %d\n", qrcode->version); QRcode_free(qrcode); } } QRinput_free(stream); } } testFinish(); }
void test_encodeData(void) { QRcode *qrcode; testStart("Test QRencode_encodeData."); qrcode = QRcode_encodeData(0, NULL, 0, QR_ECLEVEL_H); assert_null(qrcode, "QRcode_encodeData(NULL, 0) returned something.\n"); if(qrcode != NULL) QRcode_free(qrcode); qrcode = QRcode_encodeData(10, (unsigned char*)"test\0\0test", 0, QR_ECLEVEL_H); assert_nonnull(qrcode, "QRcode_encodeData() failed.\n"); if(qrcode != NULL) QRcode_free(qrcode); testFinish(); }
void test_decodeVeryLong(void) { char str[4000]; int i; QRcode *qrcode; QRdata *qrdata; testStart("Test code words (very long string)."); for(i=0; i<3999; i++) { str[i] = decodeAnTable[(int)drand(45)]; } str[3999] = '\0'; qrcode = QRcode_encodeString(str, 0, QR_ECLEVEL_L, QR_MODE_8, 0); qrdata = QRcode_decode(qrcode); assert_nonnull(qrdata, "Failed to decode.\n"); if(qrdata != NULL) { assert_equal(strlen(str), qrdata->size, "Lengths of input/output mismatched.\n"); assert_zero(strncmp(str, (char *)(qrdata->data), qrdata->size), "Decoded data %s is different from the original %s\n", qrdata->data, str); } if(qrdata != NULL) QRdata_free(qrdata); if(qrcode != NULL) QRcode_free(qrcode); testFinish(); }
void test_encodeTooLongMQR(void) { QRcode *code; char *data[] = {"012345", "ABC0EFG", "0123456789", "0123456789ABCDEFG"}; testStart("Encode too large data for MQR."); code = QRcode_encodeStringMQR(data[0], 1, QR_ECLEVEL_L, QR_MODE_8, 0); assert_null(code, "6 byte length numeric string was accepted to version 1.\n"); assert_equal(errno, ERANGE, "errno != ERANGE\n"); code = QRcode_encodeStringMQR(data[1], 2, QR_ECLEVEL_L, QR_MODE_8, 0); assert_null(code, "7 byte length alphanumeric string was accepted to version 2.\n"); assert_equal(errno, ERANGE, "errno != ERANGE\n"); code = QRcode_encodeString8bitMQR(data[2], 3, QR_ECLEVEL_L); assert_null(code, "9 byte length 8bit string was accepted to version 3.\n"); assert_equal(errno, ERANGE, "errno != ERANGE\n"); code = QRcode_encodeString8bitMQR(data[3], 4, QR_ECLEVEL_L); assert_null(code, "16 byte length 8bit string was accepted to version 4.\n"); assert_equal(errno, ERANGE, "errno != ERANGE\n"); testFinish(); if(code != NULL) { printQRcode(code); QRcode_free(code); } }
void QRcodeWidget::paintEvent(QPaintEvent *event) { if (this->code != NULL) { QPainter painter(this); painter.setPen(Qt::NoPen); int codeWidth = code->width; int blkw = this->size().width() / codeWidth; int blkh = this->size().height() / codeWidth; for (int y = 0 ; y < codeWidth; y++) { for (int x = 0 ; x < codeWidth; x++) { int point = code->data[y * codeWidth + x]; if (point & 1) { painter.setBrush(QBrush(Qt::black)); } else { painter.setBrush(QBrush(Qt::white)); } painter.drawRect(x * blkw, y * blkh, blkw, blkh); } } QRcode_free(code); code = NULL; } }
void printQRCode(const char *url) { QRcode *qrcode = QRcode_encodeString("http://localhost/btctl.apk", /*version*/0, QR_ECLEVEL_M, /*hint*/ QR_MODE_8, /*casesensitive*/ 1 ); printf("qrcode: %p\n", qrcode); if(qrcode) { // const char *BYTES[] = {" ", /*50%oben*/ "\xE2\x96\x80", /*50%unten*/ "\xE2\x96\x84", /*100%*/ "\xE2\x96\x88"}; const char *BYTES_INVERTED[] = {/*100%*/ "\xE2\x96\x88", /*50%unten*/ "\xE2\x96\x84", /*50%oben*/ "\xE2\x96\x80", " "}; printf("version: %d, width: %d\n\n",qrcode->version, qrcode->width); for(int x=0; x < qrcode->width+2; x++) printf(BYTES_INVERTED[1]); printf("\n"); for(int y=0; y < qrcode->width; y++) { printf(BYTES_INVERTED[0]); for(int x=0; x < qrcode->width; x++) { int val=qrcode->data[y*qrcode->width + x] & 1; if((y+1) < qrcode->width) { val|=(qrcode->data[(y+1)*qrcode->width + x] & 1) << 1; // nächste zeile } // 1=black/0=white printf(BYTES_INVERTED[val]); } y++; printf(BYTES_INVERTED[0]); printf("\n"); } for(int x=0; x < qrcode->width+2; x++) printf(BYTES_INVERTED[2]); printf("\n"); QRcode_free(qrcode); printf("\n"); } else { printf("error: %m\n"); // %m = strerror(errno) ohne argument exit(1); } return; }
static shared_ptr<PixelTransferBuffer> addressToPTB(const NetAddress& addr) { std::string str = std::string("HTTP://") + addr.ipString() + ":" + format("%d", addr.port()); debugAssert(str.size() <= 28); QRcode* qrcode = encode(str.c_str(), (int)str.size()); const int N = qrcode->width; shared_ptr<PixelTransferBuffer> buffer = CPUPixelTransferBuffer::create(N, N, ImageFormat::L8()); unorm8* dst = reinterpret_cast<unorm8*>(buffer->mapWrite()); const unsigned char* src = qrcode->data; const unorm8 BLACK = unorm8::fromBits(0x00); const unorm8 WHITE = unorm8::fromBits(0xFF); for (int i = 0; i < N * N; ++i) { // The bytes are in the opposite convention dst[i] = (src[i] & 1) ? BLACK : WHITE; } dst = NULL; buffer->unmap(); QRcode_free(qrcode); return buffer; }
void QRCodeDialog::genCode() { QString uri = getURI(); if (uri != "") { ui->lblQRCode->setText(""); QRcode *code = QRcode_encodeString(uri.toUtf8().constData(), 0, QR_ECLEVEL_L, QR_MODE_8, 1); if (!code) { ui->lblQRCode->setText(tr("Error encoding URI into QR Code.")); return; } myImage = QImage(code->width + 8, code->width + 8, QImage::Format_RGB32); myImage.fill(0xffffff); unsigned char *p = code->data; for (int y = 0; y < code->width; y++) { for (int x = 0; x < code->width; x++) { myImage.setPixel(x + 4, y + 4, ((*p & 1) ? 0x0 : 0xffffff)); p++; } } QRcode_free(code); ui->lblQRCode->setPixmap(QPixmap::fromImage(myImage).scaled(300, 300)); } else ui->lblQRCode->setText(tr("Resulting URI too long, try to reduce the text for label / message.")); }
void test_encode(void) { QRinput *stream; char num[9] = "01234567"; unsigned char *frame; int err = 0; int x, y, w; int mask; QRcode *qrcode; testStart("Test encode (1-M)"); stream = QRinput_new(); QRinput_append(stream, QR_MODE_NUM, 8, (unsigned char *)num); for(mask=0; mask<8; mask++) { QRinput_setVersion(stream, 1); QRinput_setErrorCorrectionLevel(stream, QR_ECLEVEL_M); qrcode = QRcode_encodeMask(stream, mask); w = qrcode->width; frame = qrcode->data; for(y=0; y<w; y++) { for(x=0; x<w; x++) { if(((m1pat[mask][y] >> (20-x)) & 1) != (frame[y*w+x]&1)) { printf("Diff in mask=%d (%d,%d)\n", mask, x, y); err++; } } } QRcode_free(qrcode); } QRinput_free(stream); testEnd(err); }
void test_format(void) { unsigned char *frame, *masked; int version, mask, width, dmask; QRecLevel level, dlevel; QRcode *code; int ret; testStart("Checking format info."); for(version=1; version<=QRSPEC_VERSION_MAX; version++) { frame = QRspec_newFrame(version); width = QRspec_getWidth(version); for(level=0; level<4; level++) { for(mask=0; mask<8; mask++) { masked = Mask_makeMask(width, frame, mask, level); code = QRcode_new(version, width, masked); ret = QRcode_decodeFormat(code, &dlevel, &dmask); assert_zero(ret, "Something wrong in format info.\n"); assert_equal(dlevel, level, "Decoded level is wrong: %d, expected %d", dlevel, level); assert_equal(dmask, mask, "Decoded mask is wrong: %d, expected %d", dlevel, level); QRcode_free(code); } } free(frame); } testFinish(); }
void test_newframe(void) { unsigned char buf[QRSPEC_WIDTH_MAX * QRSPEC_WIDTH_MAX]; int i, width; size_t len; FILE *fp; unsigned char *frame; QRcode *qrcode; unsigned int version; testStart("Checking newly created frame."); fp = fopen("frame", "rb"); if(fp == NULL) { perror("Failed to open \"frame\":"); abort(); } for(i=1; i<=QRSPEC_VERSION_MAX; i++) { frame = QRspec_newFrame(i); width = QRspec_getWidth(i); len = fread(buf, 1, width * width, fp); if((int)len != width * width) { perror("Failed to read the pattern file:"); abort(); } assert_zero(memcmp(frame, buf, len), "frame pattern mismatch (version %d)\n", i); qrcode = QRcode_new(i, width, frame); version = QRcode_decodeVersion(qrcode); assert_equal(version, i, "Decoded version number is wrong: %d, expected %d.\n", version, i); QRcode_free(qrcode); } testFinish(); fclose(fp); }
void test_oddBitCalcMQR(void) { /* test issue #25 (odd bits calculation bug) */ /* test pattern contributed by vlad417 */ TestString tests[] = { {"46194", 1, QR_ECLEVEL_L, QR_MODE_8, 1}, {"WBA5Y47YPQQ", 3, QR_ECLEVEL_L, QR_MODE_8, 1} }; QRcode *qrcode; QRdata *qrdata; int i; testStart("Odd bits calculation bug checking (MQR)."); for(i=0; i<_countof(tests); i++) { qrcode = QRcode_encodeStringMQR(tests[i].str, tests[i].version, tests[i].level, tests[i].hint, tests[i].casesensitive); assert_nonnull(qrcode, "Failed to encode: %s\n", tests[i].str); if(qrcode == NULL) continue; qrdata = QRcode_decodeMQR(qrcode); assert_nonnull(qrdata, "Failed to decode.\n"); assert_zero(strcmp((char *)qrdata->data, tests[i].str), "Decoded data (%s) mismatched (%s)\n", (char *)qrdata->data, tests[i].str); if(qrdata != NULL) QRdata_free(qrdata); QRcode_free(qrcode); } testFinish(); }
QRWidget::~QRWidget() { if(qr != NULL) { QRcode_free(qr); } }
void test_encode3(void) { QRcode *code1, *code2; QRinput *input; testStart("Compare encodeString and encodeInput"); code1 = QRcode_encodeString("0123456", 0, QR_ECLEVEL_L, QR_MODE_8, 0); input = QRinput_new2(0, QR_ECLEVEL_L); QRinput_append(input, QR_MODE_NUM, 7, (unsigned char *)"0123456"); code2 = QRcode_encodeInput(input); testEnd(memcmp(code1->data, code2->data, code1->width * code1->width)); QRcode_free(code1); QRcode_free(code2); QRinput_free(input); }
void qrcode_clock::updateTime() { // get time QDateTime time = QDateTime::currentDateTime(); QString timeStr(QString::number(time.toTime_t())); // encode time as QR code QRcode *qrCodeMatrix(QRcode_encodeString8bit(timeStr.toStdString().c_str(), 0, QR_ECLEVEL_H)); if (!qrCodeMatrix) { qDebug() << "kein QrCode erzeugt"; return; } // transfer QR code into picture m_qrImage = new QImage(qrCodeMatrix->width, qrCodeMatrix->width, QImage::Format_Mono); for (int i = 0; i < qrCodeMatrix->width; ++i) { for (int j = 0; j < qrCodeMatrix->width; ++j) { m_qrImage->setPixel(j, i, qrCodeMatrix->data[i * qrCodeMatrix->width + j] & 1); } } QRcode_free(qrCodeMatrix); m_qrImage->setColor(0, qRgb(255,255,255)); m_qrImage->setColor(1, qRgb(0,0,0)); m_qrClock->setPixmap(QPixmap::fromImage(*m_qrImage)); // show human readable time m_humanClock->setText(time.toUTC().toString() + " UTC"); }
/* * Qrcode data encoding, implements Barcode2dBase::encode() */ bool BarcodeQrcode::encode( const std::string& cookedData, Matrix<bool>& encodedData ) { QRcode *qrcode = QRcode_encodeString( cookedData.c_str(), 0, QR_ECLEVEL_M, QR_MODE_8, 1 ); if ( qrcode == NULL ) { return false; } int w = qrcode->width; encodedData.resize( w, w ); for ( int iy = 0; iy < w; iy++ ) { for ( int ix = 0; ix < w; ix++ ) { encodedData[iy][ix] = qrcode->data[ iy*w + ix ] & 0x01; } } QRcode_free( qrcode ); QRcode_clearCache(); return true; }
void QRWidget::paintEvent(QPaintEvent *) { QPainter painter(this); QRcode *qrcode = QRcode_encodeString(data.constData(), 1, QR_ECLEVEL_L, QR_MODE_8, 1); if (qrcode != NULL) { QColor fg(Qt::black); QColor bg(Qt::white); painter.setBrush(bg); painter.setPen(Qt::NoPen); const double w = width(); const double h = height(); painter.drawRect(0, 0, w, h); painter.setBrush(fg); const int s = qrcode->width > 0 ? qrcode->width : 1; const double aspect = w / h; const double scale = ((aspect > 1.0) ? h : w) / s; for(int y = 0; y < s; y++){ const int yy = y * s; for(int x = 0; x < s; x++){ const int xx = yy + x; const unsigned char b = qrcode->data[xx]; if(b &0x01){ const double rx1 = x * scale, ry1 = y * scale; QRectF r(rx1, ry1, scale, scale); painter.drawRects(&r,1); } } } QRcode_free(qrcode); } else { qWarning() << tr("Generating QR code failed."); } }
QImage TcQrencode::encodeImage(const QString& s, int bulk) { QImage ret; QRcode* qr = QRcode_encodeString(s.toUtf8(), 1, QR_ECLEVEL_Q, QR_MODE_8, 0); if ( qr != NULL ) { int allBulk = (qr->width) * bulk; ret = QImage(allBulk, allBulk, QImage::Format_Mono); QPainter painter(&ret); QColor fg("black"); QColor bg("white"); painter.setBrush(bg); painter.setPen(Qt::NoPen); painter.drawRect(0, 0, allBulk, allBulk); painter.setBrush(fg); for( int y=0; y<qr->width; y++ ) { for( int x=0; x<qr->width; x++ ) { if ( qr->data[y*qr->width+x] & 1 ) { QRectF r(x*bulk, y*bulk, bulk, bulk); painter.drawRects(&r, 1); } } } QRcode_free(qr); } return ret; }
lglBarcode * gl_barcode_iec18004_new (const gchar *id, gboolean text_flag, gboolean checksum_flag, gdouble w, gdouble h, const gchar *digits) { gint i_width, i_height; lglBarcode *gbc; QRcode *qrcode; if ( *digits == '\0' ) { return NULL; } i_width = 0; i_height = 0; qrcode = QRcode_encodeString ((const char *)digits, 0, QR_ECLEVEL_M, QR_MODE_8, 1); if (qrcode == NULL) { return NULL; } i_width = i_height = qrcode->width; gbc = render_iec18004 ((const gchar *)qrcode->data, i_width, i_height, w, h); QRcode_free ( qrcode ); return gbc; }
static void QRcode_List_freeEntry(QRcode_List *entry) { if(entry != NULL) { QRcode_free(entry->code); free(entry); } }
int main(int argc, char* argv[]) { QRcode * qrcode = QRcode_encodeString8bit(argv[1], 4 , QR_ECLEVEL_L); int width = qrcode->width; int x,y,i = 0; unsigned char * data=qrcode->data; printf("P1\n %d %d\n", width, width); for(y=0; y < width; y++) { for(x =0; x <width; x++, i++) { printf((data[i] & 1)?"1 " : "0 "); } printf("\n"); } QRcode_free(qrcode); return 0; }
char * qrencode( UDF_INIT* initid, UDF_ARGS* args, unsigned long *length, char* is_null, char *error ) { struct mem_encode state; state.buffer = NULL; state.size = 0; QRcode *qrcode = NULL; qrcode = QRcode_encodeString( args->args[0], 0, QR_ECLEVEL_H, QR_MODE_8, 1); if ( qrcode ) { qrcode_to_png( &state, qrcode ); if ( state.buffer ) { initid->ptr = state.buffer; *length = state.size; fprintf( stderr, "qrcode size = %lu\n", *length ); fflush(stderr); } else { *is_null = 1; *error = 1; initid->ptr = 0; } QRcode_free( qrcode ); } else { *is_null = 1; *error = 1; initid->ptr = 0; } return initid->ptr; }
void ReceiveRequestDialog::update() { if(!model) return; QString target = info.label; if(target.isEmpty()) target = info.address; setWindowTitle(tr("Request payment to %1").arg(target)); QString uri = GUIUtil::formatDarcoinURI(info); ui->btnSaveAs->setEnabled(false); QString html; html += "<html><font face='verdana, arial, helvetica, sans-serif'>"; html += "<b>"+tr("Payment information")+"</b><br>"; html += "<b>"+tr("URI")+"</b>: "; html += "<a href=\""+uri+"\">" + GUIUtil::HtmlEscape(uri) + "</a><br>"; html += "<b>"+tr("Address")+"</b>: " + GUIUtil::HtmlEscape(info.address) + "<br>"; if(info.amount) html += "<b>"+tr("Amount")+"</b>: " + DarcoinUnits::formatWithUnit(model->getDisplayUnit(), info.amount) + "<br>"; if(!info.label.isEmpty()) html += "<b>"+tr("Label")+"</b>: " + GUIUtil::HtmlEscape(info.label) + "<br>"; if(!info.message.isEmpty()) html += "<b>"+tr("Message")+"</b>: " + GUIUtil::HtmlEscape(info.message) + "<br>"; ui->outUri->setText(html); #ifdef USE_QRCODE ui->lblQRCode->setText(""); if(!uri.isEmpty()) { // limit URI length if (uri.length() > MAX_URI_LENGTH) { ui->lblQRCode->setText(tr("Resulting URI too long, try to reduce the text for label / message.")); } else { QRcode *code = QRcode_encodeString(uri.toUtf8().constData(), 0, QR_ECLEVEL_L, QR_MODE_8, 1); if (!code) { ui->lblQRCode->setText(tr("Error encoding URI into QR Code.")); return; } QImage myImage = QImage(code->width + 8, code->width + 8, QImage::Format_RGB32); myImage.fill(0xffffff); unsigned char *p = code->data; for (int y = 0; y < code->width; y++) { for (int x = 0; x < code->width; x++) { myImage.setPixel(x + 4, y + 4, ((*p & 1) ? 0x0 : 0xffffff)); p++; } } QRcode_free(code); ui->lblQRCode->setPixmap(QPixmap::fromImage(myImage).scaled(300, 300)); ui->btnSaveAs->setEnabled(true); } } #endif }
void test_null_free(void) { testStart("Testing free NULL pointers"); assert_nothing(QRcode_free(NULL), "Check QRcode_free(NULL).\n"); assert_nothing(QRcode_List_free(NULL), "Check QRcode_List_free(NULL).\n"); assert_nothing(QRraw_free(NULL), "Check QRraw_free(NULL).\n"); testFinish(); }
static gboolean qr_avatar_render_hook(gpointer source, gpointer data) { AvatarRender *ar = (AvatarRender *)source; GtkWidget *image = NULL; gchar * text; QRcode *qrcode; unsigned char * qrdata; GdkPixbuf *pixbuf, *pixbuf_scaled; int i, j, k, rowstride, channels; guchar *pixel; debug_print("qr-avatar qr_avatar_render_hook() invoked\n"); if ((text = procmsg_msginfo_get_avatar(ar->full_msginfo, QR_AVATAR_QR_AVATAR)) != NULL) { if ((qrcode = QRcode_encodeString8bit(text, 0, QR_ECLEVEL_L)) == NULL) return FALSE; qrdata = qrcode->data; pixbuf = gdk_pixbuf_new(GDK_COLORSPACE_RGB, FALSE, 8, qrcode->width, qrcode->width); pixel = gdk_pixbuf_get_pixels(pixbuf); rowstride = gdk_pixbuf_get_rowstride(pixbuf); channels = gdk_pixbuf_get_n_channels(pixbuf); gdk_pixbuf_fill(pixbuf, 0xffffffff); for (i = 0; i < qrcode->width; i++) for (j = 0; j < qrcode->width; j++) { for (k = 0; k < channels; k++) pixel[i * rowstride + j * channels + k] = !(*qrdata & 0x1) * 0xff; qrdata++; } /* claws-mail is limited to avatar with 48x48 pixels * TODO: skip scaling as soon as different sizes are supported */ pixbuf_scaled = gdk_pixbuf_scale_simple(pixbuf, QR_AVATAR_SIZE, QR_AVATAR_SIZE, GDK_INTERP_BILINEAR); QRcode_free(qrcode); g_object_unref(pixbuf); image = gtk_image_new_from_pixbuf(pixbuf_scaled); g_object_unref(pixbuf_scaled); if (ar->image != NULL) /* previous plugin set one */ gtk_widget_destroy(ar->image); ar->image = image; return TRUE; } return FALSE; /* keep rendering */ }
void test_encode2(void) { QRcode *qrcode; testStart("Test encode (2-H) (no padding test)"); qrcode = QRcode_encodeString("abcdefghijk123456789012", 0, QR_ECLEVEL_H, QR_MODE_8, 0); testEndExp(qrcode->version == 2); QRcode_free(qrcode); }
void test_encodeNull(void) { QRcode *qrcode; testStart("Test encode NULL."); qrcode = QRcode_encodeString(NULL, 0, QR_ECLEVEL_H, QR_MODE_8, 0); assert_null(qrcode, "QRcode_encodeString() returned something.\n"); testFinish(); if(qrcode != NULL) QRcode_free(qrcode); }
void test_encodeEmpty8(void) { QRcode *qrcode; testStart("Test encode an empty string."); qrcode = QRcode_encodeString8bit("", 0, QR_ECLEVEL_H); assert_null(qrcode, "QRcode_encodeString8bit() returned something.\n"); testFinish(); if(qrcode != NULL) QRcode_free(qrcode); }
QrWidget::~QrWidget() { delete ui; if (nullptr != qr) { QRcode_free(qr); qr = nullptr; } }