replace netowrk converts by ours

git-svn-id: https://svn.code.sf.net/p/gphoto/code/trunk/libgphoto2@14773 67ed7778-7388-44ab-90cf-0a291f65f57c
This commit is contained in:
Marcus Meissner
2014-02-22 16:53:51 +00:00
parent 64ab76ca15
commit 25d8b69b62
4 changed files with 18 additions and 17 deletions

View File

@@ -80,11 +80,11 @@ int digita_get_storage_status(CameraPrivateLibrary *dev, int *taken,
}
if (taken)
*taken = ntohl(ss.takencount);
*taken = be32toh(ss.takencount);
if (available)
*available = ntohl(ss.availablecount);
*available = be32toh(ss.availablecount);
if (rawcount)
*rawcount = ntohl(ss.rawcount);
*rawcount = be32toh(ss.rawcount);
return 0;
}
@@ -187,7 +187,7 @@ int digita_get_file_data(CameraPrivateLibrary *dev, int thumbnail,
return gfdr->cmd.result;
}
memcpy(buffer, tbuf + sizeof(*gfdr), ntohl(gfdr->tag.length) + (thumbnail ? 16 : 0));
memcpy(buffer, tbuf + sizeof(*gfdr), be32toh(gfdr->tag.length) + (thumbnail ? 16 : 0));
memcpy(tag, &gfdr->tag, sizeof(*tag));
free(tbuf);

View File

@@ -246,7 +246,7 @@ static unsigned char *digita_file_get(Camera *camera, const char *folder,
return NULL;
}
buflen = ntohl(tag.filesize);
buflen = be32toh(tag.filesize);
if (thumbnail)
buflen += 16;
@@ -256,8 +256,8 @@ static unsigned char *digita_file_get(Camera *camera, const char *folder,
return NULL;
}
len = ntohl(tag.filesize);
pos = ntohl(tag.length);
len = be32toh(tag.filesize);
pos = be32toh(tag.length);
id = gp_context_progress_start (context, len, _("Getting file..."));
while (pos < len) {
gp_context_progress_update (context, id, pos);
@@ -273,7 +273,7 @@ static unsigned char *digita_file_get(Camera *camera, const char *folder,
free (data);
return NULL;
}
pos += ntohl(tag.length);
pos += be32toh(tag.length);
}
gp_context_progress_stop (context, id);
@@ -351,9 +351,9 @@ static int get_file_func(CameraFilesystem *fs, const char *folder,
char *ppm;
memcpy((void *)&height, data + 4, 4);
height = ntohl(height);
height = be32toh(height);
memcpy((void *)&width, data + 8, 4);
width = ntohl(width);
width = be32toh(width);
GP_DEBUG( "picture size %dx%d", width, height);
GP_DEBUG( "data size %d", buflen - 16);

View File

@@ -25,6 +25,7 @@
#include <gphoto2/gphoto2.h>
#include <gphoto2/gphoto2-port.h>
#include <gphoto2-endian.h>
#define DIGITA_GET_PRODUCT_INFO 0x01
#define DIGITA_GET_IMAGE_SPECS 0x02

View File

@@ -115,7 +115,7 @@ static int poll_and_wait(gp_port *dev, int length, int bob, int eob)
return -1;
if (gp_port_read(dev, (void *)&s, sizeof(s)) < 0)
return -1;
poll_reply = ntohs(s);
poll_reply = be16toh(s);
} while (poll_reply & POLL_NAK);
return 0;
@@ -156,7 +156,7 @@ static int poll_and_reply(gp_port *dev, int *length, int *eob, int nak)
if (gp_port_read(dev, (void *)&s, sizeof(s)) < 0)
return -1;
poll = ntohs(s);
poll = be16toh(s);
if (length)
*length = poll & POLL_LENGTH_MASK;
if (eob)
@@ -275,9 +275,9 @@ int digita_serial_open(CameraPrivateLibrary *dev, Camera *camera)
}
memcpy((void *)&s, &buffer[2], 2);
GP_DEBUG("Vendor: 0x%04x", ntohs(s));
GP_DEBUG("Vendor: 0x%04x", be16toh(s));
memcpy((void *)&s, &buffer[4], 2);
GP_DEBUG("Product: 0x%04x", ntohs(s));
GP_DEBUG("Product: 0x%04x", be16toh(s));
/*
* Send the beacon acknowledgement
@@ -316,11 +316,11 @@ int digita_serial_open(CameraPrivateLibrary *dev, Camera *camera)
}
memcpy((void *)&s, &buffer[6], sizeof(s));
dev->deviceframesize = ntohs(s);
dev->deviceframesize = be16toh(s);
memcpy((void *)&l, &buffer[2], sizeof(l));
GP_DEBUG("negotiated %d", ntohl(l));
settings.serial.speed = ntohl(l);
GP_DEBUG("negotiated %d", be32toh(l));
settings.serial.speed = be32toh(l);
usleep(100000); /* Wait before */