-
Notifications
You must be signed in to change notification settings - Fork 230
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
stdin/stdout has to be binary mode, fixes #341
- Loading branch information
1 parent
ec475b3
commit bf8f5b5
Showing
2 changed files
with
8 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,7 @@ | |
#include <stdlib.h> | ||
#include <string.h> | ||
#include <stdint.h> | ||
#include <unistd.h> | ||
|
||
#include "image.hpp" | ||
#include "image-pam.hpp" | ||
|
@@ -103,9 +104,8 @@ bool image_save_pam(const char *filename, const Image& image) | |
{ | ||
if (image.numPlanes() < 4) return image_save_pnm(filename, image); | ||
FILE *fp = NULL; | ||
if (!strcmp(filename,"-")) fp = stdout; | ||
if (!strcmp(filename,"-")) fp = fdopen(dup(fileno(stdout)), "wb"); // make sure it is in binary mode (needed in Windows) | ||
else fp = fopen(filename,"wb"); | ||
|
||
if (!fp) { | ||
return false; | ||
} | ||
|
@@ -173,7 +173,7 @@ bool image_save_pam(const char *filename, const Image& image) | |
} | ||
} | ||
|
||
if (fp != stdout) fclose(fp); | ||
// if (fp != stdout) fclose(fp); | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
bjorn3
|
||
if (image.get_metadata("iCCP")) { | ||
v_printf(1,"Warning: input image has color profile, which cannot be stored in output image format.\n"); | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Why did you comment this out?