static DFBResult GIFReadHeader( IDirectFBVideoProvider_GIF_data *data )
{
     DFBResult ret;
     u8        buf[7];
     
     ret = FetchData( data->buffer, buf, 6 );
     if (ret) {
          GIFERRORMSG("error reading header");
          return ret;
     }

     if (memcmp( buf, "GIF", 3 )) {
          GIFERRORMSG("bad magic");
          return DFB_UNSUPPORTED;
     }
     
     memcpy( data->Version, &buf[3], 3 );
     data->Version[3] = '\0';
     
     ret = FetchData( data->buffer, buf, 7 );
     if (ret) {
          GIFERRORMSG("error reading screen descriptor");
          return ret;
     }

     data->Width           = LM_to_uint( buf[0], buf[1] );
     data->Height          = LM_to_uint( buf[2], buf[3] );
     data->BitPixel        = 2 << (buf[4] & 0x07);
     data->ColorResolution = (((buf[4] & 0x70) >> 3) + 1);
     data->Background      = buf[5];
     data->AspectRatio     = buf[6];
     if (data->AspectRatio)
          data->AspectRatio = ((data->AspectRatio + 15) << 8) >> 6;
     else
Пример #2
0
void CHardwareMonitor::Do_Work()
{
	_log.Log(LOG_STATUS, "Hardware Monitor: Started");

	int msec_counter = 0;
	int sec_counter = POLL_INTERVAL - 3;
	while (!m_stoprequested)
	{
		sleep_milliseconds(500);
		msec_counter++;
		if (msec_counter == 2)
		{
			msec_counter = 0;
			sec_counter++;
			if (sec_counter % 12 == 0) {
				m_LastHeartbeat = mytime(NULL);
			}

			if (sec_counter%POLL_INTERVAL == 0)
			{
				FetchData();
			}
		}
	}

	_log.Log(LOG_STATUS,"Hardware Monitor: Stopped...");			
}
Пример #3
0
// Read one channel value
int APM_Wii_Class::Ch(unsigned char ch)         
{
	//Update every time first axis of sensor is read
	if(ch == 0) FetchData();
	
	return Data[ch];
}
Пример #4
0
bool MemcachedClient::HandleRead(CmdType& t, map<string, string>& resdata, map<string, int>& flags){
  t = CMD_NOTDEF;
  while(true){
    int tmp = recv(sockfd_, recv_buf_+cur_recv_len_, recv_buf_len_-cur_recv_len_, 0);
    if(tmp==-1){
      if(errno!=EAGAIN){
        return false;
      }else{
        return true;
      }
    }else if(tmp==0){
      MCE_WARN("MemcachedClient::HandleRead --> closed by peer");
      return false;
    }
    cur_recv_len_ += tmp;
    total_recv_len_ += tmp;
    bool succ = FetchData(resdata, flags, t);
    if(!succ){
      return false;
    }
    if(t!=CMD_VALUE){
      return true;
    }
  }
  return true;
}
unsigned int
CImportStrategy::GetPsiNumOfIterations()
{
    if (!m_Data->valid)
           FetchData();

    return m_Data->m_PsiNumOfIterations;
}
int 
CImportStrategy::GetDBFilteringID() 
{
    if (!m_Data->valid)
           FetchData();
    
    return m_Data->m_FilteringID;
}
string 
CImportStrategy::GetTask()
{
    if (!m_Data->valid)
           FetchData();
    
    return m_Data->m_Task;
}
TSeqRange 
CImportStrategy::GetQueryRange()
{
    if (!m_Data->valid)
           FetchData();
    
    return m_Data->m_QueryRange;
}
CRef<blast::CBlastOptionsHandle> 
CImportStrategy::GetOptionsHandle()
{
    if (!m_Data->valid)
           FetchData();
    
    return m_Data->m_OptionsHandle;
}
Пример #10
0
string
CImportStrategy::GetDBFilteringKey()
{
    if (!m_Data->valid)
           FetchData();

    return m_Data->m_FilteringKey;
}
Пример #11
0
/// Get Subject Masking Type
ESubjectMaskingType
CImportStrategy::GetSubjectMaskingType()
{
    if (!m_Data->valid)
           FetchData();

    return m_Data->m_SubjectMaskingType;
}
static int GetDataBlock(IDirectFBDataBuffer *buffer, u8 *buf)
{
     unsigned char count;

     if (FetchData( buffer, &count, 1 )) {
          GIFERRORMSG("error in getting DataBlock size");
          return -1;
     }
     ZeroDataBlock = (count == 0);

     if ((count != 0) && FetchData( buffer, buf, count )) {
          GIFERRORMSG("error in reading DataBlock");
          return -1;
     }

     return count;
}
bool
avtOriginatingSource::Update(avtContract_p contract)
{
    lastContract = contract;

    if (!ArtificialPipeline())
        GetOutput()->GetInfo().GetValidity().Reset();
    int t0 = visitTimer->StartTimer();
    avtDataRequest_p data = BalanceLoad(contract);
    visitTimer->StopTimer(t0, "Calling BalanceLoad in avtTermSrc::Update");
    int t1 = visitTimer->StartTimer();
    bool rv = FetchData(data);
    visitTimer->StopTimer(t1, "Calling avtTermSrc::FetchData");

    return rv;
}
static int ReadColorMap( IDirectFBDataBuffer *buffer, int number,
                         u8 buf[3][MAXCOLORMAPSIZE] )
{
     int  i;
     u8   rgb[3*number];
     
     if (FetchData( buffer, rgb, sizeof(rgb) )) {
          GIFERRORMSG("bad colormap");
          return -1;
     }

     for (i = 0; i < number; ++i) {
          buf[CM_RED][i]   = rgb[i*3+0];
          buf[CM_GREEN][i] = rgb[i*3+1];
          buf[CM_BLUE][i]  = rgb[i*3+2];
     }
     
     return 0;
}
Пример #15
0
HRESULT CSRTables::Execute(LONG * /*pcRowsAffected*/,
				ULONG cRestrictions, const VARIANT *rgRestrictions)
{
	ATLTRACE2(atlTraceDBProvider, 2, "CSRTables::Execute\n");

	ClearError();

	int hConn = -1;
	HRESULT hr = CCUBRIDSession::GetSessionPtr(this)->GetConnectionHandle(&hConn);
	if(FAILED(hr)) return hr;

	char table_name[1024]; table_name[0] = 0;
	int table_type = TABLE_TYPE_TABLE | TABLE_TYPE_VIEW | TABLE_TYPE_SYSTEM;
	GetRestrictions(cRestrictions, rgRestrictions, table_name, &table_type);

	{
		T_CCI_ERROR err_buf;
		int hReq = cci_schema_info(hConn, CCI_SCH_CLASS, (table_name[0]?table_name:NULL),
							NULL, CCI_CLASS_NAME_PATTERN_MATCH, &err_buf);
		if(hReq<0)
		{
			ATLTRACE2("cci_schema_info fail\n");
			return RaiseError(E_FAIL, 1, __uuidof(IDBSchemaRowset), err_buf.err_msg);
		}

		int res = cci_cursor(hReq, 1, CCI_CURSOR_FIRST, &err_buf);
		if(res==CCI_ER_NO_MORE_DATA) goto done;
		if(res<0) goto error;

		while(1)
		{
			CTABLESRow trData;
			hr = FetchData(hReq, trData, table_type);
			if(FAILED(hr))
			{
				cci_close_req_handle(hReq);
				return hr;
			}

			if(hr==S_OK) // S_FALSE면 추가하지 않음
			{
				_ATLTRY
				{
					// TABLE_TYPE, TABLE_NAME 순으로 정렬해야 한다.
					size_t nPos;
					for( nPos=0 ; nPos<m_rgRowData.GetCount() ; nPos++ )
					{
						int res = CompareStringW(LOCALE_USER_DEFAULT, 
								NORM_IGNOREKANATYPE | NORM_IGNOREWIDTH | SORT_STRINGSORT,
								m_rgRowData[nPos].m_szType, -1,
								trData.m_szType, -1);
						if(res==CSTR_GREATER_THAN) break;
						if(res==CSTR_EQUAL)
						{
							res = CompareStringW(LOCALE_USER_DEFAULT, 
									NORM_IGNOREKANATYPE | NORM_IGNOREWIDTH | SORT_STRINGSORT,
									m_rgRowData[nPos].m_szTable, -1,
									trData.m_szTable, -1);
							if(res==CSTR_GREATER_THAN) break;
						}
					}
					m_rgRowData.InsertAt(nPos, trData);
				}
				_ATLCATCHALL()
				{
					ATLTRACE2("out of memory\n");
					cci_close_req_handle(hReq);
					return E_OUTOFMEMORY;
				}
			}

			res = cci_cursor(hReq, 1, CCI_CURSOR_CURRENT, &err_buf);
			if(res==CCI_ER_NO_MORE_DATA) goto done;
			if(res<0) goto error;
		}

error:
		ATLTRACE2("fail to fetch data\n");
		cci_close_req_handle(hReq);
		return RaiseError(E_FAIL, 1, __uuidof(IDBSchemaRowset), err_buf.err_msg);
done:
		cci_close_req_handle(hReq);
	}
Пример #16
0
int
main(int argc, char **argv)
{
    char **av = argv;
    struct sockaddr_in host;
    afs_int32 code;
    struct hostent *hp;
    char hnamebuf[200];
    struct timeval tv;
    int noAuth = 1;		/* Default is authenticated connections */

    argc--, av++;
    if (argc < 1) {
	printf("usage: pxclient <serverHost>\n");
	exit(1);
    }
    memset(&host, 0, sizeof(struct sockaddr_in));
    host.sin_family = AF_INET;
    host.sin_addr.s_addr = inet_addr(av[0]);
#ifdef STRUCT_SOCKADDR_HAS_SA_LEN
    host.sin_len = sizeof(struct sockaddr_in);
#endif
    if (host.sin_addr.s_addr != -1) {
	strcpy(hnamebuf, av[0]);
    } else {
	hp = gethostbyname(av[0]);
	if (hp) {
	    host.sin_family = hp->h_addrtype;
	    memcpy((caddr_t) & host.sin_addr, hp->h_addr, hp->h_length);
	} else {
	    printf("unknown server host %s\n", av[0]);
	    exit(1);
	}
    }
    if ((code = pxclient_Initialize(noAuth, host.sin_addr.s_addr)) != 0) {
	printf("Couldn't initialize fs library (code=%d).\n", code);
	exit(1);
    }

    code = ubik_Call(RXAFS_GetTime, cstruct, 0, &tv.tv_sec, &tv.tv_usec);
    if (!code)
	printf("AFS_GetTime on %s sec=%ld, usec=%ld\n", av[0], tv.tv_sec,
	       (long int)tv.tv_usec);
    else
	printf("return code is %d\n", code);

#ifdef notdef
    while (1) {
	char line[500];
	int nargs;

	printf("fs> ");
	if (fgets(line, 499, stdin) != NULL) {
	    char *oper;
	    char **argp = args;
	    GetArgs(line, argp, &nargs);
	    oper = &argp[0][0];
	    ++argp, --nargs;
	    if (!strcmp(oper, "probe")) {
		code =
		    ubik_Call(RXAFS_GetTime, cstruct, 0, &tv.tv_sec,
			      &tv.tv_usec);
		printf("return code is %d\n", code);
		if (!code)
		    printf("sec=%d\n", tv.tv_sec);
	    } else if (!strcmp(oper, "fsstats")) {
		struct afsStatistics stats;

		code = ubik_AFS_GetStatistics(cstruct, 0, &stats);
		printf("return code is %d\n", code);
	    } else if (!strcmp(oper, "fd")) {
		code = FetchData(argp);
		printf("return code is %d\n", code);
	    } else if (!strcmp(oper, "fs")) {
		code = FetchStatus(argp);
		printf("return code is %d\n", code);
	    } else if (!strcmp(oper, "fa")) {
		code = FetchACL(argp);
		printf("return code is %d\n", code);
	    } else if (!strcmp(oper, "sd")) {
		code = StoreData(argp);
		printf("return code is %d\n", code);
	    } else if (!strcmp(oper, "ss")) {
		code = StoreStatus(argp);
		printf("return code is %d\n", code);
	    } else if (!strcmp(oper, "sa")) {
		code = StoreACL(argp);
		printf("return code is %d\n", code);
	    } else if (!strcmp(oper, "cf")) {
		code = CreateFile(argp);
		printf("return code is %d\n", code);
	    } else if (!strcmp(oper, "rf")) {
		code = RemoveFile(argp);
		printf("return code is %d\n", code);
	    } else if (!strcmp(oper, "rn")) {
		code = Rename(argp);
		printf("return code is %d\n", code);
	    } else if (!strcmp(oper, "sl")) {
		code = Symlink(argp);
		printf("return code is %d\n", code);
	    } else if (!strcmp(oper, "hl")) {
		code = HardLink(argp);
		printf("return code is %d\n", code);
	    } else if (!strcmp(oper, "md")) {
		code = MakeDir(argp);
		printf("return code is %d\n", code);
	    } else if (!strcmp(oper, "rd")) {
		code = RemoveDir(argp);
		printf("return code is %d\n", code);
	    } else if (!strcmp(oper, "rdd")) {
		code = Readdir(argp);
		printf("return code is %d\n", code);
	    } else if (!strcmp(oper, "mm")) {
		code = MakeMountPoint(argp);
		printf("return code is %d\n", code);
	    } else if (!strcmp(oper, "rt")) {
		code = ReleaseTokens(argp);
		printf("return code is %d\n", code);
	    } else if (!strcmp(oper, "bs")) {
		code = BulkStatus(argp);
		printf("return code is %d\n", code);
	    } else if (!strcmp(oper, "lk")) {
		code = Lookup(argp);
		printf("return code is %d\n", code);
	    } else if (!strcmp(oper, "gt")) {
		code = GetToken(argp);
		printf("return code is %d\n", code);
	    } else if (!strcmp(oper, "ka")) {
		code = KeepAlive(argp);
		printf("return code is %d\n", code);
	    } else if ((!strcmp(oper, "q")) || !strcmp(oper, "quit"))
		exit(0);
	    else {
		printf("Unknown oper! Available operations: \n\n");
		printf("fd <vnode> <unique> <pos> <len>\n");
		printf("fs <vnode> <unique>\n");
		printf("fa <vnode> <unique>\n");
		printf
		    ("sd <vnode> <unique> <pos> <len> <flen> [<mode>|-1] [<owner>|-1] [<length>|-1] <string>\n");
		printf
		    ("ss <vnode> <unique> [<mode>|-1] [<owner>|-1] [<length>|-1]\n");
		printf("sa <vnode> <unique> <string>\n");
		printf("rf <vnode> <unique> <name>\n");
		printf
		    ("cf <vnode> <unique> <name> [<mode>|-1] [<owner>|-1] [<length>|-1]\n");
		printf
		    ("rn <ovnode> <ounique> <oname> <nvnode> <nunique> <nname>\n");
		printf
		    ("sl <vnode> <unique> <name> <contents> [<mode>|-1] [<owner>|-1] [<length>|-1]\n");
		printf("hl <dvnode> <dunique> <name> <evnode> <eunique>\n");
		printf
		    ("md <vnode> <unique> <name> [<mode>|-1] [<owner>|-1] [<length>|-1]\n");
		printf("rd <vnode> <unique> <name>\n");
		printf("rdd <vnode> <unique> <pos> <len>\n");
		printf("lk <vnode> <unique> <name>\n");
		printf("gt <vnode> <unique> <tokenID>\n");
		printf("ka <vol.l> <vnode> <unique> <isExec> <kaTime>\n");
	    }
	}
    }
#endif
    return 0;
}
Пример #17
0
HRESULT CSRColumns::Execute(LONG * /*pcRowsAffected*/,
				ULONG cRestrictions, const VARIANT *rgRestrictions)
{
	ATLTRACE2(atlTraceDBProvider, 2, "CSRColumns::Execute\n");

	ClearError();

	int hConn = -1;
	HRESULT hr = CCUBRIDSession::GetSessionPtr(this)->GetConnectionHandle(&hConn);
	if(FAILED(hr)) return hr;

	ULONG ulMaxLen = CCUBRIDSession::GetSessionPtr(this)->GetDataSourcePtr()->PARAM_MAX_STRING_LENGTH;

	char table_name[1024]; table_name[0] = 0;
	char column_name[1024]; column_name[0] = 0;
	GetRestrictions(cRestrictions, rgRestrictions, table_name, column_name);

	{
		T_CCI_ERROR err_buf;
		int hReq = cci_schema_info(hConn, CCI_SCH_ATTRIBUTE,
							(table_name[0]?table_name:NULL),
							(column_name[0]?column_name:NULL),
							CCI_CLASS_NAME_PATTERN_MATCH | CCI_ATTR_NAME_PATTERN_MATCH,
							&err_buf);
		if(hReq<0)
		{
			ATLTRACE2("cci_schema_info fail\n");
			return E_FAIL;
		}

		int res = cci_cursor(hReq, 1, CCI_CURSOR_FIRST, &err_buf);
		if(res==CCI_ER_NO_MORE_DATA) goto done;
		if(res<0) goto error;
		while(1)
		{
			CCOLUMNSRow crData;
			hr = FetchData(hReq, crData);
			if(FAILED(hr)) goto error;

			//MAX STRING LENGTH 반영
			if (crData.m_ulCharMaxLength != (ULONG)~0 && crData.m_ulCharMaxLength > ulMaxLen)
				crData.m_ulCharMaxLength = ulMaxLen;
			if (crData.m_ulCharMaxLength != (ULONG)~0 && crData.m_ulCharOctetLength > ulMaxLen)
				crData.m_ulCharOctetLength = ulMaxLen;

			_ATLTRY
			{
				// TABLE_NAME 순으로 정렬한다.
				size_t nPos;
				for( nPos=0 ; nPos<m_rgRowData.GetCount() ; nPos++ )
				{
					int res = CompareStringW(LOCALE_USER_DEFAULT, 
							NORM_IGNOREKANATYPE | NORM_IGNOREWIDTH | SORT_STRINGSORT,
							m_rgRowData[nPos].m_szTableName, -1,
							crData.m_szTableName, -1);
					if(res==CSTR_GREATER_THAN) break;
				}
				m_rgRowData.InsertAt(nPos, crData);
			}
			_ATLCATCHALL()
			{
				ATLTRACE2("out of memory\n");
				cci_close_req_handle(hReq);
				return E_OUTOFMEMORY;
			}

			res = cci_cursor(hReq, 1, CCI_CURSOR_CURRENT, &err_buf);
			if(res==CCI_ER_NO_MORE_DATA) goto done;
			if(res<0) goto error;
		}

error:
		ATLTRACE2("fail to fetch data\n");
		cci_close_req_handle(hReq);
		return RaiseError(E_FAIL, 1, __uuidof(IDBSchemaRowset), err_buf.err_msg);
done:
		cci_close_req_handle(hReq);
	}

	return S_OK;
}
Пример #18
0
HRESULT CSRKeyColumnUsage::Execute(LONG *pcRowsAffected, ULONG cRestrictions, const VARIANT *rgRestrictions)
{
	ATLTRACE2(atlTraceDBProvider, 2, "CSRKeyColumnUsage::Execute()\n");
	////
	int cci_connection_handle = -999;

	WCHAR tableName[128] = {'\0', };

	HRESULT hr = E_FAIL;
	////

	cci_connection_handle = CCUBRIDSession::GetSessionPtr(this)->GetConnection();
	UINT uCodepage = CCUBRIDSession::GetSessionPtr(this)->GetCodepage();
	GetRestrictions(cRestrictions, rgRestrictions, tableName);

	////
	int cci_return_code = -999;
	int cci_request_handle = 0;
	T_CCI_ERROR cci_error_buffer;
	////
#if 1
	CW2A _tableName(tableName, uCodepage);
	cci_return_code = cci_schema_info
		(
		cci_connection_handle, 
		CCI_SCH_PRIMARY_KEY, 
		(tableName[0]? (PSTR) _tableName : NULL), 
		NULL,							// no attribute name is specified.
		CCI_CLASS_NAME_PATTERN_MATCH, 
		&cci_error_buffer
		);
#endif
	if (cci_return_code < 0)
	{
		ATLTRACE2(atlTraceDBProvider, 2, "CSRPrimaryKeys::cci_schema_info() FAILED! \n");
		return RaiseError(E_FAIL, 1, __uuidof(IDBSchemaRowset), CA2W(cci_error_buffer.err_msg, uCodepage));
	}

	cci_request_handle = cci_return_code;

	cci_return_code = cci_cursor(cci_request_handle, 1, CCI_CURSOR_FIRST, &cci_error_buffer);
	if (cci_return_code < 0)
	{
		if (cci_return_code == CCI_ER_NO_MORE_DATA)
		{
			cci_close_req_handle(cci_request_handle);
			return S_OK;
		}
		else
		{
			cci_close_req_handle(cci_request_handle);
			return RaiseError(E_FAIL, 1, __uuidof(IDBSchemaRowset), CA2W(cci_error_buffer.err_msg, uCodepage));
		}
	}

	while (1)
	{
		CKeyColumnUsageRow row;

		hr = FetchData(cci_request_handle, uCodepage, row);
		if (FAILED(hr))
			return hr;

		if (hr == S_OK)
		{
			_ATLTRY
			{
				size_t position = 0;
				for (position = 0; position < m_rgRowData.GetCount() ; position++)
				{
					int result = CompareStringW(LOCALE_USER_DEFAULT, NORM_IGNOREKANATYPE | NORM_IGNOREWIDTH | SORT_STRINGSORT, m_rgRowData[position].GetConstraintName(), -1, row.GetConstraintName(), -1);
					if ( result == CSTR_GREATER_THAN ) 
					{
							break;
					}
					else if (result == CSTR_EQUAL)
					{
						result = CompareStringW(LOCALE_USER_DEFAULT, NORM_IGNOREKANATYPE | NORM_IGNOREWIDTH | SORT_STRINGSORT, m_rgRowData[position].GetTableName(), -1, row.GetTableName(), -1);
						if (result == CSTR_GREATER_THAN)
							break;
						else if (result == CSTR_EQUAL)
						{
							if (m_rgRowData[position].GetOrdinalPosition() >= row.GetOrdinalPosition())
								break;
						}
					}
				}
				m_rgRowData.InsertAt(position, row);
			}
			_ATLCATCHALL()
			{
				cci_close_req_handle(cci_request_handle);
				return E_OUTOFMEMORY;
			}

		}
		cci_return_code = cci_cursor(cci_request_handle, 1, CCI_CURSOR_CURRENT, &cci_error_buffer);
		if (cci_return_code < 0)
		{
			if (cci_return_code == CCI_ER_NO_MORE_DATA)
			{
				cci_close_req_handle(cci_request_handle);
				return S_OK;
			}
			else
			{
				cci_close_req_handle(cci_request_handle);
				return RaiseError(E_FAIL, 1, __uuidof(IDBSchemaRowset), CA2W(cci_error_buffer.err_msg, uCodepage));
			}
		}
	}
static int ReadImage( IDirectFBVideoProvider_GIF_data *data, 
                      int left, int top, int width, int height,
                      u8 cmap[3][MAXCOLORMAPSIZE], bool interlace, bool ignore )
{
     u8   c;
     int  v;
     int  xpos = 0, ypos = 0, pass = 0;
     u32 *image, *dst;

     /*
     **  Initialize the decompression routines
     */
     if (FetchData( data->buffer, &c, 1 ))
          GIFERRORMSG("EOF / read error on image data");

     if (LWZReadByte( data, true, c ) < 0)
          GIFERRORMSG("error reading image");

     /*
     **  If this is an "uninteresting picture" ignore it.
     */
     if (ignore) {
          GIFDEBUGMSG("skipping image...");

          while (LWZReadByte( data, false, c ) >= 0)
               ;
          return 0;
     }
     
     switch (data->disposal) {
          case 2:
               GIFDEBUGMSG("restoring to background color...");
               memset( data->image, 0, data->Width * data->Height * 4 );
               break;
          case 3:
               GIFERRORMSG("restoring to previous frame is unsupported");
               break;
          default:
               break;
     }
     
     dst = image = data->image + (top * data->Width + left);

     GIFDEBUGMSG("reading %dx%d at %dx%d %sGIF image",
                 width, height, left, top, interlace ? " interlaced " : "" );

     while ((v = LWZReadByte( data, false, c )) >= 0 ) {
          if (v != data->transparent) {
               dst[xpos] = (0xFF000000              |
                            cmap[CM_RED][v]   << 16 |
                            cmap[CM_GREEN][v] << 8  |
                            cmap[CM_BLUE][v]);
          }

          ++xpos;
          if (xpos == width) {
               xpos = 0;
               if (interlace) {
                    switch (pass) {
                         case 0:
                         case 1:
                              ypos += 8;
                              break;
                         case 2:
                              ypos += 4;
                              break;
                         case 3:
                              ypos += 2;
                              break;
                    }

                    if (ypos >= height) {
                         ++pass;
                         switch (pass) {
                              case 1:
                                   ypos = 4;
                                   break;
                              case 2:
                                   ypos = 2;
                                   break;
                              case 3:
                                   ypos = 1;
                              break;
                              default:
                                   goto fini;
                         }
                    }
               }
               else {
                    ++ypos;
               }
               dst = image + ypos * data->Width;
          } 
          if (ypos >= height) {
               break;
          }
     }

fini:

     if (LWZReadByte( data, false, c ) >= 0) {
          GIFERRORMSG("too much input data, ignoring extra...");
          //while (LWZReadByte( data, false, c ) >= 0);
     }

     return 0;
}