reticulatedpines / magiclantern_simplified

A Git based version of Magic Lantern, for those unwilling or unable to work using Mercurial. The vast majority of branches have been removed, with those thought to be important brought in individually and merged.
GNU General Public License v2.0
142 stars 47 forks source link

reduce compiler warning on ptpcam #101

Closed coon42 closed 1 year ago

coon42 commented 1 year ago

This PR reduces compiler warnings which occur when building contrib/ptpcam. By defining missing function protoypes, using correct return types of functions, add missing includes, fixing wrong or missing format specifiers in format strings etc.

As a piggy back some local redundant and unused PTP command IDs are removed from ptp.h, as they are already defined in https://github.com/reticulatedpines/magiclantern_simplified/blob/dev/contrib/ptpcam/ptp-eos-oc.h

However, there is still one warning left around line 1019:

ptp.h:1019:7: note: expected ‘int’ but argument is of type ‘uint32_t * {aka unsigned int *}’
 void* ptp_chdk_get_memory(int start, int num, PTPParams* params, PTPDeviceInfo* deviceinfo);
       ^~~~~~~~~~~~~~~~~~~
ptpcam.c:3053:55: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
                             uint32_t buffer_address = (uint32_t)ptpbuf->buffers + (num * (ptpbuf->buffer_size + 4));

As I don't know how to fix it yet, I leave it as is for now.