Image load: Change error code on zero file size
From IMLIB_LOAD_ERROR_UNKNOWN to IMLIB_LOAD_ERROR_IMAGE_READ. Mostly to get the same error from loading a 0 byte file as any other too short file.
This commit is contained in:
parent
7d53ba4e86
commit
bf07b104f3
|
@ -509,7 +509,7 @@ __imlib_LoadImage(const char *file, ImlibLoadArgs * ila)
|
|||
else if (__imlib_StatIsDir(&st))
|
||||
err = IMLIB_LOAD_ERROR_FILE_IS_DIRECTORY;
|
||||
else if (st.st_size == 0)
|
||||
err = IMLIB_LOAD_ERROR_UNKNOWN;
|
||||
err = IMLIB_LOAD_ERROR_IMAGE_READ;
|
||||
|
||||
if (err)
|
||||
{
|
||||
|
|
|
@ -130,7 +130,7 @@ test_load(void)
|
|||
D("Load empty '%s'\n", fileo);
|
||||
im = imlib_load_image_with_error_return(fileo, &lerr);
|
||||
D(" err = %d\n", lerr);
|
||||
EXPECT_TRUE(lerr == IMLIB_LOAD_ERROR_UNKNOWN);
|
||||
EXPECT_EQ(lerr, IMLIB_LOAD_ERROR_IMAGE_READ);
|
||||
|
||||
// Non-existing files of all types
|
||||
snprintf(fileo, sizeof(fileo), "%s/%s.%s", IMG_GEN, "nonex", pfxs[i]);
|
||||
|
|
Loading…
Reference in New Issue