Fix windows issues.

This commit is contained in:
Serge Vakulenko 2018-09-07 23:38:52 -07:00
parent 18a22a48b6
commit f765b68586
5 changed files with 16 additions and 10 deletions

View File

@ -1,6 +1,6 @@
CC = gcc
VERSION = 0.3
VERSION = 0.4
GITCOUNT = $(shell git rev-list HEAD --count)
CFLAGS = -g -O -Wall -Werror -DVERSION='"$(VERSION).$(GITCOUNT)"'
LDFLAGS = -g

View File

@ -141,7 +141,7 @@ static int dev_read(int request, int value, int length, PBYTE buffer)
rq->Index = 0;
rq->Length = length;
if (!DeviceIoControl(dev, PU_VENDOR_REQUEST, rq, rqlen + length,
if (!DeviceIoControl(dev, PU_VENDOR_REQUEST, rq, rqlen,
buffer, length, &nbytes, NULL)) {
return -1;
}

View File

@ -185,7 +185,8 @@ typedef struct {
//
typedef struct {
// Bytes 0-2
uint32_t id : 24; // Call ID: 1...16777215
uint8_t id[3]; // Call ID: 1...16777215
#define CONTACT_ID(ct) ((ct)->id[0] | ((ct)->id[1] << 8) | ((ct)->id[2] << 16))
// Byte 3
uint8_t type : 2, // Call Type: Group Call, Private Call or All Call
@ -509,7 +510,9 @@ static void setup_contact(int index, const char *name, int type, int id, int rxt
{
contact_t *ct = GET_CONTACT(index);
ct->id = id;
ct->id[0] = id;
ct->id[1] = id >> 8;
ct->id[2] = id >> 16;
ct->type = type;
ct->receive_tone = rxtone;
@ -1208,7 +1211,7 @@ static void md380_print_config(radio_device_t *radio, FILE *out, int verbose)
fprintf(out, "%5d ", i+1);
print_unicode(out, ct->name, 16, 1);
fprintf(out, " %-7s %-8d %s\n",
CONTACT_TYPE[ct->type], ct->id, ct->receive_tone ? "+" : "-");
CONTACT_TYPE[ct->type], CONTACT_ID(ct), ct->receive_tone ? "+" : "-");
}
}

View File

@ -176,7 +176,7 @@ void radio_save_image(const char *filename)
FILE *img;
fprintf(stderr, "Write codeplug to file '%s'.\n", filename);
img = fopen(filename, "w");
img = fopen(filename, "wb");
if (! img) {
perror(filename);
exit(-1);
@ -313,7 +313,7 @@ void radio_write_csv(const char *filename)
exit(-1);
}
csv = fopen(filename, "rb");
csv = fopen(filename, "r");
if (! csv) {
perror(filename);
exit(-1);

View File

@ -200,7 +200,8 @@ typedef struct {
//
typedef struct {
// Bytes 0-2
uint32_t id : 24; // Call ID: 1...16777215
uint8_t id[3]; // Call ID: 1...16777215
#define CONTACT_ID(ct) ((ct)->id[0] | ((ct)->id[1] << 8) | ((ct)->id[2] << 16))
// Byte 3
uint8_t type : 2, // Call Type: Group Call, Private Call or All Call
@ -564,7 +565,9 @@ static void setup_contact(int index, const char *name, int type, int id, int rxt
{
contact_t *ct = GET_CONTACT(index);
ct->id = id;
ct->id[0] = id;
ct->id[1] = id >> 8;
ct->id[2] = id >> 16;
ct->type = type;
ct->receive_tone = rxtone;
@ -1287,7 +1290,7 @@ static void uv380_print_config(radio_device_t *radio, FILE *out, int verbose)
fprintf(out, "%5d ", i+1);
print_unicode(out, ct->name, 16, 1);
fprintf(out, " %-7s %-8d %s\n",
CONTACT_TYPE[ct->type], ct->id, ct->receive_tone ? "+" : "-");
CONTACT_TYPE[ct->type], CONTACT_ID(ct), ct->receive_tone ? "+" : "-");
}
}