[Kst] [Bug 119531] Ambiguities in getdata's char type

Andrew Walker arwalker at sumusltd.com
Wed Mar 15 19:35:50 CET 2006


------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
         
http://bugs.kde.org/show_bug.cgi?id=119531         
arwalker sumusltd com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |FIXED



------- Additional Comments From arwalker sumusltd com  2006-03-15 19:35 -------
SVN commit 518936 by arwalker:

BUG:119531 Apply Don's patch

 M  +12 -11    getdata.c  


--- trunk/extragear/graphics/kst/src/datasources/dirfile/getdata.c #518935:518936
 @ -526,7 +526,7  @
   switch(rtype) {
     case 'c':
       for (i=0; i<n; i++) {
-        ((char*)dataout)[i] = (char)i+s0;
+        ((unsigned char*)dataout)[i] = (unsigned char)i+s0;
       }
       break;
     case 'i': /* for compatibility with creaddata. (deprecated) */
 @ -1054,7 +1054,7  @
 /*                                                                         */
 /***************************************************************************/
 static void ScaleData(void *data, char type, int npts, double m, double b) {
-  char *data_c;
+  unsigned char *data_c;
   short *data_s;
   unsigned short *data_u;
   unsigned *data_U;
 @ -1068,9 +1068,9  @
     case 'n':
       break;
     case 'c':
-      data_c = (char *)data;
+      data_c = (unsigned char *)data;
       for (i=0; i<npts; i++) {
-        data_c[i] =(char)((double)data_c[i] * m + b);
+        data_c[i] =(unsigned char)((double)data_c[i] * m + b);
       }
       break;
     case 's':
 @ -1129,7 +1129,7  @
       break;
     case 'c':
       for (i=0; i<n; i++) {
-        ((char*)A)[i] += ((char*)B)[i * spfB / spfA];
+        ((unsigned char*)A)[i] += ((unsigned char*)B)[i * spfB / spfA];
       }
       break;
     case 'S': case 'i':
 @ -1183,7 +1183,7  @
       break;
     case 'c':
       for (i=0; i<n; i++) {
-        ((char*)A)[i] *= ((char*)B)[i * spfB / spfA];
+        ((unsigned char*)A)[i] *= ((unsigned char*)B)[i * spfB / spfA];
       }
       break;
     case 'S': case 'i':
 @ -1556,10 +1556,11  @
         return;
         break;
       case 'c':
-        x = ((char *)data)[i];
+        x = ((unsigned char *)data)[i];
         idx = GetIndex(x, lx, idx, n_ln);
-        ((char *)data)[i] = (char)(ly[idx] + (ly[idx+1]-ly[idx])/
-                                   (lx[idx+1]-lx[idx]) * (x-lx[idx]));
+        ((unsigned char *)data)[i] =
+          (unsigned char)(ly[idx] + (ly[idx + 1] - ly[idx]) /
+                          (lx[idx + 1] - lx[idx]) * (x - lx[idx]));
         break;
       case 's':
         x = ((short *)data)[i];
 @ -1727,8 +1728,8  @
 /*    num_frames, num_samps: the number of samples read is                 */
 /*              num_samps + samples_per_frame*num_frames                   */
 /*    return_type: data type of *data_out.  's': 16 bit signed             */
-/*              'u' 16bit unsiged. 'S' 32bit signed 'U' 32bit unsigned     */
-/*              'c' 8 bit signed                                           */
+/*              'u' 16bit unsigned 'S' 32bit signed 'U' 32bit unsigned     */
+/*              'c' 8 bit unsigned                                         */
 /*    void *data_out: array to put the data                                */
 /*    *error_code: error code is returned here. If error_code==null,       */
 /*               GetData prints the error message and exits                */


More information about the Kst mailing list