From fenner@parc.xerox.com  Tue May 23 09:49:12 1995
Received: from alpha.xerox.com (alpha.Xerox.COM [13.1.64.93])
          by freefall.cdrom.com (8.6.10/8.6.6) with SMTP id JAA07393
          for <FreeBSD-gnats-submit@freebsd.org>; Tue, 23 May 1995 09:49:11 -0700
Received: from fenestro.parc.xerox.com ([13.0.208.199]) by alpha.xerox.com with SMTP id <14465(2)>; Tue, 23 May 1995 09:48:34 PDT
Received: (from fenner@localhost) by fenestro.parc.xerox.com (8.6.11/8.6.9) id JAA01278; Tue, 23 May 1995 09:46:17 -0700
Message-Id: <199505231646.JAA01278@fenestro.parc.xerox.com>
Date: Tue, 23 May 1995 09:46:17 PDT
From: Bill Fenner <fenner@parc.xerox.com>
Reply-To: fenner@parc.xerox.com
To: FreeBSD-gnats-submit%freebsd.org@alpha.xerox.com
Subject: "file" doesn't print longs right with %d format
X-Send-Pr-Version: 3.2

>Number:         436
>Category:       bin
>Synopsis:       "file" doesn't print longs right with %d format
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    freebsd-bugs (FreeBSD bugs mailing list)
>State:          closed
>Quarter:
>Keywords:
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Tue May 23 09:50:00 1995
>Closed-Date:    Tue May 23 19:54:56 PDT 1995
>Last-Modified:
>Originator:     Bill Fenner
>Release:        FreeBSD 2.1.0-Development i386
>Organization:
Xerox PARC
>Environment:

	
	FreeBSD-2.0 SNAP950412

>Description:

	
	The "file" command displays only the least significant
	byte of a "belong" with the /etc/magic entry

	>16	belong	x	%d Hz

	Example:

% hexdump -e '"%07.7_ax  " 4/4 "%08X " "\n"' foo.snd | head
0000000  646E732E 80000000 00C0EA03 03000000
0000010  44AC0000 02000000 00000000 00000000
0000020  00000000 00000000 00000000 00000000

Note that the big-endian long at offset 16 is 0xac44, or 44100 Hz.

% file foo.snd
foo.snd: audio data: 16-bit linear PCM, stereo, 68 Hz

Note that 0x44 is 68 Hz.

>How-To-Repeat:

	

	Run "file" on a sound file and note the sampling rate.

	44.1Khz comes out as 68Hz
	11Khz comes out as 119Hz
	8Khz comes out as 64Hz

>Fix:
	
	
	Remove "(unsigned char)" cast from mprint() in softmagic.c.

	This fixes the long printing and doesn't appear to affect
	byte/char printing.

*** ../file/softmagic.c Sat Sep  3 12:16:22 1994
--- softmagic.c Tue May 23 09:38:13 1995
***************
*** 216,222 ****
        }
  
        v = signextend(m, v) & m->mask;
!       (void) printf(m->desc, (unsigned char) v);
  }
  
  /*
--- 216,222 ----
        }
  
        v = signextend(m, v) & m->mask;
!       (void) printf(m->desc, v);
  }
  
  /*

>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->closed 
State-Changed-By: ache 
State-Changed-When: Tue May 23 19:54:56 PDT 1995 
State-Changed-Why:  
Fix applied in softmagic.c v1.2 
>Unformatted:



