mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Sascha Hauer <s.hauer@pengutronix.de>
To: barebox@lists.infradead.org
Subject: [PATCH 10/10] filetype: Make buf in file_detect_type const
Date: Sun, 20 Jan 2013 16:35:19 +0100	[thread overview]
Message-ID: <1358696119-18387-11-git-send-email-s.hauer@pengutronix.de> (raw)
In-Reply-To: <1358696119-18387-1-git-send-email-s.hauer@pengutronix.de>

This function has no business changing the buffer.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 common/filetype.c  |   10 +++++-----
 include/filetype.h |    2 +-
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/common/filetype.c b/common/filetype.c
index 748e364..5941ad2 100644
--- a/common/filetype.c
+++ b/common/filetype.c
@@ -106,12 +106,12 @@ enum filetype is_fat_or_mbr(const unsigned char *sector, unsigned long *bootsec)
 	return filetype_mbr;
 }
 
-enum filetype file_detect_type(void *_buf, size_t bufsize)
+enum filetype file_detect_type(const void *_buf, size_t bufsize)
 {
-	u32 *buf = _buf;
-	u64 *buf64 = _buf;
-	u8 *buf8 = _buf;
-	u16 *buf16 = _buf;
+	const u32 *buf = _buf;
+	const u64 *buf64 = _buf;
+	const u8 *buf8 = _buf;
+	const u16 *buf16 = _buf;
 	enum filetype type;
 
 	if (bufsize < 9)
diff --git a/include/filetype.h b/include/filetype.h
index 91139db..502b920 100644
--- a/include/filetype.h
+++ b/include/filetype.h
@@ -30,7 +30,7 @@ enum filetype {
 
 const char *file_type_to_string(enum filetype f);
 const char *file_type_to_short_string(enum filetype f);
-enum filetype file_detect_type(void *_buf, size_t bufsize);
+enum filetype file_detect_type(const void *_buf, size_t bufsize);
 enum filetype file_name_detect_type(const char *filename);
 enum filetype is_fat_or_mbr(const unsigned char *sector, unsigned long *bootsec);
 
-- 
1.7.10.4


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

      parent reply	other threads:[~2013-01-20 15:35 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-01-20 15:35 [PATCH] startup related cleanups Sascha Hauer
2013-01-20 15:35 ` [PATCH 01/10] startup: call a barebox_main function pointer at the end of the startup Sascha Hauer
2013-01-20 15:35 ` [PATCH 02/10] move struct action_data to the only file using it Sascha Hauer
2013-01-20 15:35 ` [PATCH 03/10] make file_*_action static Sascha Hauer
2013-01-20 15:35 ` [PATCH 04/10] move prototypes for envfs_* to envfs.h Sascha Hauer
2013-01-20 15:35 ` [PATCH 05/10] scripts: remove now unnecessary include Sascha Hauer
2013-01-20 15:35 ` [PATCH 06/10] startup: use IS_ENABLED instead of ifdef Sascha Hauer
2013-01-20 15:35 ` [PATCH 07/10] startup: Use IS_ENABLED for loading environment Sascha Hauer
2013-01-20 15:35 ` [PATCH 08/10] startup: add __noreturn to start_barebox Sascha Hauer
2013-01-20 15:35 ` [PATCH 09/10] defaultenv loading: rework to use less ifdefs/defines Sascha Hauer
2013-01-20 15:35 ` Sascha Hauer [this message]

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=1358696119-18387-11-git-send-email-s.hauer@pengutronix.de \
    --to=s.hauer@pengutronix.de \
    --cc=barebox@lists.infradead.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