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−
21 /*
3− * July 5, 1991
4− * Copyright 1991 Lance Norskog And Sundry Contributors
2+ * Sound Tools text format file. Tom Littlejohn, March 93.
3+ *
4+ * Reads/writes sound files as text for use with FFT and graph.
5+ *
6+ * Copyright 1998-2006 Chris Bagwell and SoX Contributors
57 * This source code is freely redistributable and may be used for
68 * any purpose. This copyright notice must be maintained.
79 * Lance Norskog And Sundry Contributors are not responsible for
810 * the consequences of using this software.
911 */
1012
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−
2513 #include "st_i.h"
2614 #include <string.h>
2715
@@ -34,7 +22,7 @@ typedef struct dat { · 6 unmodified lines
3422 char prevline[LINEWIDTH];
3523 } *dat_t;
3624
37−int st_datstartread(ft_t ft)
25+static int st_datstartread(ft_t ft)
3826 {
3927 char inpstr[LINEWIDTH];
4028 long rate;
@@ -61,7 +49,7 @@ int st_datstartread(ft_t ft) · 20 unmodified lines
6149 }
6250
6351 /* Default channels to 1 if not found */
64− if (ft->info.channels == -1)
52+ if (ft->info.channels == 0)
6553 ft->info.channels = 1;
6654
6755 ft->info.size = ST_SIZE_64BIT;
@@ -70,7 +58,7 @@ int st_datstartread(ft_t ft) · 2 unmodified lines
7058 return (ST_SUCCESS);
7159 }
7260
73−int st_datstartwrite(ft_t ft)
61+static int st_datstartwrite(ft_t ft)
7462 {
7563 dat_t dat = (dat_t) ft->priv;
7664 char s[LINEWIDTH];
@@ -88,7 +76,7 @@ int st_datstartwrite(ft_t ft) · 11 unmodified lines
8876 return (ST_SUCCESS);
8977 }
9078
91−st_ssize_t st_datread(ft_t ft, st_sample_t *buf, st_size_t nsamp)
79+static st_size_t st_datread(ft_t ft, st_sample_t *buf, st_size_t nsamp)
9280 {
9381 char inpstr[LINEWIDTH];
9482 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
9684 double sampval = 0.0;
9785 int retc = 0;
9886 char sc = 0;
99− int done = 0;
100− int i=0;
87+ st_size_t done = 0;
88+ st_size_t i=0;
10189
10290 /* Always read a complete set of channels */
10391 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
135123 return (done);
136124 }
137125
138−st_ssize_t st_datwrite(ft_t ft, const st_sample_t *buf, st_size_t nsamp)
126+static st_size_t st_datwrite(ft_t ft, const st_sample_t *buf, st_size_t nsamp)
139127 {
140128 dat_t dat = (dat_t) ft->priv;
141− int done = 0;
129+ st_size_t done = 0;
142130 double sampval=0.0;
143131 char s[LINEWIDTH];
144− int i=0;
132+ st_size_t i=0;
145133
146134 /* Always write a complete set of channels */
147135 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