Skip to content

Commit

Permalink
Fix some typos and missing func to fix CI
Browse files Browse the repository at this point in the history
petabyt committed Mar 10, 2024
1 parent d21ebde commit 9755171
Showing 6 changed files with 18 additions and 22 deletions.
2 changes: 1 addition & 1 deletion src/camlib.h
Original file line number Diff line number Diff line change
@@ -258,7 +258,7 @@ int ptp_read_uint16_array(void *dat, uint16_t *buf, int max);
int ptp_write_string(void *dat, char *string);
int ptp_write_unicode_string(char *dat, char *string);
int ptp_read_unicode_string(char *buffer, char *dat, int max);
void ptp_read_utf8_string(void *dat, char *string, int max);
int ptp_read_utf8_string(void *dat, char *string, int max);

int ptp_read_string2(uint8_t *dat, char *string, int max);
int ptp_write_string2(uint8_t *dat, char *string);
4 changes: 2 additions & 2 deletions src/canon_adv.c
Original file line number Diff line number Diff line change
@@ -186,8 +186,8 @@ static struct Tokens *lex_evproc_command(char string[]) {
char *canon_evproc_pack(int *out_length, char *string) {
int length = 0;
// Allocate some memory for the footer, we will use this later
void *footer = malloc(500);
uint32_t *long_args = footer;
char *footer = malloc(500);
uint32_t *long_args = (uint32_t *)footer;
int footer_length = 0;

// Set long_args to zero
2 changes: 1 addition & 1 deletion src/cl_data.h
Original file line number Diff line number Diff line change
@@ -197,7 +197,7 @@ struct PtpFujiObjectInfo {
#pragma pack(pop)

#ifdef CAMLIB_INCLUDE_IMPL
int ptp_pack_object_info(struct PtpRuntime *r, struct PtpObjectInfo *oi, void *buf, int max);
int ptp_pack_object_info(struct PtpRuntime *r, struct PtpObjectInfo *oi, uint8_t *buf, int max);

int ptp_parse_prop_value(struct PtpRuntime *r);
int ptp_parse_device_info(struct PtpRuntime *r, struct PtpDeviceInfo *di);
4 changes: 2 additions & 2 deletions src/data.c
Original file line number Diff line number Diff line change
@@ -63,7 +63,7 @@ int ptp_parse_data(void *d, int type, int *out) {
ptp_read_u16(d, &b); (*out) = (int)b; return 2;
case PTP_TC_INT32:
case PTP_TC_UINT32:
ptp_read_u16(d, &b); (*out) = (int)b; return 4;
ptp_read_u32(d, &c); (*out) = (int)c; return 4;
}

// skip the array
@@ -108,7 +108,7 @@ int ptp_parse_object_info(struct PtpRuntime *r, struct PtpObjectInfo *oi) {
}

// TODO: Different API
int ptp_pack_object_info(struct PtpRuntime *r, struct PtpObjectInfo *oi, void *buf, int max) {
int ptp_pack_object_info(struct PtpRuntime *r, struct PtpObjectInfo *oi, uint8_t *buf, int max) {
if (1024 > max) {
return 0;
}
2 changes: 1 addition & 1 deletion src/operations.c
Original file line number Diff line number Diff line change
@@ -204,7 +204,7 @@ int ptp_send_object_info(struct PtpRuntime *r, int storage_id, int handle, struc
cmd.params[0] = storage_id;
cmd.params[1] = handle;

char temp[1024];
uint8_t temp[1024];
int length = ptp_pack_object_info(r, oi, temp, sizeof(temp));
if (length == 0) {
return PTP_OUT_OF_MEM;
26 changes: 11 additions & 15 deletions src/packet.c
Original file line number Diff line number Diff line change
@@ -103,7 +103,6 @@ int ptp_write_string(void *dat, char *string) {
}

int ptp_write_string2(uint8_t *dat, char *string) {
uint8_t *old = dat;
return ptp_write_string(&dat, string);
}

@@ -146,23 +145,20 @@ int ptp_read_unicode_string(char *buffer, char *dat, int max) {
return i / 2;
}

#if 0
// Read null terminated UTF8 string
void ptp_read_utf8_string(void *dat, char *string, int max) {
uint8_t **p = (uint8_t **)dat;

int y = 0;
while ((char)(**p) != '\0') {
string[y] = (char)(**p);
(*p)++;
y++;
if (y >= max) { break; }
int ptp_read_utf8_string(void *dat, char *string, int max) {
char *d = (char *)dat;
int x = 0;
while (d[x] != '\0') {
string[x] = d[x];
x++;
if (x > max - 1) break;
}

(*p)++;
string[y] = '\0';
string[x] = '\0';
x++;

return x;
}
#endif

int ptp_read_utf8_string2(void *dat, char *string, int max) {
char *d = (char *)dat;

0 comments on commit 9755171

Please sign in to comment.