2017-02-14 1 views
-1

나는 다음과 같은 코드가 '.':CPP : 전에 예상되는 주요 표현 토큰

class SSLHashSHA1 
{ 
    SSLHashSHA1(); 
    ~SSLHashSHA1(); 
    public: 
     static OSStatus update(string*, int*); 
     static OSStatus final (string*, string*); 
}; 

OSStatus SSLHashSHA1::update(string* ctx, int* ran){ 
    return 0; 
} 

OSStatus SSLHashSHA1::final(string* ctx, string* out){ 
    return 0; 
} 

static OSStatus SSLVerifySignedServerKeyExchange(
    SSLContext *ctx, bool isRsa, SSLBuffer signedParams, uint8_t *signature, uint16_t signatureLen) 
{ 
    OSStatus err; 

    if ((err = SSLHashSHA1.update(&hashCtx, &serverRandom)) != 0) 
     goto fail; 
    if ((err = SSLHashSHA1.update(&hashCtx, &signedParams)) != 0) 
     goto fail; 
     goto fail; 
    if ((err = SSLHashSHA1.final(&hashCtx, &hashOut)) != 0) 
     goto fail; 


    fail: 
     SSLFreeBuffer(&signedHashes); 
     SSLFreeBuffer(&hashCtx); 
     return err; 
} 

을 그리고 난이 제목에서 언급 한 오류가 발생합니다. SSLHashSHA1.update 및 SSLHashSHA1.final 호출에 대해 알게되었습니다. 왜 그렇게해야합니까?

클래스 멤버 함수를 정적으로 만들면 객체를 만들지 않고도 사용할 수 있다고 생각했습니다. 또는 클래스를 구조체 또는 이와 유사한 것으로 변경해야합니까? 여기에 방법을 호출 할 . 연산자를 사용할 수 있도록

+0

쓰기 'SSLHashSHA1 :: 업데이트 (hashCtx, serverRandom)를'고정 멤버 함수를 호출한다. –

답변

2
이 완전히 잘못
SSLHashSHA1.update() 

, SSLHashSHA1, 당신이 언급 한 바와 같이 대신에, 당신의 update는 정적 기능이다, 클래스, 인스턴스가 아닌 따라서이 같은 범위 해상도 연산자 (::)을 사용하여 호출

SSLHashSHA1::update(&hashCtx, &serverRandom)) 
관련 문제