2
2
// Rev: 7109 @ 2011-04-15T11:53:16.901970Z
3
3
// Now released as WTFPL
4
4
#include < stdio.h>
5
+ #include < stdint.h>
5
6
#include < time.h>
6
7
#include < string.h>
7
8
#include < string>
@@ -95,12 +96,12 @@ enum VersionFlags{
95
96
VER_DIRTY = 0x01 ,
96
97
};
97
98
struct Version {
98
- unsigned char flags_;
99
- unsigned char major;
100
- unsigned short minor;
101
- unsigned short build;
102
- unsigned char status;
103
- unsigned int revision;
99
+ uint32_t flags_;
100
+ uint32_t major;
101
+ uint32_t minor;
102
+ uint32_t build;
103
+ uint32_t status;
104
+ uint32_t revision;
104
105
time_t timestamp;
105
106
string url;
106
107
string date;
@@ -344,9 +345,9 @@ int main(int argc, char** argv)
344
345
Version ver = {0 };
345
346
ver.date = " unknown date" ;
346
347
347
- // printf("Version: %u.%hu.%hu.%hu #%u\n",ver.major,ver.minor,ver.build,ver.status,ver.revision);
348
+ // printf("Version: %u.%u.%u.%u #%u\n",ver.major,ver.minor,ver.build,ver.status,ver.revision);
348
349
ReadHeader (headerPath, ver);
349
- // printf("Version: %u.%hu.%hu.%hu #%u\n",ver.major,ver.minor,ver.build,ver.status,ver.revision);
350
+ // printf("Version: %u.%u.%u.%u #%u\n",ver.major,ver.minor,ver.build,ver.status,ver.revision);
350
351
unsigned int rev = ver.revision ;
351
352
if (g_repo&REPO_GIT){
352
353
if (QueryGit (Gitpath,&ver))
@@ -373,7 +374,7 @@ int main(int argc, char** argv)
373
374
// if(g_repo){ // increase revision because on commit the revision increases :P
374
375
// ++ver.revision; // So we should use the "comming" revision and not the previous (grml... date and time is wrong though :/ )
375
376
// }
376
- // printf("Version: %u.%hu.%hu.%hu #%u\n",ver.major,ver.minor,ver.build,ver.status,ver.revision);
377
+ // printf("Version: %u.%u.%u.%u #%u\n",ver.major,ver.minor,ver.build,ver.status,ver.revision);
377
378
if (rev!=ver.revision ){
378
379
ver.flags_ |= VER_DIRTY;
379
380
puts (" - increased revision" );
@@ -582,13 +583,13 @@ bool ReadHeader(const char* filepath,Version &ver)
582
583
void PrintDefine (FILE* fp,const char * define,const Version &ver)
583
584
{
584
585
if (!strcasecmp (" MAJOR" ,define)) {
585
- fprintf (fp," %hu " ,ver.major );
586
+ fprintf (fp," %u " ,ver.major );
586
587
}else if (!strcasecmp (" MINOR" ,define)) {
587
- fprintf (fp," %hu " ,ver.minor );
588
+ fprintf (fp," %u " ,ver.minor );
588
589
}else if (!strcasecmp (" BUILD" ,define)) {
589
- fprintf (fp," %hu " ,ver.build );
590
+ fprintf (fp," %u " ,ver.build );
590
591
}else if (!strcasecmp (" STATUS" ,define)) {
591
- fprintf (fp," %hu " ,ver.status );
592
+ fprintf (fp," %u " ,ver.status );
592
593
}else if (!strcasecmp (" STATUS_FULL" ,define)) {
593
594
fprintf (fp," %s" ,STATUS_S[ver.status ]);
594
595
}else if (!strcasecmp (" STATUS_SHORT" ,define)) {
@@ -601,19 +602,19 @@ void PrintDefine(FILE* fp,const char* define,const Version &ver)
601
602
// version strings
602
603
}else if (!strcasecmp (" FULL" ,define)) {
603
604
if (STATUS_S[ver.status ][0 ])
604
- fprintf (fp," %hu.%hu.%hu %s" ,ver.major ,ver.minor ,ver.build ,STATUS_S[ver.status ]);
605
+ fprintf (fp," %u.%u.%u %s" ,ver.major ,ver.minor ,ver.build ,STATUS_S[ver.status ]);
605
606
else
606
- fprintf (fp," %hu.%hu.%hu " ,ver.major ,ver.minor ,ver.build );
607
+ fprintf (fp," %u.%u.%u " ,ver.major ,ver.minor ,ver.build );
607
608
}else if (!strcasecmp (" SHORT" ,define)) {
608
- fprintf (fp," %hu.%hu %s%hu " ,ver.major ,ver.minor ,STATUS_SS[ver.status ],ver.build );
609
+ fprintf (fp," %u.%u %s%u " ,ver.major ,ver.minor ,STATUS_SS[ver.status ],ver.build );
609
610
}else if (!strcasecmp (" SHORT_DOTS" ,define)) {
610
- fprintf (fp," %hu.%hu.%hu " ,ver.major ,ver.minor ,ver.build );
611
+ fprintf (fp," %u.%u.%u " ,ver.major ,ver.minor ,ver.build );
611
612
}else if (!strcasecmp (" SHORT_GREEK" ,define)) {
612
- fprintf (fp," %hu.%hu %s%hu " ,ver.major ,ver.minor ,STATUS_SS2[ver.status ],ver.build );
613
+ fprintf (fp," %u.%u %s%u " ,ver.major ,ver.minor ,STATUS_SS2[ver.status ],ver.build );
613
614
}else if (!strcasecmp (" RC_REVISION" ,define)) {
614
- fprintf (fp," %hu , %u, %u, %u" ,ver.major ,ver.minor ,ver.build ,ver.revision );
615
+ fprintf (fp," %u , %u, %u, %u" ,ver.major ,ver.minor ,ver.build ,ver.revision );
615
616
}else if (!strcasecmp (" RC_STATUS" ,define)) {
616
- fprintf (fp," %hu , %u, %u, %u" ,ver.major ,ver.minor ,ver.build ,ver.status );
617
+ fprintf (fp," %u , %u, %u, %u" ,ver.major ,ver.minor ,ver.build ,ver.status );
617
618
618
619
// repository
619
620
}else if (!strcasecmp (" REVISION_URL" ,define)) {
@@ -623,7 +624,7 @@ void PrintDefine(FILE* fp,const char* define,const Version &ver)
623
624
}else if (!strcasecmp (" REVISION_HASH" ,define)) {
624
625
fprintf (fp," %s" ,ver.revhash .c_str ());
625
626
}else if (!strcasecmp (" REVISION_TAG" ,define)) {
626
- fprintf (fp," v%hu.%hu.%hu#%hu " ,ver.major ,ver.minor ,ver.build ,ver.revision );
627
+ fprintf (fp," v%u.%u.%u#%u " ,ver.major ,ver.minor ,ver.build ,ver.revision );
627
628
if (STATUS_S[ver.status ][0 ]){
628
629
fputc (' -' ,fp);
629
630
for (const char * c=STATUS_S[ver.status ]; *c; ++c){
0 commit comments