From b2123a0a0cf7b52100805b713ca2ecc5b95dd506 Mon Sep 17 00:00:00 2001 From: ShineSea <827191466@qq.com> Date: Wed, 20 May 2026 15:49:35 +0800 Subject: [PATCH] chore: rename WIN32 to _WIN32 across multiple files MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Standardize macro usage: `WIN32` → `_WIN32` - No functional change --- Src/CmdLineParser.h | 4 ++-- Src/CmdLineParser.inl | 22 +++++++++++----------- Src/Image.h | 30 +++++++++++++++--------------- Src/LinearSolvers.h | 4 ++-- Src/MyMiscellany.h | 10 +++++----- 5 files changed, 35 insertions(+), 35 deletions(-) diff --git a/Src/CmdLineParser.h b/Src/CmdLineParser.h index a1fbd0e3..6e885979 100644 --- a/Src/CmdLineParser.h +++ b/Src/CmdLineParser.h @@ -35,9 +35,9 @@ DAMAGE. #include #include -#ifdef WIN32 +#ifdef _WIN32 int strcasecmp( const char* c1 , const char* c2 ); -#endif // WIN32 +#endif // _WIN32 class cmdLineReadable { diff --git a/Src/CmdLineParser.inl b/Src/CmdLineParser.inl index a27a91ec..2bcefaea 100644 --- a/Src/CmdLineParser.inl +++ b/Src/CmdLineParser.inl @@ -29,9 +29,9 @@ DAMAGE. #include #include -#if defined( WIN32 ) || defined( _WIN64 ) +#if defined( _WIN32 ) || defined( _WIN64 ) inline int strcasecmp( const char* c1 , const char* c2 ){ return _stricmp( c1 , c2 ); } -#endif // WIN32 || _WIN64 +#endif // _WIN32 || _WIN64 template< > void cmdLineCleanUp< int >( int* t ){ } template< > void cmdLineCleanUp< float >( float* t ){ } @@ -48,29 +48,29 @@ template< > void cmdLineWriteValue< char* >( char* t , char* str ){ if( t ) sp template< > int cmdLineCopy( int t ){ return t; } template< > float cmdLineCopy( float t ){ return t; } template< > double cmdLineCopy( double t ){ return t; } -#if defined( WIN32 ) || defined( _WIN64 ) +#if defined( _WIN32 ) || defined( _WIN64 ) template< > char* cmdLineCopy( char* t ){ return _strdup( t ); } -#else // !WIN32 && !_WIN64 +#else // !_WIN32 && !_WIN64 template< > char* cmdLineCopy( char* t ){ return strdup( t ); } -#endif // WIN32 || _WIN64 +#endif // _WIN32 || _WIN64 template< > int cmdLineStringToType( const char* str ){ return atoi( str ); } template< > float cmdLineStringToType( const char* str ){ return float( atof( str ) ); } template< > double cmdLineStringToType( const char* str ){ return double( atof( str ) ); } -#if defined( WIN32 ) || defined( _WIN64 ) +#if defined( _WIN32 ) || defined( _WIN64 ) template< > char* cmdLineStringToType( const char* str ){ return _strdup( str ); } -#else // !WIN32 && !_WIN64 +#else // !_WIN32 && !_WIN64 template< > char* cmdLineStringToType( const char* str ){ return strdup( str ); } -#endif // WIN32 || _WIN64 +#endif // _WIN32 || _WIN64 ///////////////////// // cmdLineReadable // ///////////////////// -#if defined( WIN32 ) || defined( _WIN64 ) +#if defined( _WIN32 ) || defined( _WIN64 ) inline cmdLineReadable::cmdLineReadable( const char *name ) : set(false) { this->name = _strdup( name ); } -#else // !WIN32 && !_WIN64 +#else // !_WIN32 && !_WIN64 inline cmdLineReadable::cmdLineReadable( const char *name ) : set(false) { this->name = strdup( name ); } -#endif // WIN32 || _WIN64 +#endif // _WIN32 || _WIN64 inline cmdLineReadable::~cmdLineReadable( void ){ if( name ) free( name ) ; name = NULL; } inline int cmdLineReadable::read( char** , int ){ set = true ; return 0; } diff --git a/Src/Image.h b/Src/Image.h index 067147f0..5f33c7fc 100644 --- a/Src/Image.h +++ b/Src/Image.h @@ -165,15 +165,15 @@ struct FileNameParser inline bool ImageReader::ValidExtension( const char *ext ) { -#ifdef WIN32 +#ifdef _WIN32 if ( !_stricmp( ext , "jpeg" ) || !_stricmp( ext , "jpg" ) ) return true; else if( !_stricmp( ext , "png" ) ) return true; else if( !_stricmp( ext , "iGrid" ) ) return true; -#else // !WIN32 +#else // !_WIN32 if( !strcasecmp( ext , "jpeg" ) || !strcasecmp( ext , "jpg" ) ) return true; else if( !strcasecmp( ext , "png" ) ) return true; else if( !strcasecmp( ext , "iGrid" ) ) return true; -#endif // WIN32 +#endif // _WIN32 return false; } @@ -182,15 +182,15 @@ inline ImageReader* ImageReader::Get( const char* fileName ) unsigned int width , height , channels; ImageReader* reader = NULL; char* ext = FileNameParser::Extension( fileName ); -#ifdef WIN32 +#ifdef _WIN32 if ( !_stricmp( ext , "jpeg" ) || !_stricmp( ext , "jpg" ) ) reader = new JPEGReader( fileName , width , height , channels ); else if( !_stricmp( ext , "png" ) ) reader = new PNGReader( fileName , width , height , channels ); else if( !_stricmp( ext , "iGrid" ) ) reader = new TiledImageReader( fileName , width , height , channels ); -#else // !WIN32 +#else // !_WIN32 if( !strcasecmp( ext , "jpeg" ) || !strcasecmp( ext , "jpg" ) ) reader = new JPEGReader( fileName , width , height , channels ); else if( !strcasecmp( ext , "png" ) ) reader = new PNGReader( fileName , width , height , channels ); else if( !strcasecmp( ext , "iGrid" ) ) reader = new TiledImageReader( fileName , width , height , channels ); -#endif // WIN32 +#endif // _WIN32 else { delete[] ext; @@ -206,33 +206,33 @@ inline ImageReader* ImageReader::Get( const char* fileName ) inline void ImageReader::GetInfo( const char* fileName , unsigned int& width , unsigned int& height , unsigned int& channels ) { char* ext = FileNameParser::Extension( fileName ); -#ifdef WIN32 +#ifdef _WIN32 if( !_stricmp( ext , "jpeg" ) || !_stricmp( ext , "jpg" ) ) JPEGReader::GetInfo( fileName , width , height , channels ); else if( !_stricmp( ext , "png" ) ) PNGReader::GetInfo( fileName , width , height , channels ); else if( !_stricmp( ext , "iGrid" ) ) TiledImageReader::GetInfo( fileName , width , height , channels ); -#else // !WIN32 +#else // !_WIN32 if( !strcasecmp( ext , "jpeg" ) || !strcasecmp( ext , "jpg" ) ) JPEGReader::GetInfo( fileName , width , height , channels ); else if( !strcasecmp( ext , "png" ) ) PNGReader::GetInfo( fileName , width , height , channels ); else if( !strcasecmp( ext , "iGrid" ) ) TiledImageReader::GetInfo( fileName , width , height , channels ); -#endif // WIN32 +#endif // _WIN32 delete[] ext; } inline bool ImageWriter::ValidExtension( const char *ext ) { -#ifdef WIN32 +#ifdef _WIN32 if( !_stricmp( ext , "jpeg" ) || !_stricmp( ext , "jpg" ) ) return true; else if( !_stricmp( ext , "png" ) ) return true; #ifdef SUPPORT_TILES else if( !_stricmp( ext , "iGrid" ) ) return true; #endif // SUPPORT_TILES -#else // !WIN32 +#else // !_WIN32 if( !strcasecmp( ext , "jpeg" ) || !strcasecmp( ext , "jpg" ) ) return true; else if( !strcasecmp( ext , "png" ) ) return true; #ifdef SUPPORT_TILES else if( !strcasecmp( ext , "iGrid" ) ) return true; #endif // SUPPORT_TILES -#endif // WIN32 +#endif // _WIN32 return false; } @@ -240,19 +240,19 @@ inline ImageWriter* ImageWriter::Get( const char* fileName , unsigned int width { ImageWriter* writer = NULL; char* ext = FileNameParser::Extension( fileName ); -#ifdef WIN32 +#ifdef _WIN32 if( !_stricmp( ext , "jpeg" ) || !_stricmp( ext , "jpg" ) ) writer = new JPEGWriter( fileName , width , height , channels , params.quality ); else if( !_stricmp( ext , "png" ) ) writer = new PNGWriter( fileName , width , height , channels , params.quality ); #ifdef SUPPORT_TILES else if( !_stricmp( ext , "iGrid" ) ) writer = new TiledImageWriter( fileName , width , height , channels , params ); #endif // SUPPORT_TILES -#else // !WIN32 +#else // !_WIN32 if( !strcasecmp( ext , "jpeg" ) || !strcasecmp( ext , "jpg" ) ) writer = new JPEGWriter( fileName , width , height , channels , params.quality ); else if( !strcasecmp( ext , "png" ) ) writer = new PNGWriter( fileName , width , height , channels , params.quality ); #ifdef SUPPORT_TILES else if( !strcasecmp( ext , "iGrid" ) ) writer = new TiledImageWriter( fileName , width , height , channels , params ); #endif // SUPPORT_TILES -#endif // WIN32 +#endif // _WIN32 else { delete[] ext; diff --git a/Src/LinearSolvers.h b/Src/LinearSolvers.h index a68c94cc..38f1c852 100644 --- a/Src/LinearSolvers.h +++ b/Src/LinearSolvers.h @@ -3,10 +3,10 @@ #ifdef USE_CHOLMOD #include -#if defined( WIN32 ) || defined( _WIN64 ) +#if defined( _WIN32 ) || defined( _WIN64 ) #pragma message( "[WARNING] Need to explicitly exclude VCOMP.lib" ) #pragma comment( lib , "CHOLMOD_FULL.lib" ) -#endif // WIN32 || _WIN64 +#endif // _WIN32 || _WIN64 #ifdef DLONG typedef long long SOLVER_LONG; #define CHOLMOD( name ) cholmod_l_ ## name diff --git a/Src/MyMiscellany.h b/Src/MyMiscellany.h index 97af7a8a..6128a326 100644 --- a/Src/MyMiscellany.h +++ b/Src/MyMiscellany.h @@ -42,21 +42,21 @@ DAMAGE. //////////////// #include #include -#ifndef WIN32 +#ifndef _WIN32 #include -#endif // WIN32 +#endif // _WIN32 inline double Time( void ) { -#ifdef WIN32 +#ifdef _WIN32 struct _timeb t; _ftime( &t ); return double( t.time ) + double( t.millitm ) / 1000.0; -#else // WIN32 +#else // !_WIN32 struct timeval t; gettimeofday( &t , NULL ); return t.tv_sec + double( t.tv_usec ) / 1000000; -#endif // WIN32 +#endif // _WIN32 } #include