GD2 를 이용한 프로그래밍 중 희안한 현상입니다.. -_-;

소타의 이미지

case IMGTYPE_PNG :
	//printf("A");fflush(0);
	img[0] = gdImageCreateFromPng( imgfd );
	//printf("B");fflush(0);
break;

문제의 코드 부분입니다..

[Switching to process 21367 thread 0xd03]
0x945b24d4 in inflate_fast ()
(gdb) bt
#0  0x945b24d4 in inflate_fast ()
#1  0x00006000 in ?? ()
#2  0x945b1208 in inflate_blocks ()
#3  0x945b1e9c in inflate ()
#4  0x217e2204 in png_read_row ()
#5  0x217e346c in png_read_image ()
#6  0x00084f5c in gdImageCreateFromPngCtx (infile=0x401370) at gd_png.c:340
#7  0x0008493c in gdImageCreateFromPng (inFile=0x680c) at gd_png.c:105
#8  0x000023a8 in proc ()
#9  0x900247e8 in _pthread_body ()

gdb의 bt 결과입니다..
libpng 또는 그 위인.. libz 쪽에서 발생하는 것 같습니다..

그런데 그만~~ 위의 코드를 보시면 //printf("A");fflush(0);, //printf("B");fflush(0); 를 주석처리하면 위의 에러가 나지 않고 안정적으로 잘 동작합니다 -_-;;

원인이 무엇일까요..
printf, fflush 를 넣어주면 에러가 안나고 넣지 않으면 저런 에러가 나는...

iBook:~/Develop/thumbnail3 nonun$ uname -a
Darwin iBook.local 7.3.0 Darwin Kernel Version 7.3.0: Fri Mar  5 14:22:55 PST 2004; root:xnu/xnu-517.3.15.obj~4/RELEASE_PPC  Power Macintosh powerpc
iBook:~/Develop/thumbnail3 nonun$ gcc -v
Reading specs from /usr/libexec/gcc/darwin/ppc/3.3/specs
Thread model: posix
gcc version 3.3 20030304 (Apple Computer, Inc. build 1495)
소타의 이미지

정확히는

printf("A");fflush(0); 
img[0] = gdImageCreateFromPng( imgfd );

이렇게 해야만 에러가 안나네요..
이렇게 하지 않으면 무조건 에러가 납니다...
소타의 이미지

fflush 보다는 printf 가 영향을 미치는 것 같습니다..
fflush 가 없어도 잘 동작하는데 printf 가 없으면 에러가 납니다.....
으~ 뭐가 문제인지 -_-;

소타의 이미지

레드햇 7.3 에서는 아무 문제없이 잘 됩니다... -_-;
정말 아무 문제도 없이.. -_-;;;
맥OS X의 문제로 보입니다.....

댓글 달기

Filtered HTML

  • 텍스트에 BBCode 태그를 사용할 수 있습니다. URL은 자동으로 링크 됩니다.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>
  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.

BBCode

  • 텍스트에 BBCode 태그를 사용할 수 있습니다. URL은 자동으로 링크 됩니다.
  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param>
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.

Textile

  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • You can use Textile markup to format text.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>

Markdown

  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • Quick Tips:
    • Two or more spaces at a line's end = Line break
    • Double returns = Paragraph
    • *Single asterisks* or _single underscores_ = Emphasis
    • **Double** or __double__ = Strong
    • This is [a link](http://the.link.example.com "The optional title text")
    For complete details on the Markdown syntax, see the Markdown documentation and Markdown Extra documentation for tables, footnotes, and more.
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>

Plain text

  • HTML 태그를 사용할 수 없습니다.
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.
  • 줄과 단락은 자동으로 분리됩니다.
댓글 첨부 파일
이 댓글에 이미지나 파일을 업로드 합니다.
파일 크기는 8 MB보다 작아야 합니다.
허용할 파일 형식: txt pdf doc xls gif jpg jpeg mp3 png rar zip.
CAPTCHA
이것은 자동으로 스팸을 올리는 것을 막기 위해서 제공됩니다.