summaryrefslogtreecommitdiffstats
path: root/bin/dd/conv.c
diff options
context:
space:
mode:
authorphk <phk@FreeBSD.org>1996-11-13 20:00:03 +0000
committerphk <phk@FreeBSD.org>1996-11-13 20:00:03 +0000
commit6c0fd53b323fe1e401dc8c67516a053bfe61f962 (patch)
tree53fc828f0ad161e700a6fc8fe723a969aade6a4b /bin/dd/conv.c
parent46e1202181d505ac01d3b6baa6922896edbfca8a (diff)
downloadFreeBSD-src-6c0fd53b323fe1e401dc8c67516a053bfe61f962.zip
FreeBSD-src-6c0fd53b323fe1e401dc8c67516a053bfe61f962.tar.gz
Bruce says: "You have been programming in the kernel for too long :-)."
and he's right ... I forgot about this floating point stuff you can use in user-land :-) Increase precision of duration to microseconds. No heuristics to avoid overflow in calculation needed - just depend on DBL_MAX being a bit larger than LONG_MAX. Use double instead of `struct timeval' in dd.h so that everything doesn't have to include <sys/time.h>. Fixed style bugs in recent and old FreeBSD changes. Reviewed by: phk Submitted by: bde
Diffstat (limited to 'bin/dd/conv.c')
-rw-r--r--bin/dd/conv.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/bin/dd/conv.c b/bin/dd/conv.c
index 41c5909..09ee56a 100644
--- a/bin/dd/conv.c
+++ b/bin/dd/conv.c
@@ -34,7 +34,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: conv.c,v 1.3 1994/09/24 02:54:44 davidg Exp $
+ * $Id: conv.c,v 1.4 1996/11/12 23:09:04 phk Exp $
*/
#ifndef lint
@@ -45,7 +45,6 @@ static char sccsid[] = "@(#)conv.c 8.3 (Berkeley) 4/2/94";
#include <err.h>
#include <string.h>
-#include <sys/time.h>
#include "dd.h"
#include "extern.h"
@@ -62,7 +61,7 @@ def()
int cnt;
u_char *inp, *t;
- if ((t = ctab))
+ if ((t = ctab) != NULL)
for (inp = in.dbp - (cnt = in.dbrcnt); cnt--; ++inp)
*inp = t[*inp];
@@ -106,7 +105,6 @@ block()
int ch, cnt, maxlen;
u_char *inp, *outp, *t;
- ch = 0;
/*
* Record truncation can cross block boundaries. If currently in a
* truncation state, keep tossing characters until reach a newline.
@@ -131,9 +129,10 @@ block()
* Copy records (max cbsz size chunks) into the output buffer. The
* translation is done as we copy into the output buffer.
*/
+ ch = 0; /* Help the compiler. */
for (inp = in.dbp - in.dbcnt, outp = out.dbp; in.dbcnt;) {
maxlen = MIN(cbsz, in.dbcnt);
- if ((t = ctab))
+ if ((t = ctab) != NULL)
for (cnt = 0;
cnt < maxlen && (ch = *inp++) != '\n'; ++cnt)
*outp++ = t[ch];
@@ -217,7 +216,7 @@ unblock()
u_char *inp, *t;
/* Translation and case conversion. */
- if ((t = ctab))
+ if ((t = ctab) != NULL)
for (cnt = in.dbrcnt, inp = in.dbp; cnt--;)
*--inp = t[*inp];
/*
OpenPOWER on IntegriCloud