Skip to content

Commit

Permalink
x86_64 compile error fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
rittwage committed Aug 11, 2010
1 parent 955796b commit 917630c
Show file tree
Hide file tree
Showing 7 changed files with 45 additions and 45 deletions.
6 changes: 3 additions & 3 deletions GNU/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ CBM_LNX_PATH= /usr/local
CBM_WIN_PATH= ../

# Default compile flags. Be careful with optimization (-O2)
CFLAGS= -std=c99 ${WARNS}
CFLAGS=${WARNS}

# cl65 defs, contributed by Ullrich von Bassewitz <uz(at)musoftware(dot)de>
# (cc65 >= 2.6 required)
Expand All @@ -44,13 +44,13 @@ dos:
buildall

linux:
${MAKE} CFLAGS="-I include/LINUX/ -I ${CBM_LNX_PATH}/include ${CFLAGS}" \
${MAKE} CFLAGS="-I include/LINUX/ -I ${CBM_LNX_PATH}/include ${CFLAGS} -std=c99" \
LDFLAGS="-L${CBM_LNX_PATH}/lib -lopencbm" \
-f GNU/Makefile \
buildall

win32:
${MAKE} CFLAGS="-I include/WINDOWS/ -I ${CBM_WIN_PATH}/include -D WIN32 ${CFLAGS} -mno-cygwin" \
${MAKE} CFLAGS="-I include/WINDOWS/ -I ${CBM_WIN_PATH}/include -D WIN32 ${CFLAGS} -mno-cygwin -std=c99" \
LDFLAGS="-mno-cygwin -L${CBM_WIN_PATH}/bin/i386/ -lopencbm" \
EXE=".exe" \
-f GNU/Makefile \
Expand Down
2 changes: 1 addition & 1 deletion crc.c
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ crc
crcSlow(unsigned char const message[], int nBytes)
{
crc remainder = INITIAL_REMAINDER;
signed long int byte;
int byte;
unsigned char bit;


Expand Down
2 changes: 1 addition & 1 deletion gcr.c
Original file line number Diff line number Diff line change
Expand Up @@ -809,7 +809,7 @@ extract_GCR_track(BYTE *destination, BYTE *source, BYTE *align, int track, size_
if(verbose)
{
sector0_pos = find_sector0(work_buffer, track_len, &sector0_len);
printf("{sec0=%.4zu;len=%zu} ",(sector0_pos - work_buffer), sector0_len);
printf("{sec0=%.4d;len=%zu} ",(sector0_pos - work_buffer), sector0_len);
}

/* forced track alignments */
Expand Down
2 changes: 1 addition & 1 deletion nibread.c
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ main(int argc, char *argv[])
case 'e': // change read retries
if (!(*argv)[2]) usage();
error_retries = atoi(&(*argv)[2]);
printf("* Read retries set to %d\n", error_retries);
printf("* Read retries set to %zu\n", error_retries);
break;

case 'm':
Expand Down
38 changes: 19 additions & 19 deletions nibscan.c
Original file line number Diff line number Diff line change
Expand Up @@ -341,11 +341,11 @@ compare_disks(void)

for (track = start_track; track <= end_track; track += track_inc)
{
printf("%4.1f, Disk 1: (%d) %d\n",
(float) track / 2, (track_density[track] & 3), track_length[track]);
printf("%4.1f, Disk 1: (%d) %lu\n",
(float)track/2, track_density[track]&3, track_length[track]);

printf("%4.1f, Disk 2: (%d) %d\n",
(float) track / 2, (track_density2[track] & 3), track_length2[track]);
printf("%4.1f, Disk 2: (%d) %lu\n",
(float)track/2, track_density2[track]&3, track_length2[track]);

if(!check_formatted(track_buffer + (track * NIB_TRACK_LENGTH), track_length[track]))
{
Expand Down Expand Up @@ -451,17 +451,17 @@ compare_disks(void)
}

printf("\n---------------------------------------------------------------------\n");
printf("%d/%d tracks had a perfect GCR match\n", gcr_total, numtracks);
printf("%zu/%zu tracks had a perfect GCR match\n", gcr_total, numtracks);
//printf("Matches (%s)\n", gcr_matches);
//printf("Mismatches (%s)\n", gcr_mismatches);
//printf("\n");
printf("%d/%d of likely formatted tracks matched all sector data\n", trk_total, numtracks);
printf("%zu/%zu of likely formatted tracks matched all sector data\n", trk_total, numtracks);
//printf("Matches (%s)\n", sec_matches);
//printf("Mismatches (%s)\n", sec_mismatches);
//printf("\n");
printf("%d/%d total sectors (or errors) matched (%d mismatched)\n", sec_total, numsecs, numsecs-sec_total);
printf("CBM DOS errors (d1/%d - d2/%d)\n",errors_d1, errors_d2);
printf("%d tracks had mismatched densities (%s)\n", dens_mismatch, dens_mismatches);
printf("%zu/%zu total sectors (or errors) matched (%zu mismatched)\n", sec_total, numsecs, numsecs-sec_total);
printf("CBM DOS errors (d1/%zu - d2/%zu)\n",errors_d1, errors_d2);
printf("%zu tracks had mismatched densities (%s)\n", dens_mismatch, dens_mismatches);

if(!(id[0]==id2[0] && id[1]==id2[1]))
printf("\nFormat ID's do not match!:\t(%s != %s)", id, id2);
Expand Down Expand Up @@ -523,7 +523,7 @@ scandisk(void)
if(!check_formatted(track_buffer + (track * NIB_TRACK_LENGTH), track_length[track]))
printf("UNFORMATTED!");
else
printf("%d", track_length[track]);
printf("%zu", track_length[track]);

if (track_length[track] > 0)
{
Expand Down Expand Up @@ -557,7 +557,7 @@ scandisk(void)

if (badgcr_tracks[track])
{
printf("badgcr:%d ", badgcr_tracks[track]);
printf("badgcr:%zu ", badgcr_tracks[track]);
totalgcr += badgcr_tracks[track];
}
}
Expand Down Expand Up @@ -622,9 +622,9 @@ scandisk(void)
}
}
printf("\n---------------------------------------------------------------------\n");
printf("%d unrecognized sectors (CBM disk errors) detected\n", errors);
printf("%d known empty sectors detected\n", empty);
printf("%d bad GCR bytes detected\n", totalgcr);
printf("%zu unrecognized sectors (CBM disk errors) detected\n", errors);
printf("%zu known empty sectors detected\n", empty);
printf("%zu bad GCR bytes detected\n", totalgcr);
printf("%d fat tracks detected\n", totalfat);
printf("%d rapidlok tracks detected\n", totalrl);
printf("%d tracks with non-standard density\n", total_wrong_density);
Expand Down Expand Up @@ -667,9 +667,9 @@ raw_track_info(BYTE * gcrdata, size_t length)
}
}

printf("\nSYNCS:%d (", sync_cnt);
printf("\nSYNCS:%zu (", sync_cnt);
for (i = 1; i <= sync_cnt; i++)
printf("%d-", sync_len[i]);
printf("%zu-", sync_len[i]);
printf(")");

/* count gaps/lengths - this code is innacurate, since gaps are of course not always 0x55 - they rarely are */
Expand Down Expand Up @@ -715,9 +715,9 @@ raw_track_info(BYTE * gcrdata, size_t length)
}
}

printf("\nBADGCR:%d (", bad_cnt);
printf("\nBADGCR:%zu (", bad_cnt);
for (i = 1; i <= bad_cnt; i++)
printf("%d-", bad_len[i]);
printf("%zu-", bad_len[i]);
printf(")");

return 1;
Expand Down Expand Up @@ -791,7 +791,7 @@ size_t check_rapidlok(int track)
}

printf("RAPIDLOK! ");
printf("key:%d, sync:%d...", keylen, synclen);
printf("key:%zu, sync:%zu...", keylen, synclen);

#if 0
// recreate key sector
Expand Down
30 changes: 15 additions & 15 deletions read.c
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ BYTE paranoia_read_halftrack(CBM_FILE fd, int halftrack, BYTE * buffer)
if(denso & BM_FF_TRACK)
{
printf("[Killer Track] ");
fprintf(fplog, "[Killer Track] %s (%d)", errorstring, leno);
fprintf(fplog, "[Killer Track] %s (%zu)", errorstring, leno);
memcpy(buffer, bufo, NIB_TRACK_LENGTH);
return (denso);
}
Expand All @@ -166,7 +166,7 @@ BYTE paranoia_read_halftrack(CBM_FILE fd, int halftrack, BYTE * buffer)
if (!leno)
{
printf("[Unformatted Track] ");
fprintf(fplog, "[Unformatted Track] %s (%d)", errorstring, leno);
fprintf(fplog, "[Unformatted Track] %s (%zu)", errorstring, leno);
memcpy(buffer, bufo, NIB_TRACK_LENGTH);
return (denso);
}
Expand All @@ -175,8 +175,8 @@ BYTE paranoia_read_halftrack(CBM_FILE fd, int halftrack, BYTE * buffer)
// try again, probably bad read or a bad GCR match
if (leno < capacity_min[denso & 3] - CAP_ALLOWANCE)
{
printf("Short Read! (%d) ", leno);
fprintf(fplog, "[%d<%d!] ", leno, capacity_min[denso & 3] - CAP_ALLOWANCE);
printf("Short Read! (%zu) ", leno);
fprintf(fplog, "[%zu<%lu!] ", leno, capacity_min[denso & 3] - CAP_ALLOWANCE);
if(l < (error_retries - 3)) l = error_retries - 3;
continue;
}
Expand All @@ -185,14 +185,14 @@ BYTE paranoia_read_halftrack(CBM_FILE fd, int halftrack, BYTE * buffer)
// try again to make sure it's intentional
if (leno > capacity_max[denso & 3] + CAP_ALLOWANCE)
{
printf("Long Read! (%d) ", leno);
fprintf(fplog, "[%d>%d!] ", leno, capacity_max[denso & 3] + CAP_ALLOWANCE);
printf("Long Read! (%zu) ", leno);
fprintf(fplog, "[%zu>%lu!] ", leno, capacity_max[denso & 3] + CAP_ALLOWANCE);
if(l < (error_retries - 3)) l = error_retries - 3;
continue;
}

printf("%d ", leno);
fprintf(fplog, "%d ", leno);
printf("%zu ", leno);
fprintf(fplog, "%zu ", leno);

// check for CBM DOS errors
errors = check_errors(cbufo, leno, halftrack, diskid, errorstring);
Expand Down Expand Up @@ -222,8 +222,8 @@ BYTE paranoia_read_halftrack(CBM_FILE fd, int halftrack, BYTE * buffer)
}
else
{
printf("[%d Errors] ", errors);
fprintf(fplog, "[%d Errors] ", errors);
printf("[%zu Errors] ", errors);
fprintf(fplog, "[%zu Errors] ", errors);
}

// Fix bad GCR in track for compare
Expand All @@ -246,8 +246,8 @@ BYTE paranoia_read_halftrack(CBM_FILE fd, int halftrack, BYTE * buffer)
memset(cbufn, 0, NIB_TRACK_LENGTH);
lenn = extract_GCR_track(cbufn, bufn, &align, halftrack/2, capacity_min[densn & 3], capacity_max[densn & 3]);

printf("%d ", lenn);
fprintf(fplog, "%d ", lenn);
printf("%zu ", lenn);
fprintf(fplog, "%zu ", lenn);

// fix bad GCR in track for compare
badgcr = check_bad_gcr(cbufn, lenn);
Expand Down Expand Up @@ -277,12 +277,12 @@ BYTE paranoia_read_halftrack(CBM_FILE fd, int halftrack, BYTE * buffer)

if (badgcr)
{
printf("(bad/weak:%d)", badgcr);
fprintf(fplog, "(bad/weak:%d) ", badgcr);
printf("(bad/weak:%zu)", badgcr);
fprintf(fplog, "(bad/weak:%zu) ", badgcr);
}

//printf("\n");
fprintf(fplog, "%s (%d)", errorstring, leno);
fprintf(fplog, "%s (%zu)", errorstring, leno);
memcpy(buffer, bufo, NIB_TRACK_LENGTH);
return denso;
}
Expand Down
10 changes: 5 additions & 5 deletions write.c
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ master_track(CBM_FILE fd, BYTE *track_buffer, BYTE *track_density, int track, si
if(skewbytes > NIB_TRACK_LENGTH)
skewbytes = skewbytes - NIB_TRACK_LENGTH;

printf(" {skew=%d} ", skewbytes);
printf(" {skew=%zu} ", skewbytes);
}

/* check that our first sync is long enough (if the track has sync)
Expand Down Expand Up @@ -73,7 +73,7 @@ master_track(CBM_FILE fd, BYTE *track_buffer, BYTE *track_density, int track, si
/* handle short tracks */
if(track_length < capacity[track_density[track] & 3])
{
printf("[pad:%d]", capacity[track_density[track] & 3] - track_length);
printf("[pad:%lu]", capacity[track_density[track] & 3] - track_length);
track_length = capacity[track_density[track] & 3];
}

Expand Down Expand Up @@ -138,7 +138,7 @@ master_disk(CBM_FILE fd, BYTE *track_buffer, BYTE *track_density, size_t *track_

badgcr = check_bad_gcr(track_buffer + (track * NIB_TRACK_LENGTH), track_length[track]);
length = compress_halftrack(track, track_buffer + (track * NIB_TRACK_LENGTH), track_density[track], track_length[track]);
printf("[badgcr:%d] ", badgcr);
printf("[badgcr:%zu] ", badgcr);

master_track(fd, track_buffer, track_density, track, length);
}
Expand Down Expand Up @@ -193,12 +193,12 @@ master_disk_raw(CBM_FILE fd, BYTE *track_buffer, BYTE *track_density, size_t *tr
else if (track_density[track] & BM_FF_TRACK)
printf(":KILLER");

printf(") (%d) ", length);
printf(") (%zu) ", length);

/* truncate the end if needed (reduce tail) */
if ( (length > capacity[density & 3]) && (length != NIB_TRACK_LENGTH) )
{
printf(" (trunc:%d) ", length - capacity[density & 3]);
printf(" (trunc:%lu) ", length - capacity[density & 3]);
length = capacity[density & 3];
}
master_track(fd, track_buffer, track_density, track, length);
Expand Down

0 comments on commit 917630c

Please sign in to comment.