History

Fix read and write return types: now st_size_t, like the size inputs.

To support this change, turn on lots more compiler warnings, and fix all the warnings generated.

rrt committed 19 years ago

Commit 4d743c41 parent ce1f8f393 files · +875 −1236Browse files

Showing the changes to src/dat.c (1 of 93 files). Show all

Unified · Split

src/dat.c+14−26
@@ -1,27 +1,15 @@
1
2/*1/*
3 * July 5, 19912 * Sound Tools text format file. Tom Littlejohn, March 93.
4 * Copyright 1991 Lance Norskog And Sundry Contributors3 *
4 * Reads/writes sound files as text for use with FFT and graph.
5 *
6 * Copyright 1998-2006 Chris Bagwell and SoX Contributors
5 * This source code is freely redistributable and may be used for7 * This source code is freely redistributable and may be used for
6 * any purpose. This copyright notice must be maintained. 8 * any purpose. This copyright notice must be maintained.
7 * Lance Norskog And Sundry Contributors are not responsible for 9 * Lance Norskog And Sundry Contributors are not responsible for
8 * the consequences of using this software.10 * the consequences of using this software.
9 */11 */
10 12
11/*
12 * Sound Tools text format file. Tom Littlejohn, March 93.
13 *
14 * Reads/writes sound files as text for use with fft and graph.
15 *
16 * June 28, 93: force output to mono.
17 *
18 * September 24, 1998: cbagwell - Set up extra output format info so that
19 * reports are accurate. Also warn user when forcing to mono.
20 *
21 * November 25, 2005: tomchristie - Work with multiple channels
22 *
23 */
24
25#include "st_i.h"13#include "st_i.h"
26#include <string.h>14#include <string.h>
27 15
@@ -34,7 +22,7 @@ typedef struct dat { · 6 unmodified lines
34 char prevline[LINEWIDTH]; 22 char prevline[LINEWIDTH];
35} *dat_t;23} *dat_t;
36 24
37int st_datstartread(ft_t ft)25static int st_datstartread(ft_t ft)
38{26{
39 char inpstr[LINEWIDTH];27 char inpstr[LINEWIDTH];
40 long rate;28 long rate;
@@ -61,7 +49,7 @@ int st_datstartread(ft_t ft) · 20 unmodified lines
61 }49 }
62 50
63 /* Default channels to 1 if not found */51 /* Default channels to 1 if not found */
64 if (ft->info.channels == -1)52 if (ft->info.channels == 0)
65 ft->info.channels = 1;53 ft->info.channels = 1;
66 54
67 ft->info.size = ST_SIZE_64BIT;55 ft->info.size = ST_SIZE_64BIT;
@@ -70,7 +58,7 @@ int st_datstartread(ft_t ft) · 2 unmodified lines
70 return (ST_SUCCESS);58 return (ST_SUCCESS);
71}59}
72 60
73int st_datstartwrite(ft_t ft)61static int st_datstartwrite(ft_t ft)
74{62{
75 dat_t dat = (dat_t) ft->priv;63 dat_t dat = (dat_t) ft->priv;
76 char s[LINEWIDTH];64 char s[LINEWIDTH];
@@ -88,7 +76,7 @@ int st_datstartwrite(ft_t ft) · 11 unmodified lines
88 return (ST_SUCCESS);76 return (ST_SUCCESS);
89}77}
90 78
91st_ssize_t st_datread(ft_t ft, st_sample_t *buf, st_size_t nsamp)79static st_size_t st_datread(ft_t ft, st_sample_t *buf, st_size_t nsamp)
92{80{
93 char inpstr[LINEWIDTH];81 char inpstr[LINEWIDTH];
94 int inpPtr = 0;82 int inpPtr = 0;
@@ -96,8 +84,8 @@ st_ssize_t st_datread(ft_t ft, st_sample_t *buf, st_size_t nsamp) · 1 unmodified line
96 double sampval = 0.0;84 double sampval = 0.0;
97 int retc = 0;85 int retc = 0;
98 char sc = 0;86 char sc = 0;
99 int done = 0;87 st_size_t done = 0;
100 int i=0;88 st_size_t i=0;
101 89
102 /* Always read a complete set of channels */90 /* Always read a complete set of channels */
103 nsamp -= (nsamp % ft->info.channels);91 nsamp -= (nsamp % ft->info.channels);
@@ -135,13 +123,13 @@ st_ssize_t st_datread(ft_t ft, st_sample_t *buf, st_size_t nsamp) · 31 unmodified lines
135 return (done);123 return (done);
136}124}
137 125
138st_ssize_t st_datwrite(ft_t ft, const st_sample_t *buf, st_size_t nsamp)126static st_size_t st_datwrite(ft_t ft, const st_sample_t *buf, st_size_t nsamp)
139{127{
140 dat_t dat = (dat_t) ft->priv;128 dat_t dat = (dat_t) ft->priv;
141 int done = 0;129 st_size_t done = 0;
142 double sampval=0.0;130 double sampval=0.0;
143 char s[LINEWIDTH];131 char s[LINEWIDTH];
144 int i=0;132 st_size_t i=0;
145 133
146 /* Always write a complete set of channels */134 /* Always write a complete set of channels */
147 nsamp -= (nsamp % ft->info.channels);135 nsamp -= (nsamp % ft->info.channels);

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t