(signed and unsigned), some of which can break Xfbdev.
-DML
+2004-10-19 Chris Larson <kergoth@handhelds.org>
+
+ * Files all over the tree: Fixed up a bunch of compile warnings,
+ at least some of which actually did cause breakage for the user.
+
2004-07-08 Chris Larson <kergoth@handhelds.org>
* plugins/input-raw.c: As EV_SYN can be checked for at runtime rather
ret = read(ts->fd, arctic2_evt, sizeof(*arctic2_evt) * nr);
if(ret > 0) {
int nr = ret / sizeof(*arctic2_evt);
- while(ret >= sizeof(*arctic2_evt)) {
+ while(ret >= (int)sizeof(*arctic2_evt)) {
samp->x = (short)arctic2_evt->x;
samp->y = (short)arctic2_evt->y;
samp->pressure = arctic2_evt->pressure;
ret = read(ts->fd, collie_evt, sizeof(*collie_evt) * nr);
if(ret > 0) {
int nr = ret / sizeof(*collie_evt);
- while(ret >= sizeof(*collie_evt)) {
+ while(ret >= (int)sizeof(*collie_evt)) {
samp->x = collie_evt->x;
samp->y = collie_evt->y;
samp->pressure = collie_evt->pressure;
ret = read(ts->fd, corgi_evt, sizeof(*corgi_evt) * nr);
if(ret > 0) {
int nr = ret / sizeof(*corgi_evt);
- while(ret >= sizeof(*corgi_evt)) {
+ while(ret >= (int)sizeof(*corgi_evt)) {
samp->x = corgi_evt->x;
samp->y = corgi_evt->y;
samp->pressure = corgi_evt->pressure;
* This file is placed under the LGPL. Please see the file
* COPYING for more details.
*
- * $Id: dejitter.c,v 1.7 2004/07/21 19:12:58 dlowder Exp $
+ * $Id: dejitter.c,v 1.8 2004/10/19 22:01:27 dlowder Exp $
*
* Problem: some touchscreens read the X/Y values from ADC with a
* great level of noise in their lowest bits. This produces "jitter"
struct ts_hist {
int x;
int y;
- int p;
+ unsigned int p;
};
struct tslib_dejitter {
struct tslib_module_info module;
- unsigned int delta;
- unsigned int x;
- unsigned int y;
- unsigned int down;
- unsigned int nr;
- unsigned int head;
+ int delta;
+ int x;
+ int y;
+ int down;
+ int nr;
+ int head;
struct ts_hist hist[NR_SAMPHISTLEN];
};
{
const unsigned char *w;
int sn = djt->head;
- int i, x = 0, y = 0, p = 0;
+ int i, x = 0, y = 0;
+ unsigned int p = 0;
w = weight [djt->nr - 2];
ret = read(ts->fd, h3600_evt, sizeof(*h3600_evt) * nr);
if(ret > 0) {
int nr = ret / sizeof(*h3600_evt);
- while(ret >= sizeof(*h3600_evt)) {
+ while(ret >= (int)sizeof(*h3600_evt)) {
samp->x = h3600_evt->x;
samp->y = h3600_evt->y;
samp->pressure = h3600_evt->pressure;
* This file is placed under the LGPL. Please see the file
* COPYING for more details.
*
- * $Id: input-raw.c,v 1.3 2004/10/18 22:10:30 dlowder Exp $
+ * $Id: input-raw.c,v 1.4 2004/10/19 22:01:27 dlowder Exp $
*
* Read raw pressure, x, y, and timestamp from a touchscreen device.
*/
if (i->using_syn) {
while (total < nr) {
ret = read(ts->fd, &ev, sizeof(struct input_event));
- if (ret < sizeof(struct input_event)) {
+ if (ret < (int)sizeof(struct input_event)) {
total = -1;
break;
}
break;
}
- if (ret < sizeof(struct input_event)) {
+ if (ret < (int)sizeof(struct input_event)) {
/* short read
* restart read to get the rest of the event
*/
ret = read(ts->fd, mk712_evt, sizeof(*mk712_evt) * nr);
if(ret > 0) {
int nr = ret / sizeof(*mk712_evt);
- while(ret >= sizeof(*mk712_evt)) {
+ while(ret >= (int)sizeof(*mk712_evt)) {
samp->x = (short)mk712_evt->x;
samp->y = (short)mk712_evt->y;
if(mk712_evt->header==0)
struct tslib_pthres {
struct tslib_module_info module;
- int pmin;
- int pmax;
+ unsigned int pmin;
+ unsigned int pmax;
};
static int
ret = read(ts->fd, ucb1x00_evt, sizeof(*ucb1x00_evt) * nr);
if(ret > 0) {
int nr = ret / sizeof(*ucb1x00_evt);
- while(ret >= sizeof(*ucb1x00_evt)) {
+ while(ret >= (int)sizeof(*ucb1x00_evt)) {
samp->x = ucb1x00_evt->x;
samp->y = ucb1x00_evt->y;
samp->pressure = ucb1x00_evt->pressure;
* This file is placed under the LGPL. Please see the file
* COPYING for more details.
*
- * $Id: variance.c,v 1.4 2004/07/21 19:12:59 dlowder Exp $
+ * $Id: variance.c,v 1.5 2004/10/19 22:01:27 dlowder Exp $
*
* Variance filter for touchscreen values.
*
struct tslib_variance {
struct tslib_module_info module;
- unsigned int delta;
+ int delta;
struct ts_sample last;
struct ts_sample noise;
unsigned int flags;
* This file is placed under the LGPL. Please see the file
* COPYING for more details.
*
- * $Id: ts_attach.c,v 1.2 2004/07/21 19:12:59 dlowder Exp $
+ * $Id: ts_attach.c,v 1.3 2004/10/19 22:01:27 dlowder Exp $
*
* Attach a filter to a touchscreen device.
*/
return 0;
}
- next = ts->list;
-
- while (next != NULL && next != prev_list)
- prev = next, next = prev->next;
+ for(next = ts->list, prev=next;
+ next != NULL && next != prev_list;
+ next = prev->next, prev = next);
prev->next = info;
-
return 0;
}
* This file is placed under the LGPL. Please see the file
* COPYING for more details.
*
- * $Id: ts_config.c,v 1.4 2004/07/21 19:12:59 dlowder Exp $
+ * $Id: ts_config.c,v 1.5 2004/10/19 22:01:27 dlowder Exp $
*
* Read the configuration and load the appropriate drivers.
*/
char buf[BUF_SIZE], *p;
FILE *f;
int line = 0;
- int ret;
+ int ret = 0;
char *conffile;
if (ts->list_raw == NULL) {
ts_error("No raw modules loaded.\n");
- return -1;
+ ret = -1;
}
fclose(f);
* This file is placed under the LGPL. Please see the file
* COPYING for more details.
*
- * $Id: ts_load_module.c,v 1.3 2004/07/21 19:12:59 dlowder Exp $
+ * $Id: ts_load_module.c,v 1.4 2004/10/19 22:01:27 dlowder Exp $
*
* Close a touchscreen device.
*/
int ts_load_module(struct tsdev *ts, const char *module, const char *params)
{
- __ts_load_module(ts, module, params, 0);
+ return __ts_load_module(ts, module, params, 0);
}
int ts_load_module_raw(struct tsdev *ts, const char *module, const char *params)
{
- __ts_load_module(ts, module, params, 1);
+ return __ts_load_module(ts, module, params, 1);
}
static int fb_fd=0;
static int bytes_per_pixel;
static unsigned colormap [256];
-int xres, yres;
+__u32 xres, yres;
static char *defaultfbdevice = "/dev/fb0";
static char *defaultconsoledevice = "/dev/tty";
memset(fbuffer,0,fix.smem_len);
bytes_per_pixel = (var.bits_per_pixel + 7) / 8;
- line_addr = malloc (sizeof (unsigned) * var.yres_virtual);
+ line_addr = malloc (sizeof (__u32) * var.yres_virtual);
addr = 0;
for (y = 0; y < var.yres_virtual; y++, addr += fix.line_length)
line_addr [y] = fbuffer + addr;
unsigned xormode;
union multiptr loc;
- if ((x < 0) || (x >= var.xres_virtual) ||
- (y < 0) || (y >= var.yres_virtual))
+ if ((x < 0) || ((__u32)x >= var.xres_virtual) ||
+ (y < 0) || ((__u32)y >= var.yres_virtual))
return;
xormode = colidx & XORMODE;
/* Clipping and sanity checking */
if (x1 > x2) { tmp = x1; x1 = x2; x2 = tmp; }
if (y1 > y2) { tmp = y1; y1 = y2; y2 = tmp; }
- if (x1 < 0) x1 = 0; if (x1 >= xres) x1 = xres - 1;
- if (x2 < 0) x2 = 0; if (x2 >= xres) x2 = xres - 1;
- if (y1 < 0) y1 = 0; if (y1 >= yres) y1 = yres - 1;
- if (y2 < 0) y2 = 0; if (y2 >= yres) y2 = yres - 1;
+ if (x1 < 0) x1 = 0; if ((__u32)x1 >= xres) x1 = xres - 1;
+ if (x2 < 0) x2 = 0; if ((__u32)x2 >= xres) x2 = xres - 1;
+ if (y1 < 0) y1 = 0; if ((__u32)y1 >= yres) y1 = yres - 1;
+ if (y2 < 0) y2 = 0; if ((__u32)y2 >= yres) y2 = yres - 1;
if ((x1 > x2) || (y1 > y2))
return;
* This file is placed under the GPL. Please see the file
* COPYING for more details.
*
- * $Id: testutils.c,v 1.1 2004/07/21 19:17:18 dlowder Exp $
+ * $Id: testutils.c,v 1.2 2004/10/19 22:01:27 dlowder Exp $
*
* Waits for the screen to be touched, averages x and y sample
* coordinates until the end of contact
#include "config.h"
#include <stdio.h>
#include <stdlib.h>
+#include <unistd.h>
#include <sys/time.h>
#include "tslib.h"
#include "fbutils.h"
* This file is placed under the GPL. Please see the file
* COPYING for more details.
*
- * $Id: ts_calibrate.c,v 1.7 2004/07/21 19:12:59 dlowder Exp $
+ * $Id: ts_calibrate.c,v 1.8 2004/10/19 22:01:27 dlowder Exp $
*
* Basic test program for touchscreen library.
*/
char cal_buffer[256];
char *tsdevice = NULL;
char *calfile = NULL;
- int i;
+ unsigned int i;
signal(SIGSEGV, sig);
signal(SIGINT, sig);
#include <sys/ioctl.h>
#include <sys/mman.h>
#include <sys/time.h>
+#include <unistd.h>
#include "tslib.h"
#include "fbutils.h"
int main()
{
struct tsdev *ts;
- int i, x, y, x_incr, y_incr, x_ts, y_ts, xres_half, yres_half, x_new, y_new;
+ int x, y, x_incr, y_incr, x_ts, y_ts, xres_half, yres_half, x_new, y_new;
+ unsigned int i;
char *tsdevice=NULL;
struct ts_sample samp;
FILE *output_fid;
getxy (ts, &x_ts, &y_ts);
refresh_screen ();
close_framebuffer();
+ return 0;
}
* This file is placed under the GPL. Please see the file
* COPYING for more details.
*
- * $Id: ts_test.c,v 1.5 2004/07/21 19:12:59 dlowder Exp $
+ * $Id: ts_test.c,v 1.6 2004/10/19 22:01:27 dlowder Exp $
*
* Basic test program for touchscreen library.
*/
int main()
{
struct tsdev *ts;
- int i, x, y;
- int mode = 0;
+ int x, y;
+ unsigned int i;
+ unsigned int mode = 0;
char *tsdevice=NULL;