From: Stefan Weil <weil@mail.berlios.de>
To: QEMU Developers <qemu-devel@nongnu.org>
Subject: [Qemu-devel] [PATCH 2/4] tests: Replace u_int8_t, u_int16_t, u_int32_t, u_int64_t by standard int types
Date: Thu, 22 Jul 2010 22:15:22 +0200 [thread overview]
Message-ID: <1279829724-18604-3-git-send-email-weil@mail.berlios.de> (raw)
In-Reply-To: <1279829724-18604-1-git-send-email-weil@mail.berlios.de>
There is no need to have a second set of integral types.
Replace them by the standard types from stdint.h.
Signed-off-by: Stefan Weil <weil@mail.berlios.de>
---
tests/sha1.c | 24 ++++++++++++------------
1 files changed, 12 insertions(+), 12 deletions(-)
diff --git a/tests/sha1.c b/tests/sha1.c
index 3a76555..93b7c8e 100644
--- a/tests/sha1.c
+++ b/tests/sha1.c
@@ -23,7 +23,7 @@ A million repetitions of "a"
#include <stdio.h>
#include <string.h>
-#include <sys/types.h> /* for u_int*_t */
+#include <stdint.h>
/* ================ sha1.h ================ */
/*
@@ -33,14 +33,14 @@ By Steve Reid <steve@edmweb.com>
*/
typedef struct {
- u_int32_t state[5];
- u_int32_t count[2];
+ uint32_t state[5];
+ uint32_t count[2];
unsigned char buffer[64];
} SHA1_CTX;
-void SHA1Transform(u_int32_t state[5], const unsigned char buffer[64]);
+void SHA1Transform(uint32_t state[5], const unsigned char buffer[64]);
void SHA1Init(SHA1_CTX* context);
-void SHA1Update(SHA1_CTX* context, const unsigned char* data, u_int32_t len);
+void SHA1Update(SHA1_CTX* context, const unsigned char* data, uint32_t len);
void SHA1Final(unsigned char digest[20], SHA1_CTX* context);
/* ================ end of sha1.h ================ */
#include <endian.h>
@@ -70,12 +70,12 @@ void SHA1Final(unsigned char digest[20], SHA1_CTX* context);
/* Hash a single 512-bit block. This is the core of the algorithm. */
-void SHA1Transform(u_int32_t state[5], const unsigned char buffer[64])
+void SHA1Transform(uint32_t state[5], const unsigned char buffer[64])
{
-u_int32_t a, b, c, d, e;
+uint32_t a, b, c, d, e;
typedef union {
unsigned char c[64];
- u_int32_t l[16];
+ uint32_t l[16];
} CHAR64LONG16;
#ifdef SHA1HANDSOFF
CHAR64LONG16 block[1]; /* use array to appear as a pointer */
@@ -145,10 +145,10 @@ void SHA1Init(SHA1_CTX* context)
/* Run your data through this. */
-void SHA1Update(SHA1_CTX* context, const unsigned char* data, u_int32_t len)
+void SHA1Update(SHA1_CTX* context, const unsigned char* data, uint32_t len)
{
-u_int32_t i;
-u_int32_t j;
+uint32_t i;
+uint32_t j;
j = context->count[0];
if ((context->count[0] += len << 3) < j)
@@ -186,7 +186,7 @@ unsigned char c;
for (i = 0; i < 2; i++)
{
- u_int32_t t = context->count[i];
+ uint32_t t = context->count[i];
int j;
for (j = 0; j < 4; t >>= 8, j++)
--
1.7.1
next prev parent reply other threads:[~2010-07-22 20:15 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-07-22 20:15 [Qemu-devel] [PATCH 0/4] Replace u_int8_t, u_int16_t, u_int32_t, u_int64_t by standard int types Stefan Weil
2010-07-22 20:15 ` [Qemu-devel] [PATCH 1/4] block: " Stefan Weil
2010-07-22 20:15 ` Stefan Weil [this message]
2010-07-22 20:15 ` [Qemu-devel] [PATCH 3/4] slirp: " Stefan Weil
2010-07-22 20:15 ` [Qemu-devel] [PATCH 4/4] slirp: Remove declarations which are no longer needed Stefan Weil
2010-07-25 15:01 ` [Qemu-devel] [PATCH 0/4] Replace u_int8_t, u_int16_t, u_int32_t, u_int64_t by standard int types Aurelien Jarno
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1279829724-18604-3-git-send-email-weil@mail.berlios.de \
--to=weil@mail.berlios.de \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).