Revert "Fix -Wcalloc-transposed-args warnings"
This reverts commit f97c27efe9.
This commit is contained in:
@@ -1091,7 +1091,7 @@ storage_info_func (
|
||||
canon_int_get_disk_name_info (camera, root, &camera->pl->cached_capacity,
|
||||
&camera->pl->cached_available, context);
|
||||
|
||||
*sinfos = (CameraStorageInformation*) calloc (1, sizeof (CameraStorageInformation));
|
||||
*sinfos = (CameraStorageInformation*) calloc (sizeof (CameraStorageInformation), 1);
|
||||
*nrofsinfos = 1;
|
||||
(*sinfos)->fields = GP_STORAGEINFO_BASE;
|
||||
strcpy ((*sinfos)->basedir, "/");
|
||||
|
||||
@@ -329,7 +329,7 @@ camera_init(Camera *camera, GPContext *context)
|
||||
/* Tell the CameraFilesystem where to get lists from */
|
||||
gp_filesystem_set_funcs (camera->fs, &fsfuncs, camera);
|
||||
|
||||
camera->pl = calloc (1, sizeof (CameraPrivateLibrary));
|
||||
camera->pl = calloc (sizeof (CameraPrivateLibrary), 1);
|
||||
if (!camera->pl) return GP_ERROR_NO_MEMORY;
|
||||
|
||||
/* Connect to the camera */
|
||||
|
||||
@@ -1866,7 +1866,7 @@ camera_init (Camera *camera, GPContext *context)
|
||||
int tries;
|
||||
char *result;
|
||||
|
||||
camera->pl = calloc(1, sizeof(CameraPrivateLibrary));
|
||||
camera->pl = calloc(sizeof(CameraPrivateLibrary),1);
|
||||
|
||||
/* First, set up all the function pointers */
|
||||
camera->functions->exit = camera_exit;
|
||||
|
||||
@@ -1021,7 +1021,7 @@ camera_init (Camera *camera, GPContext *context)
|
||||
{
|
||||
CameraPrivateLibrary *cpl;
|
||||
|
||||
cpl = calloc (1, sizeof (CameraPrivateLibrary));
|
||||
cpl = calloc (sizeof (CameraPrivateLibrary), 1);
|
||||
/* pslr = pslr_init (model, device); ... but it basically just opens the fd */
|
||||
cpl->pslr.fd = camera->port;
|
||||
|
||||
|
||||
@@ -307,8 +307,8 @@ fixup_cached_deviceinfo (Camera *camera, PTPDeviceInfo *di) {
|
||||
|
||||
/* Dup and merge the lists */
|
||||
#define DI_MERGE(x) \
|
||||
C_MEM (newdi.x = calloc((ndi.x##_len + outerdi->x##_len), sizeof(outerdi->x[0])); \
|
||||
for (i = 0; i < outerdi->x##_len ; i++) \
|
||||
C_MEM (newdi.x = calloc(sizeof(outerdi->x[0]),(ndi.x##_len + outerdi->x##_len)));\
|
||||
for (i = 0; i < outerdi->x##_len ; i++) \
|
||||
newdi.x[i] = outerdi->x[i]; \
|
||||
for (i = 0; i < ndi.x##_len ; i++) \
|
||||
newdi.x[i+outerdi->x##_len] = ndi.x[i]; \
|
||||
|
||||
@@ -821,7 +821,7 @@ ptp_unpack_OI (PTPParams *params, unsigned char* data, PTPObjectInfo *oi, unsign
|
||||
if (n > (total - (*offset))/sizeof(val->a.v[0].member))\
|
||||
return 0; \
|
||||
val->a.count = n; \
|
||||
val->a.v = calloc(n, sizeof(val->a.v[0])); \
|
||||
val->a.v = calloc(sizeof(val->a.v[0]),n); \
|
||||
if (!val->a.v) return 0; \
|
||||
for (j=0;j<n;j++) \
|
||||
CTVAL(val->a.v[j].member, func); \
|
||||
@@ -1118,7 +1118,7 @@ duplicate_PropertyValue (const PTPPropertyValue *src, PTPPropertyValue *dst, uin
|
||||
unsigned int i;
|
||||
|
||||
dst->a.count = src->a.count;
|
||||
dst->a.v = calloc (src->a.count, sizeof(src->a.v[0]));
|
||||
dst->a.v = calloc (sizeof(src->a.v[0]),src->a.count);
|
||||
for (i=0;i<src->a.count;i++)
|
||||
duplicate_PropertyValue (&src->a.v[i], &dst->a.v[i], type & ~PTP_DTC_ARRAY_MASK);
|
||||
return;
|
||||
@@ -1161,7 +1161,7 @@ duplicate_DevicePropDesc(const PTPDevicePropDesc *src, PTPDevicePropDesc *dst) {
|
||||
break;
|
||||
case PTP_DPFF_Enumeration:
|
||||
dst->FORM.Enum.NumberOfValues = src->FORM.Enum.NumberOfValues;
|
||||
dst->FORM.Enum.SupportedValue = calloc (src->FORM.Enum.NumberOfValues, sizeof(dst->FORM.Enum.SupportedValue[0]));
|
||||
dst->FORM.Enum.SupportedValue = calloc (sizeof(dst->FORM.Enum.SupportedValue[0]),src->FORM.Enum.NumberOfValues);
|
||||
for (i = 0; i<src->FORM.Enum.NumberOfValues ; i++)
|
||||
duplicate_PropertyValue (&src->FORM.Enum.SupportedValue[i], &dst->FORM.Enum.SupportedValue[i], src->DataType);
|
||||
break;
|
||||
@@ -2031,7 +2031,7 @@ ptp_unpack_CANON_changes (PTPParams *params, unsigned char* data, unsigned int d
|
||||
curdata += size;
|
||||
entries++;
|
||||
}
|
||||
ce = calloc (entries + 1, sizeof(PTPCanon_changes_entry));
|
||||
ce = calloc (sizeof(PTPCanon_changes_entry),(entries+1));
|
||||
if (!ce) return 0;
|
||||
|
||||
curdata = data;
|
||||
@@ -2158,7 +2158,7 @@ ptp_unpack_CANON_changes (PTPParams *params, unsigned char* data, unsigned int d
|
||||
dpd->FormFlag = PTP_DPFF_Enumeration;
|
||||
dpd->FORM.Enum.NumberOfValues = propxcnt;
|
||||
free (dpd->FORM.Enum.SupportedValue);
|
||||
dpd->FORM.Enum.SupportedValue = calloc (propxcnt, sizeof (PTPPropertyValue));
|
||||
dpd->FORM.Enum.SupportedValue = calloc (sizeof (PTPPropertyValue),propxcnt);
|
||||
|
||||
switch (proptype) {
|
||||
case PTP_DPC_CANON_EOS_ImageFormat:
|
||||
@@ -2955,7 +2955,7 @@ ptp_unpack_Nikon_EC (PTPParams *params, unsigned char* data, unsigned int len, P
|
||||
if (!*cnt)
|
||||
return;
|
||||
|
||||
*ec = calloc((*cnt), sizeof(PTPContainer));
|
||||
*ec = calloc(sizeof(PTPContainer),(*cnt));
|
||||
|
||||
for (i=0;i<*cnt;i++) {
|
||||
memset(&(*ec)[i],0,sizeof(PTPContainer));
|
||||
@@ -2989,7 +2989,7 @@ ptp_unpack_Nikon_EC_EX (PTPParams *params, unsigned char* data, unsigned int len
|
||||
if (!*cnt)
|
||||
return 1;
|
||||
|
||||
*ec = calloc((*cnt), sizeof(PTPContainer));
|
||||
*ec = calloc(sizeof(PTPContainer),(*cnt));
|
||||
offset = PTP_nikon_ec_ex_Code+sizeof(uint16_t);
|
||||
|
||||
for (i=0;i<*cnt;i++) {
|
||||
@@ -3218,7 +3218,7 @@ ptp_unpack_ptp11_manifest (
|
||||
return 0;
|
||||
numberoifs = dtoh64ap(params,data);
|
||||
curoffset = 8;
|
||||
xoifs = calloc(numberoifs, sizeof(PTPObjectFilesystemInfo));
|
||||
xoifs = calloc(sizeof(PTPObjectFilesystemInfo),numberoifs);
|
||||
if (!xoifs)
|
||||
return 0;
|
||||
|
||||
|
||||
@@ -1473,7 +1473,7 @@ c0 03 00 05 bc 02 1e 00
|
||||
return PTP_RC_GeneralError;
|
||||
}
|
||||
|
||||
*liveviewsizes = calloc (count, sizeof(PanasonicLiveViewSize));
|
||||
*liveviewsizes = calloc (sizeof(PanasonicLiveViewSize),count);
|
||||
for (i = 0;i < count; i++) {
|
||||
(*liveviewsizes)[i].height = dtoh16a (data + 12 + i*structsize);
|
||||
(*liveviewsizes)[i].width = dtoh16a (data + 12 + 2 + i*structsize);
|
||||
@@ -3175,7 +3175,7 @@ ptp_canon_gettreesize (PTPParams* params,
|
||||
PTP_CNT_INIT(ptp, PTP_OC_CANON_GetTreeSize);
|
||||
CHECK_PTP_RC(ptp_transaction(params, &ptp, PTP_DP_GETDATA, 0, &data, &size));
|
||||
*cnt = dtoh32a(data);
|
||||
*entries = calloc((*cnt), sizeof(PTPCanon_directtransfer_entry));
|
||||
*entries = calloc(sizeof(PTPCanon_directtransfer_entry),(*cnt));
|
||||
if (!*entries) {
|
||||
ret = PTP_RC_GeneralError;
|
||||
goto exit;
|
||||
@@ -3927,7 +3927,7 @@ ptp_canon_eos_getdevicepropdesc (PTPParams* params, uint16_t propcode,
|
||||
memcpy (dpd, ¶ms->canon_props[i].dpd, sizeof (*dpd));
|
||||
if (dpd->FormFlag == PTP_DPFF_Enumeration) {
|
||||
/* need to duplicate the Enumeration alloc */
|
||||
dpd->FORM.Enum.SupportedValue = calloc (dpd->FORM.Enum.NumberOfValues, sizeof (PTPPropertyValue));
|
||||
dpd->FORM.Enum.SupportedValue = calloc (sizeof (PTPPropertyValue),dpd->FORM.Enum.NumberOfValues);
|
||||
memcpy (dpd->FORM.Enum.SupportedValue,
|
||||
params->canon_props[i].dpd.FORM.Enum.SupportedValue,
|
||||
sizeof (PTPPropertyValue)*dpd->FORM.Enum.NumberOfValues
|
||||
@@ -5962,7 +5962,7 @@ ptp_fuji_getdeviceinfo (PTPParams* params, uint16_t **props, unsigned int *numpr
|
||||
xdata = data + 4;
|
||||
xsize = size - 4;
|
||||
|
||||
*props = calloc(nums, sizeof(uint16_t));
|
||||
*props = calloc(sizeof(uint16_t),nums);
|
||||
*numprops = nums;
|
||||
for (i=0;i<nums;i++) {
|
||||
PTPDevicePropDesc dpd;
|
||||
|
||||
@@ -565,7 +565,7 @@ camera_init (Camera *camera, GPContext *context)
|
||||
break;
|
||||
}
|
||||
|
||||
camera->pl = calloc (1, sizeof (CameraPrivateLibrary));
|
||||
camera->pl = calloc (sizeof (CameraPrivateLibrary), 1);
|
||||
if (!camera->pl)
|
||||
return (GP_ERROR_NO_MEMORY);
|
||||
camera->pl->gpdev = camera->port;
|
||||
|
||||
@@ -1076,7 +1076,7 @@ storage_info_func (CameraFilesystem *fs,
|
||||
unsigned int totalk = get_u32(&reply.data);
|
||||
unsigned int freek = get_u32(&reply.data[4]);
|
||||
|
||||
sif = *storageinformations = calloc(1, sizeof(CameraStorageInformation));
|
||||
sif = *storageinformations = calloc(sizeof(CameraStorageInformation),1);
|
||||
*nrofstorageinformations = 1;
|
||||
|
||||
sif->fields |= GP_STORAGEINFO_BASE;
|
||||
@@ -1212,7 +1212,7 @@ camera_init (Camera *camera, GPContext *context)
|
||||
gp_port_set_timeout (camera->port, TF_PROTOCOL_TIMEOUT);
|
||||
gp_port_usb_clear_halt (camera->port, GP_PORT_USB_ENDPOINT_IN);
|
||||
|
||||
camera->pl = calloc (1, sizeof (CameraPrivateLibrary));
|
||||
camera->pl = calloc (sizeof (CameraPrivateLibrary),1);
|
||||
if (!camera->pl) return GP_ERROR_NO_MEMORY;
|
||||
|
||||
#if defined(HAVE_ICONV) && defined(HAVE_LANGINFO_H)
|
||||
|
||||
@@ -32,7 +32,7 @@ int main(int argc, char **argv) {
|
||||
|
||||
/* Now open all cameras we autodected for usage */
|
||||
printf("Number of cameras: %d\n", count);
|
||||
cams = calloc (count, sizeof (Camera*));
|
||||
cams = calloc (sizeof (Camera*),count);
|
||||
for (i = 0; i < count; i++) {
|
||||
gp_list_get_name (list, i, &name);
|
||||
gp_list_get_value (list, i, &value);
|
||||
|
||||
@@ -646,7 +646,7 @@ gp_filesystem_new (CameraFilesystem **fs)
|
||||
|
||||
C_MEM (*fs = calloc (1, sizeof (CameraFilesystem)));
|
||||
|
||||
(*fs)->rootfolder = calloc (1, sizeof (CameraFilesystemFolder));
|
||||
(*fs)->rootfolder = calloc (sizeof (CameraFilesystemFolder), 1);
|
||||
if (!(*fs)->rootfolder) {
|
||||
free (*fs);
|
||||
return (GP_ERROR_NO_MEMORY);
|
||||
@@ -716,7 +716,7 @@ internal_append (CameraFilesystem *fs, CameraFilesystemFolder *f,
|
||||
if (*new)
|
||||
return (GP_ERROR_FILE_EXISTS);
|
||||
|
||||
C_MEM ((*new) = calloc (1, sizeof (CameraFilesystemFile)));
|
||||
C_MEM ((*new) = calloc (sizeof (CameraFilesystemFile), 1));
|
||||
(*new)->name = strdup (filename);
|
||||
if (!(*new)->name) {
|
||||
free (*new);
|
||||
|
||||
Reference in New Issue
Block a user