1 Index: qt-2.3.10/src/kernel/qwsmouse_qws.cpp
2 ===================================================================
3 --- qt-2.3.10.orig/src/kernel/qwsmouse_qws.cpp 2005-02-16 00:53:53.090339898 +0100
4 +++ qt-2.3.10/src/kernel/qwsmouse_qws.cpp 2005-02-16 00:54:43.059069292 +0100
5 @@ -1878,30 +1878,33 @@
7 void QTSLibHandlerPrivate::interpolateSample() {
9 - static struct ts_sample samples[25];
11 +#define TSLIB_MAX_SAMPLES 25
12 + static struct ts_sample samples[TSLIB_MAX_SAMPLES];
14 + int read_samples = 0;
18 - /* fill only the last sample again */
22 + /* do not access negative arrays */
26 /* we're opened non-blocking */
27 - if((ret= ts_read_raw(m_ts, &samples[index], 1 ) ) != 1 ) {
28 + if((ret= ts_read_raw(m_ts, &samples[index], 1 ) ) != 1 )
29 /* no event yet, so try again */
36 - }while (samples[index++].pressure != 0);
39 + index = (index+1)%TSLIB_MAX_SAMPLES;
40 + }while (samples[index == 0 ? (TSLIB_MAX_SAMPLES-1) : index-1].pressure != 0);
43 - * index is maximal 25 and we at least one sample
44 + * If we've wrapped around each sample is used otherwise
45 + * we will use the index
49 + index = read_samples >= TSLIB_MAX_SAMPLES ?
50 + (TSLIB_MAX_SAMPLES-1 ) : index;