Skip to content

Commit

Permalink
fixed a log_open bug when log is not opened.
Browse files Browse the repository at this point in the history
  • Loading branch information
buaazp committed Nov 2, 2013
1 parent c6de62e commit f4a5107
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 4 deletions.
36 changes: 32 additions & 4 deletions test/magick_read_image.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,42 @@ int main()
for(i = 0; i < 1; i++)
{
MagickWand *magick_wand;
MagickBooleanType status;
MagickSizeType imgSize;
int width = 100, height = 100;
MagickWandGenesis();
magick_wand = NewMagickWand();

const char *rspPath = "./5f189.jpeg";
MagickReadImage(magick_wand, rspPath);
MagickSizeType imgSize;
MagickGetImageLength(magick_wand, &imgSize);
printf("Got Image Size: %d\n", (int)imgSize);
status = MagickReadImage(magick_wand, rspPath);
if(status == MagickFalse)
{
printf("Image[] Read Failed!\n");
}
else
{
MagickGetImageLength(magick_wand, &imgSize);
printf("Got Image Size: %d\n", (int)imgSize);

status = MagickResizeImage(magick_wand, width, height, LanczosFilter, 1.0);
if(status == MagickFalse)
{
printf("Image[%s] Resize Failed!\n", rspPath);
}
else
{
printf("Resize Successfully!.\n");
status = MagickWriteImage(magick_wand, "./new.jpeg");
if(status == MagickFalse)
{
printf("Image[] Write Failed!\n");
}
else
{
printf("Write Successfully!.\n");
}
}
}

magick_wand=DestroyMagickWand(magick_wand);
MagickWandTerminus();
Expand Down
Binary file added test/new.jpeg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions zlog.c
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,9 @@ void log_init()
/* 打开用户日志文件 */
int log_open(const char *path, const char* mode)
{
if(settings.log == false)
return -1;

int i;

for (i = LOG_USER; i < MAX_LOGS+1; i++)
Expand Down

0 comments on commit f4a5107

Please sign in to comment.