[haiku-commits] Re: haiku: hrev50921 - in src/apps/haikudepot: server util

  • From: Jessica Hamilton <jessica.l.hamilton@xxxxxxxxx>
  • To: "haiku-commits@xxxxxxxxxxxxx" <haiku-commits@xxxxxxxxxxxxx>
  • Date: Tue, 31 Jan 2017 21:51:34 +1300

 class ServerSettings {
 public:
-               static status_t                                 
SetBaseUrl(const BString& baseUrl);
+               static status_t                                 
SetBaseUrl(const BUrl& baseUrl);
                static const BString                    GetUserAgent();
                static void                                             
AugmentHeaders(BHttpHeaders& headers);
-               static BString                                  CreateFullUrl(
+               static BUrl                                             
CreateFullUrl(
                                                                              
          const BString urlPathComponents);
                static void                                             
EnableUrlConnectionTraceLogging();
                static bool                                             
UrlConnectionTraceLoggingEnabled();

 private:
+               static const void                               
_InitUserAgent();
                static const BString                    
_GetUserAgentVersionString();

-               static BString                                  fBaseUrl;
-               static BString                                  fUserAgent;
-               static BLocker                                  
fUserAgentLocker;
-               static bool                                             
fUrlConnectionTraceLogging;
+               static BUrl                                             
sBaseUrl;
+               static BString                                  sUserAgent;
+               static pthread_once_t                   sUserAgentInitOnce;
+               static bool                                             
sUrlConnectionTraceLogging;
 };

I should also point out that it seems you're not using const
correctly[1] (I've fixed the _InitUserAgent() already, which
definitely isn't a const function).

To make a function const, the const should be at the end.

[1] https://isocpp.org/wiki/faq/const-correctness

Other related posts: