/*
 * Class:     org_eclipse_core_internal_filesystem_local_LocalFileNatives
 * Method:    internalGetFileInfoW
 * Signature: ([CLorg/eclipse/core/filesystem/IFileInfo;)Z
 */
JNIEXPORT jboolean JNICALL Java_org_eclipse_core_internal_filesystem_local_LocalFileNatives_internalGetFileInfoW
   (JNIEnv *env, jclass clazz, jcharArray target, jobject fileInfo) {
	jchar *name;
	jsize size;
	HANDLE handle;
	WIN32_FIND_DATAW info;
	jboolean result;
	
	name = getCharArray(env, target);	
	size = (*env)->GetArrayLength(env, target);
	// FindFirstFile does not work at the root level. However, we 
	// don't need it because the root will never change timestamp
	// The pattern \\?\c:\ represents a root path  
	if (size == 7 && name[2] == '?' && name[5] == ':' && name[6] == '\\') {
		free(name);
		return fillEmptyDirectory(env, fileInfo);
	}
	handle = FindFirstFileW(name, &info);
	if (handle == INVALID_HANDLE_VALUE) {
		free(name);
		if (GetLastError() != ERROR_FILE_NOT_FOUND)
			setIOError(env, fileInfo);
		return JNI_FALSE;
	}

	FindClose(handle);
	result = convertFindDataWToFileInfo(env, info, fileInfo, name);
	free(name);
	return result;
}
Example #2
0
void SslClient::socketError(QAbstractSocket::SocketError err)
{
    if( lastError().isEmpty() ) {
        QString output;
        QDebug errinfo(&output);
        errinfo << err;
        setIOError(output);
    }
    handleDisconnectError(err);
}
Example #3
0
void SslClient::socketReadyRead()
{
    if( !ssl_->bytesAvailable() )
        return;
    
    QByteArray message = ssl_->read(SOCKET_BUFSIZE);
    if( 0 == message.size() ) 
    {
        QList<QSslError> errLst = ssl_->sslErrors();
        if( !errLst.empty() ) {
            QString msg("SSL errors:\n");
            for(QList<QSslError>::const_iterator It = errLst.begin(); It != errLst.end(); ++It)
                msg += It->errorString() + "\n";
            setIOError( msg );
            handler_->onStateChanged(EstablishWarnState);
        }
    }
    else
    {
/*        std::string type = FIX::getField(message,"35");
        if(!type.empty() && type[0] == 'W') {
            std::string sym = FIX::getField(message,"262");
            if( !sym.empty() )
            {
                std::string ask, bid;
                int entries = atol(FIX::getField(message,"268").c_str());
                for(int n = 0; n < entries; n++)
                {
                    type = FIX::getField(message,"269",n);
                    if( !type.empty() && type[0] == '0' )
                        bid = FIX::getField(message,"270",n);
                    else if( !type.empty() && type[0] == '1' )
                        ask = FIX::getField(message,"270",n);
                }

                if( !bid.empty() || !ask.empty() )
                {
                    if(fcheck == NULL)
                        fcheck = fopen("onsocket.txt", "w+c");

                    fprintf(fcheck, "%s: \"%s\"\task=%s, bid=%s\n", 
                                    Global::timestamp().c_str(), 
                                    sym.c_str(), 
                                    ask.c_str(), 
                                    bid.c_str());
                    fflush(fcheck);
                }
            }
        }*/
        handler_->onMessageReceived(message);
    }
}
Example #4
0
void SslClient::socketSendMessage(const QByteArray& message)
{
    if( !running_ )
        return;

    qint64 written = ssl_->write( message );
    if( written <= 0 ) 
    {
        QList<QSslError> errLst = ssl_->sslErrors();
        if( !errLst.empty() ) {
            QString msg("SSL errors:\n");
            for(QList<QSslError>::const_iterator It = errLst.begin(); It != errLst.end(); ++It)
                msg += It->errorString() + "\n";
            setIOError(msg);
            handler_->onStateChanged(EstablishWarnState);
        }
    }
}