libmicrohttpd
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [libmicrohttpd] How MHD_VERSION works and how to get the "x.y.z-r" s


From: Evgeny Grin
Subject: Re: [libmicrohttpd] How MHD_VERSION works and how to get the "x.y.z-r" string from it?
Date: Wed, 28 Oct 2020 10:35:43 +0300

I'd add that current MHD_VERSION is not a mistake. It is widely used special 
notation for versions and it's explicitly mentioned in the header file.
However, the current trend is to use version as real hex numbers (as version 
numbers become higher) so as Christian said it could be changed for MHD as 
well.

To answer your second question about getting version text string from 
function. We have specialised function named (surprise!) MHD_get_version().
MHD_get_version() returns version's major three numbers (like "0.9.71") as the 
last number in version string is only for developer builds and must be zero 
for any release.

-- 
Wishes,
Evgeny

Christian Grothoff wrote:
> Hi Fermin,
> 
> There isn't a sane way to convert the MHD_VERSION string to the
> x.y.z-string, and it's largely by accident in that we failed to properly
> count in HEX. We are likely to fix that once we go for 1.0. OTOH, the
> idea of the MHD_VERSION string was to do stuff like
> 
> #if MHD_VERSION > 0x44
> bug-fixed-or-feature-available
> #else
> workaround-or-warn
> #endif
> 
> and not to 'show' the version as a human-readable string. And for that,
> the bug should not matter...
> 
> Happy hacking!
> 
> Christian
> 
> On 10/27/20 7:23 PM, FERMIN GALAN MARQUEZ wrote:
> > Hi,
> > 
> >  
> > 
> > The MHD_VERSION is defined as follows
> > 
> >  
> > 
> > /**
> > 
> > * Current version of the library.
> > 
> > * 0x01093001 = 1.9.30-1.
> > 
> > */
> > 
> > #define MHD_VERSION 0x00097000
> > 
> >  
> > 
> > Thus, it seems that by blocks of two digits, each block defines one of
> > the four digits of the usual x.y.z-r version number.
> > 
> >  
> > 
> > Thus, for instance in this case:
> > 
> >  
> > 
> > 00 -> 0. ..
> > 
> > 09 -> .. .9. ..
> > 
> > 70 -> .. .70
> > 
> > 00 -> ..-0
> > 
> >  
> > 
> > resulting in 0.9.70-0. So far so good.
> > 
> >  
> > 
> > However, what has surprised me is that the blocks are interpreted
> > literary instead of hexadecimal (as 0x0 should mean). For instance 70 in
> > hexadecimal is 112 (which would lead to 0.9.112-0 in this case).
> > 
> >  
> > 
> > I have two questions regarding this, please:
> > 
> >  
> > 
> > ·         Why does it work this way? Maybe it’s obvious, but for me is a
> > bit weird J
> > 
> > ·         It seems there is no way of getting the “x.y.z-r” text string
> > directly from the libmicrohttpd functions (please, tell me if I’m wrong…
> > I could have missed some function for that provided by the library
> > itself). It would be great if somebody hat has faced before the same
> > problem could share the code snipped to get the “z.y.z-r” text string
> > from the MHD_VERSION hex number :)
> > 
> >  
> > 
> > Thank you very much in advance!
> > 
> >  
> > 
> > Best regards,
> > 
> >  
> > 
> > ------
> > 
> > Fermín
> > 
> > 
> > ------------------------------------------------------------------------
> > 
> > Este mensaje y sus adjuntos se dirigen exclusivamente a su destinatario,
> > puede contener información privilegiada o confidencial y es para uso
> > exclusivo de la persona o entidad de destino. Si no es usted. el
> > destinatario indicado, queda notificado de que la lectura, utilización,
> > divulgación y/o copia sin autorización puede estar prohibida en virtud
> > de la legislación vigente. Si ha recibido este mensaje por error, le
> > rogamos que nos lo comunique inmediatamente por esta misma vía y proceda
> > a su destrucción.
> > 
> > The information contained in this transmission is privileged and
> > confidential information intended only for the use of the individual or
> > entity named above. If the reader of this message is not the intended
> > recipient, you are hereby notified that any dissemination, distribution
> > or copying of this communication is strictly prohibited. If you have
> > received this transmission in error, do not read it. Please immediately
> > reply to the sender that you have received this communication in error
> > and then delete it.
> > 
> > Esta mensagem e seus anexos se dirigem exclusivamente ao seu
> > destinatário, pode conter informação privilegiada ou confidencial e é
> > para uso exclusivo da pessoa ou entidade de destino. Se não é vossa
> > senhoria o destinatário indicado, fica notificado de que a leitura,
> > utilização, divulgação e/ou cópia sem autorização pode estar proibida em
> > virtude da legislação vigente. Se recebeu esta mensagem por erro,
> > rogamos-lhe que nos o comunique imediatamente por esta mesma via e
> > proceda a sua destruição

Attachment: signature.asc
Description: This is a digitally signed message part.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]