path: change mp_splitext() semantics

Including the "." in the returned extension was too inconvenient. I
think originally, the semantics were supposed to work like in Python,
but screw this.

Also, return NULL instead of "" on failure (which is what its only user
actually seems to expect).
This commit is contained in:
wm4
2013-12-22 23:04:19 +01:00
parent c31ce789c5
commit 3782fa20ed
3 changed files with 8 additions and 8 deletions

View File

@@ -347,7 +347,7 @@ void screenshot_to_file(struct MPContext *mpctx, const char *filename, int mode,
}
char *ext = mp_splitext(filename, NULL);
if (ext)
opts.format = ext + 1; // omit '.'
opts.format = ext;
struct mp_image *image = screenshot_get(mpctx, mode);
if (!image) {
screenshot_msg(ctx, SMSG_ERR, "Taking screenshot failed.");