Skip to content

Commit

Permalink
mark loop variables unsigned
Browse files Browse the repository at this point in the history
  • Loading branch information
marcusmeissner committed Aug 27, 2013
1 parent d3841db commit 788037c
Showing 1 changed file with 31 additions and 26 deletions.
57 changes: 31 additions & 26 deletions camlibs/ptp2/library.c
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ struct special_file {
putfunc_t putfunc;
};

static int nrofspecial_files = 0;
static unsigned int nrofspecial_files = 0;
static struct special_file *special_files = NULL;

static int
Expand Down Expand Up @@ -309,7 +309,7 @@ fixup_cached_deviceinfo (Camera *camera, PTPDeviceInfo *di) {
) {
PTPDeviceInfo ndi, newdi, *outerdi;
uint16_t ret;
int i;
unsigned int i;

ret = ptp_getdeviceinfo (params, &params->outer_deviceinfo);
if (ret != PTP_RC_OK)
Expand Down Expand Up @@ -398,7 +398,7 @@ fixup_cached_deviceinfo (Camera *camera, PTPDeviceInfo *di) {
}

if (di->VendorExtensionID == PTP_VENDOR_NIKON) {
int i;
unsigned int i;

if (ptp_operation_issupported(&camera->pl->params, PTP_OC_NIKON_GetVendorPropCodes)) {
uint16_t *xprops;
Expand Down Expand Up @@ -1748,7 +1748,7 @@ is_mtp_capable(Camera *camera) {
int
camera_abilities (CameraAbilitiesList *list)
{
int i;
unsigned int i;
CameraAbilities a;

for (i = 0; i < sizeof(models)/sizeof(models[0]); i++) {
Expand Down Expand Up @@ -2774,7 +2774,7 @@ camera_canon_capture (Camera *camera, CameraCaptureType type, CameraFilePath *pa

ret = ptp_getstorageids(params, &storageids);
if (ret == PTP_RC_OK) {
int k, stgcnt = 0;
unsigned int k, stgcnt = 0;
for (k=0;k<storageids.n;k++) {
if (!(storageids.Storage[k] & 0xffff)) continue;
if (storageids.Storage[k] == 0x80000001) continue;
Expand Down Expand Up @@ -3044,7 +3044,7 @@ camera_capture (Camera *camera, CameraCaptureType type, CameraFilePath *path,

GP_DEBUG("PTPBUG_NIKON_BROKEN_CAPTURE bug workaround");
while (tries--) {
int i;
unsigned int i;
uint16_t ret = ptp_getobjecthandles (params, PTP_HANDLER_SPECIAL, 0x000000, 0x000000, &handles);
if (ret != PTP_RC_OK)
break;
Expand Down Expand Up @@ -3286,7 +3286,8 @@ camera_trigger_capture (Camera *camera, GPContext *context)

ret = ptp_getstorageids(params, &storageids);
if (ret == PTP_RC_OK) {
int k, stgcnt = 0;
unsigned int k, stgcnt = 0;

for (k=0;k<storageids.n;k++) {
if (!(storageids.Storage[k] & 0xffff)) continue;
if (storageids.Storage[k] == 0x80000001) continue;
Expand Down Expand Up @@ -3862,7 +3863,7 @@ _value_to_str(PTPPropertyValue *data, uint16_t dt, char *txt, int spaceleft) {
if (dt == PTP_DTC_STR)
return snprintf (txt, spaceleft, "'%s'", data->str);
if (dt & PTP_DTC_ARRAY_MASK) {
int i;
unsigned int i;

n = snprintf (txt, spaceleft, "a[%d] ", data->a.count);
if (n >= spaceleft) return 0; spaceleft -= n; txt += n;
Expand Down Expand Up @@ -4031,7 +4032,8 @@ nikon_curve_put (CameraFilesystem *fs, const char *folder, CameraFile *file,
static int
camera_summary (Camera* camera, CameraText* summary, GPContext *context)
{
int n, i, j;
unsigned int i, j;
int n;
uint16_t ret;
int spaceleft;
char *txt;
Expand Down Expand Up @@ -4441,7 +4443,7 @@ camera_summary (Camera* camera, CameraText* summary, GPContext *context)
static uint32_t
find_child (PTPParams *params,const char *file,uint32_t storage,uint32_t handle,PTPObject **retob)
{
int i;
unsigned int i;
uint16_t ret;

ret = ptp_list_folder (params, storage, handle);
Expand Down Expand Up @@ -4504,7 +4506,7 @@ file_list_func (CameraFilesystem *fs, const char *folder, CameraList *list,
Camera *camera = (Camera *)data;
PTPParams *params = &camera->pl->params;
uint32_t parent, storage=0x0000000;
int i,hasgetstorageids;
unsigned int i, hasgetstorageids;
SET_CONTEXT_P(params, context);

gp_log (GP_LOG_DEBUG, "ptp2", "file_list_func(%s)", folder);
Expand Down Expand Up @@ -4574,7 +4576,7 @@ folder_list_func (CameraFilesystem *fs, const char *folder, CameraList *list,
void *data, GPContext *context)
{
PTPParams *params = &((Camera *)data)->pl->params;
int i, hasgetstorageids;
unsigned int i, hasgetstorageids;
uint32_t handler,storage;

SET_CONTEXT_P(params, context);
Expand Down Expand Up @@ -4682,7 +4684,7 @@ ptp_mtp_render_metadata (
) {
uint16_t ret, *props = NULL;
uint32_t propcnt = 0;
int j;
unsigned int j;
MTPProperties *mprops;
PTPObject *ob;

Expand All @@ -4696,17 +4698,18 @@ ptp_mtp_render_metadata (

mprops = ob->mtpprops;
if (mprops) { /* use the fast method, without device access since cached.*/
char propname[256];
char text[256];
int i, n;
char propname[256];
char text[256];
unsigned int i, n;

for (j=0;j<ob->nrofmtpprops;j++) {
MTPProperties *xpl = &mprops[j];

for (i=sizeof(uninteresting_props)/sizeof(uninteresting_props[0]);i--;)
for (i=0;i<sizeof(uninteresting_props)/sizeof(uninteresting_props[0]);i++)
if (uninteresting_props[i] == xpl->property)
break;
if (i != -1) /* Is uninteresting. */
/* Is uninteresting. */
if (i == sizeof(uninteresting_props)/sizeof(uninteresting_props[0]))
continue;
for(i=0;i<propcnt;i++) {
/* Mark handled property as 0 */
Expand Down Expand Up @@ -4848,7 +4851,7 @@ ptp_mtp_parse_metadata (
uint32_t propcnt = 0;
char *filedata = NULL;
unsigned long filesize = 0;
int j;
unsigned int j;

if (gp_file_get_data_and_size (file, (const char**)&filedata, &filesize) < GP_OK)
return (GP_ERROR);
Expand Down Expand Up @@ -4934,7 +4937,7 @@ mtp_get_playlist_string(
PTPParams *params = &camera->pl->params;
uint32_t numobjects = 0, *objects = NULL;
uint16_t ret;
int i, contentlen = 0;
unsigned int i, contentlen = 0;
char *content = NULL;

ret = ptp_mtp_getobjectreferences (params, object_id, &objects, &numobjects);
Expand Down Expand Up @@ -5260,7 +5263,7 @@ get_file_func (CameraFilesystem *fs, const char *folder, const char *filename,
#endif

if (!strcmp (folder, "/special")) {
int i;
unsigned int i;

for (i=0;i<nrofspecial_files;i++)
if (!strcmp (special_files[i].name, filename))
Expand Down Expand Up @@ -5421,7 +5424,7 @@ put_file_func (CameraFilesystem *fs, const char *folder, const char *filename,
gp_log ( GP_LOG_DEBUG, "ptp2/put_file_func", "folder=%s, filename=%s", folder, filename);

if (!strcmp (folder, "/special")) {
int i;
unsigned int i;

for (i=0;i<nrofspecial_files;i++)
if (!strcmp (special_files[i].name, filename))
Expand Down Expand Up @@ -5810,7 +5813,7 @@ storage_info_func (CameraFilesystem *fs,
PTPParams *params = &camera->pl->params;
PTPStorageInfo si;
PTPStorageIDs sids;
int i,n;
unsigned int i,n;
uint16_t ret;
CameraStorageInformation*sif;

Expand Down Expand Up @@ -6340,7 +6343,7 @@ ptp_list_folder_eos (PTPParams *params, uint32_t storage, uint32_t handle) {

uint16_t
ptp_list_folder (PTPParams *params, uint32_t storage, uint32_t handle) {
int i, changed, last;
unsigned int i, changed, last;
uint16_t ret;
uint32_t xhandle = handle;
PTPObject *newobs;
Expand Down Expand Up @@ -6392,7 +6395,8 @@ ptp_list_folder (PTPParams *params, uint32_t storage, uint32_t handle) {
last = changed = 0;
for (i=0;i<handles.n;i++) {
PTPObject *ob;
int j;
unsigned int j;

ob = NULL;
for (j=0;j<params->nrofobjects;j++) {
if (params->objects[(last+j)%params->nrofobjects].oid == handles.Handler[i]) {
Expand Down Expand Up @@ -6463,7 +6467,8 @@ int
camera_init (Camera *camera, GPContext *context)
{
CameraAbilities a;
int ret, i, retried = 0;
unsigned int i;
int ret, retried = 0;
PTPParams *params;
char *curloc, *camloc;
GPPortSettings settings;
Expand Down

0 comments on commit 788037c

Please sign in to comment.