fixup! IEOT error messages

Enable localizing new error messages and improve the error message for
invalid IEOT extension sizes.

Signed-off-by: Ben Peart <benpe...@microsoft.com>
---
 read-cache.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/read-cache.c b/read-cache.c
index 7acc2c86f4..f9fa6a7979 100644
--- a/read-cache.c
+++ b/read-cache.c
@@ -3480,7 +3480,7 @@ static struct index_entry_offset_table *read_ieot_extension(const char *mmap, si
        /* validate the version is IEOT_VERSION */
        ext_version = get_be32(index);
        if (ext_version != IEOT_VERSION) {
-              error("invalid IEOT version %d", ext_version);
+              error(_("invalid IEOT version %d"), ext_version);
               return NULL;
        }
        index += sizeof(uint32_t);
@@ -3488,7 +3488,7 @@ static struct index_entry_offset_table *read_ieot_extension(const char *mmap, si
        /* extension size - version bytes / bytes per entry */
nr = (extsize - sizeof(uint32_t)) / (sizeof(uint32_t) + sizeof(uint32_t));
        if (!nr) {
-              error("invalid number of IEOT entries %d", nr);
+              error(_("invalid IEOT extension size %d"), extsize);
               return NULL;
        }
        ieot = xmalloc(sizeof(struct index_entry_offset_table)
--
2.18.0.windows.1



On 10/14/2018 8:28 AM, Duy Nguyen wrote:
On Wed, Oct 10, 2018 at 5:59 PM Ben Peart <peart...@gmail.com> wrote:
@@ -3460,14 +3479,18 @@ static struct index_entry_offset_table 
*read_ieot_extension(const char *mmap, si

         /* validate the version is IEOT_VERSION */
         ext_version = get_be32(index);
-       if (ext_version != IEOT_VERSION)
+       if (ext_version != IEOT_VERSION) {
+              error("invalid IEOT version %d", ext_version);

Please wrap this string in _() so that it can be translated.

                return NULL;
+       }
         index += sizeof(uint32_t);

         /* extension size - version bytes / bytes per entry */
         nr = (extsize - sizeof(uint32_t)) / (sizeof(uint32_t) + 
sizeof(uint32_t));
-       if (!nr)
+       if (!nr) {
+              error("invalid number of IEOT entries %d", nr);

Ditto. And reporting extsize may be more useful than nr, which we know
is zero, but we don't know why it's calculated zero unless we know
extsize.

Reply via email to