]> git.ipfire.org Git - thirdparty/openssl.git/commitdiff
o_fopen: fix coding style and build error with VS2010
authorGeorgi Valkov <gvalkov@gmail.com>
Thu, 11 Jul 2024 06:32:47 +0000 (09:32 +0300)
committerMatt Caswell <matt@openssl.org>
Fri, 12 Jul 2024 10:23:56 +0000 (11:23 +0100)
Follow the coding style to place variable definitions before code

Fixes a build error on Windows 2003 with VS2010 introduced in [1]
crypto\o_fopen.c(45) : error C2143: syntax error : missing ';' before 'type'
crypto\o_fopen.c(46) : error C2275: 'DWORD' : illegal use of this type as an expression
        E:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\include\windef.h(152) : see declaration of 'DWORD'
crypto\o_fopen.c(46) : error C2146: syntax error : missing ';' before identifier 'flags'
crypto\o_fopen.c(46) : error C2065: 'flags' : undeclared identifier

[1] https://github.com/openssl/openssl/commit/917f37195ac95252a4c90e86d7d7414c5569aed8

Signed-off-by: Georgi Valkov <gvalkov@gmail.com>
Reviewed-by: Tom Cosgrove <tom.cosgrove@arm.com>
Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/24853)

crypto/o_fopen.c

index ed73e95578e0571a397bba890bacb6a888589783..b12a94d1548b3d91dc4c5695f0b556b0775935f0 100644 (file)
 FILE *openssl_fopen(const char *filename, const char *mode)
 {
     FILE *file = NULL;
+# if defined(_WIN32) && defined(CP_UTF8)
+    int sz, len_0;
+    DWORD flags;
+# endif
 
     if (filename == NULL)
         return NULL;
 # if defined(_WIN32) && defined(CP_UTF8)
-    int sz, len_0 = (int)strlen(filename) + 1;
-    DWORD flags;
+    len_0 = (int)strlen(filename) + 1;
 
     /*
      * Basically there are three cases to cover: a) filename is