[an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] (none) [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] (none) [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive]
 
[an error occurred while processing this directive] [an error occurred while processing this directive]
Skåne Sjælland Linux User Group - http://www.sslug.dk Home   Subscribe   Mail Archive   Forum   Calendar   Search
MhonArc Date: [Date Prev] [Date Index] [Date Next]   Thread: [Date Prev] [Thread Index] [Date Next]   MhonArc
 

RE: [CPROG] Kode der aldrig bliver kxrt?



Ja, det er en bug.

Mvh,
Karl Palsson

-----Original Message-----
From: Hans Schou [mailto:sslug@sslug
Sent: 17. august 2000 00:54
To: sslug@sslug
Subject: [CPROG] Kode der aldrig bliver kxrt?


Jeg har følgende kode-stump fra gnu-barcode, Interleave 2 of 5:
    int i, sum[2], textpos, usesum = 0;
    if ((bc->flags & BARCODE_NO_CHECKSUM)) usesum = 0; else usesum = 1;
    /* add the leading 0 if needed */
    i = strlen(bc->ascii) + usesum;
    if (i % 2) {
        /* add a leading 0 */
        text[0] = '0';
        strcpy(text+1, bc->ascii);
    } else {
        strcpy(text, bc->ascii);
    }
// nu er strlen(text) et lige tal
    /* add the trailing checksum if needed */
    if (usesum) {
        sum[0] = sum[1] = 0;
        for (i=0; text[i]; i++)
            sum[i%2] += text[i]-'0'; // kun sum[0] og sum[1] tilskrives
        if (strlen(text) % 2)
            i = sum[0] * 3 + sum[1]; // denne linie køres ikke
        else
            i = sum[1] * 3 + sum[2]; // denne linie køres altid
        strcat(text, "0");
        if (i%10)
            text[strlen(text)-1] += 10-(i%10);
    }

Jeg har valgt at bruge "usesum" og den er så lig med 1.
Der referes til sum[2], men det array er kun defineret fra 0-1

Har jeg fundet en bug?

-- 
best regards
+---------------------------------------------------+
! Hans Schou,    Hamletsgade 4-201,   DK-2200 Kbh N !
! Mobil: 2264 8020              http://www.schou.dk !
+---------------------------------------------------+
"Hvis bare jeg kunne få hele verden til at lytte til
mig i tre minutter, ville hele verden blive kommunistisk"
				      -- hørt i DR P1


 
Home   Subscribe   Mail Archive   Index   Calendar   Search

 
 
Questions about the web-pages to <www_admin>. Last modified 2005-08-10, 20:08 CEST [an error occurred while processing this directive]
This page is maintained by [an error occurred while processing this directive]MHonArc [an error occurred while processing this directive] # [an error occurred while processing this directive] *