diff --git a/devtools/convbdf.cpp b/devtools/convbdf.cpp index 88bb078f0bd..d6eb785fb1c 100644 --- a/devtools/convbdf.cpp +++ b/devtools/convbdf.cpp @@ -66,8 +66,8 @@ struct BdfFont { BdfBoundingBox *boxes; void reset() { - familyName = 0; - slant = 0; + familyName = nullptr; + slant = nullptr; maxAdvance = 0; size = 0; height = 0; @@ -78,9 +78,9 @@ struct BdfFont { defaultCharacter = 0; numCharacters = 0; - bitmaps = 0; - advances = 0; - boxes = 0; + bitmaps = nullptr; + advances = nullptr; + boxes = nullptr; } BdfFont() { @@ -231,7 +231,7 @@ int main(int argc, char *argv[]) { int encoding = -1; int xAdvance; - unsigned char *bitmap = 0; + unsigned char *bitmap = nullptr; BdfBoundingBox bbox = font.defaultBox; while (true) { @@ -347,13 +347,13 @@ int main(int argc, char *argv[]) { // Free the advance table, in case all glyphs use the same advance if (hasFixedAdvance) { delete[] font.advances; - font.advances = 0; + font.advances = nullptr; } // Free the box table, in case all glyphs use the same box if (hasFixedBBox) { delete[] font.boxes; - font.boxes = 0; + font.boxes = nullptr; } // Adapt for the fact that we never use encoding 0. @@ -367,10 +367,10 @@ int main(int argc, char *argv[]) { // Try to compact the tables if (charsAvailable < font.numCharacters) { unsigned char **bitmaps = new unsigned char *[charsAvailable]; - BdfBoundingBox *boxes = 0; + BdfBoundingBox *boxes = nullptr; if (!hasFixedBBox) boxes = new BdfBoundingBox[charsAvailable]; - unsigned char *advances = 0; + unsigned char *advances = nullptr; if (!hasFixedAdvance) advances = new unsigned char[charsAvailable]; @@ -384,7 +384,7 @@ int main(int argc, char *argv[]) { if (!hasFixedAdvance) advances[i] = font.advances[encoding]; } else { - bitmaps[i] = 0; + bitmaps[i] = nullptr; } } @@ -399,7 +399,7 @@ int main(int argc, char *argv[]) { } char dateBuffer[256]; - time_t curTime = time(0); + time_t curTime = time(nullptr); snprintf(dateBuffer, sizeof(dateBuffer), "%s", ctime(&curTime)); // Finally output the cpp source file to stdout diff --git a/devtools/create_hugo/create_hugo.cpp b/devtools/create_hugo/create_hugo.cpp index dd7776ae397..594fd673922 100644 --- a/devtools/create_hugo/create_hugo.cpp +++ b/devtools/create_hugo/create_hugo.cpp @@ -855,7 +855,7 @@ int main(int argc, char *argv[]) { FILE* src_file; char buf[2]; src_file = fopen("btn_1.bmp", "rb"); - if (src_file == NULL) { + if (src_file == nullptr) { perror("btn_1.bmp"); fclose(outFile); return -1; @@ -871,7 +871,7 @@ int main(int argc, char *argv[]) { fclose(src_file); src_file = fopen("btn_1_off.bmp", "rb"); - if (src_file == NULL) { + if (src_file == nullptr) { perror("btn_1_off.bmp"); fclose(outFile); return -1; @@ -887,7 +887,7 @@ int main(int argc, char *argv[]) { fclose(src_file); src_file = fopen("btn_2.bmp", "rb"); - if (src_file == NULL) { + if (src_file == nullptr) { perror("btn_2.bmp"); fclose(outFile); return -1; @@ -903,7 +903,7 @@ int main(int argc, char *argv[]) { fclose(src_file); src_file = fopen("btn_2_off.bmp", "rb"); - if (src_file == NULL) { + if (src_file == nullptr) { perror("btn_2_off.bmp"); fclose(outFile); return -1; @@ -919,7 +919,7 @@ int main(int argc, char *argv[]) { fclose(src_file); src_file = fopen("btn_3.bmp", "rb"); - if (src_file == NULL) { + if (src_file == nullptr) { perror("btn_3.bmp"); fclose(outFile); return -1; @@ -935,7 +935,7 @@ int main(int argc, char *argv[]) { fclose(src_file); src_file = fopen("btn_3_off.bmp", "rb"); - if (src_file == NULL) { + if (src_file == nullptr) { perror("btn_3_off.bmp"); fclose(outFile); return -1; @@ -951,7 +951,7 @@ int main(int argc, char *argv[]) { fclose(src_file); src_file = fopen("btn_4.bmp", "rb"); - if (src_file == NULL) { + if (src_file == nullptr) { perror("btn_4.bmp"); fclose(outFile); return -1; @@ -967,7 +967,7 @@ int main(int argc, char *argv[]) { fclose(src_file); src_file = fopen("btn_4_off.bmp", "rb"); - if (src_file == NULL) { + if (src_file == nullptr) { perror("btn_4_off.bmp"); fclose(outFile); return -1; @@ -983,7 +983,7 @@ int main(int argc, char *argv[]) { fclose(src_file); src_file = fopen("btn_5.bmp", "rb"); - if (src_file == NULL) { + if (src_file == nullptr) { perror("btn_5.bmp"); fclose(outFile); return -1; @@ -999,7 +999,7 @@ int main(int argc, char *argv[]) { fclose(src_file); src_file = fopen("btn_5_off.bmp", "rb"); - if (src_file == NULL) { + if (src_file == nullptr) { perror("btn_5_off.bmp"); fclose(outFile); return -1; @@ -1015,7 +1015,7 @@ int main(int argc, char *argv[]) { fclose(src_file); src_file = fopen("btn_6.bmp", "rb"); - if (src_file == NULL) { + if (src_file == nullptr) { perror("btn_6.bmp"); fclose(outFile); return -1; @@ -1031,7 +1031,7 @@ int main(int argc, char *argv[]) { fclose(src_file); src_file = fopen("btn_6_off.bmp", "rb"); - if (src_file == NULL) { + if (src_file == nullptr) { perror("btn_6_off.bmp"); fclose(outFile); return -1; @@ -1047,7 +1047,7 @@ int main(int argc, char *argv[]) { fclose(src_file); src_file = fopen("btn_7.bmp", "rb"); - if (src_file == NULL) { + if (src_file == nullptr) { perror("btn_7.bmp"); fclose(outFile); return -1; @@ -1063,7 +1063,7 @@ int main(int argc, char *argv[]) { fclose(src_file); src_file = fopen("btn_7_off.bmp", "rb"); - if (src_file == NULL) { + if (src_file == nullptr) { perror("btn_7_off.bmp"); fclose(outFile); return -1; @@ -1079,7 +1079,7 @@ int main(int argc, char *argv[]) { fclose(src_file); src_file = fopen("btn_8.bmp", "rb"); - if (src_file == NULL) { + if (src_file == nullptr) { perror("btn_8.bmp"); fclose(outFile); return -1; @@ -1095,7 +1095,7 @@ int main(int argc, char *argv[]) { fclose(src_file); src_file = fopen("btn_8_off.bmp", "rb"); - if (src_file == NULL) { + if (src_file == nullptr) { perror("btn_8_off.bmp"); fclose(outFile); return -1; @@ -1111,7 +1111,7 @@ int main(int argc, char *argv[]) { fclose(src_file); src_file = fopen("btn_9.bmp", "rb"); - if (src_file == NULL) { + if (src_file == nullptr) { perror("btn_9.bmp"); fclose(outFile); return -1; @@ -1127,7 +1127,7 @@ int main(int argc, char *argv[]) { fclose(src_file); src_file = fopen("btn_9_off.bmp", "rb"); - if (src_file == NULL) { + if (src_file == nullptr) { perror("btn_9_off.bmp"); fclose(outFile); return -1; @@ -1263,7 +1263,7 @@ void writeScreenActs(FILE *outFile, const uint16 *screenActs[], int nbrElem) { writeUint16BE(outFile, nbrElem); for (int i = 0; i < nbrElem; i++) { - if (screenActs[i] == 0) + if (screenActs[i] == nullptr) writeUint16BE(outFile, 0); else { nbrSubElem = 1; @@ -1283,7 +1283,7 @@ void writeObjectArray(FILE *outFile, const object_t objects[], int nbrElem) { for (int i = 0; i < nbrElem; i++) { writeUint16BE(outFile, objects[i].nounIndex); writeUint16BE(outFile, objects[i].dataIndex); - if (objects[i].stateDataIndex == NULL) + if (objects[i].stateDataIndex == nullptr) writeUint16BE(outFile, 0); else { nbrSubElem = 1; @@ -1337,7 +1337,7 @@ void writeActListArray(FILE *outFile, const actList actListArr[], int nbrElem) { writeUint16BE(outFile, nbrElem); for (int i = 0; i < nbrElem; i++) { - for (nbrSubElem = 0; actListArr[i][nbrSubElem] != NULL; nbrSubElem++) + for (nbrSubElem = 0; actListArr[i][nbrSubElem] != nullptr; nbrSubElem++) ; writeUint16BE(outFile, nbrSubElem); for (int j = 0; j < nbrSubElem; j++) { diff --git a/devtools/create_kyradat/create_kyradat.cpp b/devtools/create_kyradat/create_kyradat.cpp index 6ac12b2a606..2847638e007 100644 --- a/devtools/create_kyradat/create_kyradat.cpp +++ b/devtools/create_kyradat/create_kyradat.cpp @@ -1163,7 +1163,7 @@ const ExtractFilename *getFilenameDesc(const int id) { if (i->id == id) return i; } - return 0; + return nullptr; } bool isLangSpecific(const int id) { diff --git a/devtools/create_kyradat/games.cpp b/devtools/create_kyradat/games.cpp index 27eb8da9bef..67c3fc0f836 100644 --- a/devtools/create_kyradat/games.cpp +++ b/devtools/create_kyradat/games.cpp @@ -173,7 +173,7 @@ const Game * const gameDescs[] = { lolGames, eob1Games, eob2Games, - 0 + nullptr }; // Need tables @@ -4435,7 +4435,7 @@ const GameNeed gameNeedTable[] = { //{ kEoB2, kPlatformPC98, kNoSpecial, eob2PC98Need }, { kEoB2, kPlatformFMTowns, kNoSpecial, eob2FMTownsNeed }, - { -1, -1, -1, 0 } + { -1, -1, -1, nullptr } }; } // end of anonymous namespace @@ -4446,5 +4446,5 @@ const int *getNeedList(const Game *g) { return need->entries; } - return 0; + return nullptr; } diff --git a/devtools/create_kyradat/md5.cpp b/devtools/create_kyradat/md5.cpp index 705275f73bb..b42f9041cda 100644 --- a/devtools/create_kyradat/md5.cpp +++ b/devtools/create_kyradat/md5.cpp @@ -228,7 +228,7 @@ bool md5_file(const char *name, uint8 digest[16], uint32 length) { FILE *f; f = fopen(name, "rb"); - if (f == NULL) { + if (f == nullptr) { printf("md5_file couldn't open '%s'\n", name); return false; } diff --git a/devtools/create_kyradat/pak.cpp b/devtools/create_kyradat/pak.cpp index 78fe418c6b3..9427d562106 100644 --- a/devtools/create_kyradat/pak.cpp +++ b/devtools/create_kyradat/pak.cpp @@ -31,7 +31,7 @@ bool PAKFile::loadFile(const char *file, const bool isAmiga) { return true; delete _fileList; - _fileList = 0; + _fileList = nullptr; FILE *pakfile = fopen(file, "rb"); if (!pakfile) @@ -47,7 +47,7 @@ bool PAKFile::loadFile(const char *file, const bool isAmiga) { fclose(pakfile); - const char *currentName = 0; + const char *currentName = nullptr; uint32 startoffset = _isAmiga ? READ_BE_UINT32(buffer) : READ_LE_UINT32(buffer); uint32 endoffset = 0; @@ -73,7 +73,7 @@ bool PAKFile::loadFile(const char *file, const bool isAmiga) { assert(data); memcpy(data, buffer + startoffset, endoffset - startoffset); addFile(currentName, data, endoffset - startoffset); - data = 0; + data = nullptr; if (endoffset == filesize) break; @@ -152,7 +152,7 @@ bool PAKFile::outputAllFiles() { } bool PAKFile::outputFileAs(const char *f, const char *fn) { - FileList *cur = (_fileList != 0) ? _fileList->findEntry(f) : 0; + FileList *cur = (_fileList != nullptr) ? _fileList->findEntry(f) : nullptr; if (!cur) { error("file '%s' not found", f); @@ -177,10 +177,10 @@ bool PAKFile::outputFileAs(const char *f, const char *fn) { } const uint8 *PAKFile::getFileData(const char *file, uint32 *size) { - FileList *cur = (_fileList != 0) ? _fileList->findEntry(file) : 0; + FileList *cur = (_fileList != nullptr) ? _fileList->findEntry(file) : nullptr; if (!cur) - return 0; + return nullptr; if (size) *size = cur->size; @@ -234,10 +234,10 @@ bool PAKFile::addFile(const char *name, uint8 *data, uint32 size) { } bool PAKFile::removeFile(const char *name) { - for (FileList *cur = _fileList, *last = 0; cur; last = cur, cur = cur->next) { + for (FileList *cur = _fileList, *last = nullptr; cur; last = cur, cur = cur->next) { if (scumm_stricmp(cur->filename, name) == 0) { FileList *next = cur->next; - cur->next = 0; + cur->next = nullptr; delete cur; if (last) last->next = next; diff --git a/devtools/create_kyradat/resources.cpp b/devtools/create_kyradat/resources.cpp index ea13d5e86b3..e9635c97187 100644 --- a/devtools/create_kyradat/resources.cpp +++ b/devtools/create_kyradat/resources.cpp @@ -4572,7 +4572,7 @@ static const ResourceProvider resourceProviders[] = { { kLoLCharacterDefs, kLoL, kPlatformDOS, kTalkieDemoVersion, EN_ANY, &kLoLCharacterDefsDOSCDDemoProvider }, { kLoLCharacterDefs, kLoL, kPlatformDOS, kTalkieDemoVersion, FR_FRA, &kLoLCharacterDefsDOSCDDemoProvider }, { kLoLCharacterDefs, kLoL, kPlatformDOS, kTalkieDemoVersion, DE_DEU, &kLoLCharacterDefsDOSCDDemoProvider }, - { kMaxResIDs, kKyra1, kPlatformDOS, kNoSpecial, UNK_LANG, NULL } + { kMaxResIDs, kKyra1, kPlatformDOS, kNoSpecial, UNK_LANG, nullptr } }; const ResourceProvider *obtainResourceProviders() { diff --git a/devtools/create_lure/create_lure_dat.cpp b/devtools/create_lure/create_lure_dat.cpp index f5498370a4b..1f29874b2c4 100644 --- a/devtools/create_lure/create_lure_dat.cpp +++ b/devtools/create_lure/create_lure_dat.cpp @@ -1333,49 +1333,49 @@ void save_fight_segment(byte *&data, uint16 &totalSize) { #define NUM_TEXT_ENTRIES 56 const char *englishTextStrings[NUM_TEXT_ENTRIES] = { - "Get", NULL, "Push", "Pull", "Operate", "Open", "Close", "Lock", "Unlock", "Use", - "Give", "Talk to", "Tell", "Buy", "Look", "Look at", "Look through", "Ask", NULL, + "Get", nullptr, "Push", "Pull", "Operate", "Open", "Close", "Lock", "Unlock", "Use", + "Give", "Talk to", "Tell", "Buy", "Look", "Look at", "Look through", "Ask", nullptr, "Drink", "Status", "Go to", "Return", "Bribe", "Examine", "Credits", "Restart game", "Save game", "Restore game", "Quit", "Fast Text\x8B", "Slow Text\x8B", "Sound on", "Sound off", "(nothing)", " for ", " to ", " on ", "and then", "finish", "Are you sure (y/n)?", "You are carrying ", "nothing", "You have ", "groat", "groats", - NULL, "the ", "a ", "a ", "an ", "an ", "an ", "an ", NULL, NULL + nullptr, "the ", "a ", "a ", "an ", "an ", "an ", "an ", nullptr, nullptr }; const char *italianTextStrings[NUM_TEXT_ENTRIES] = { - "Prendi", NULL, "Spingi", "Tira", "Aziona", "Apri", "Chiudi", "Blocca", + "Prendi", nullptr, "Spingi", "Tira", "Aziona", "Apri", "Chiudi", "Blocca", "Sblocca", "Usa", "Dai", "Parla con", "Ordina a", "Compra", "Guarda", "Osserva", - "Guarda attraverso", "Chiedi", NULL, "Bevi", "Stato", "Vai a", "Ritorna", + "Guarda attraverso", "Chiedi", nullptr, "Bevi", "Stato", "Vai a", "Ritorna", "Corrompi", "Esamina", "Crediti", "Ricomincia", "Salva gioco", "Ripristina", "Abbandona", "Testo lento\x8B", "Testo veloce\x8B", "Sonoro acceso", "Sonoro spento", "(niente)", " per ", " a ", " su ", "e poi", "finito", "Sei sicuro (s/n)?", "Stai portando ", "niente", "Hai ", "soldo", "soldi", - NULL, "l' ", "la ", NULL, "le ", "i ", "il ", NULL, NULL, NULL + nullptr, "l' ", "la ", nullptr, "le ", "i ", "il ", nullptr, nullptr, nullptr }; const char frenchUnlockStr[] = {'D', '\x7f', 'v', 'e', 'r', 'r', 'o', 'u', 'i', 'l', 'l', 'e', '\0'}; const char frenchCreditsStr[] = {'C', 'r', '\x7f', 'd', 'i', 't', 's', '\0'}; const char *frenchTextStrings[NUM_TEXT_ENTRIES] = { - "Prends", NULL, "Pousse", "Tire", "Actionne", "Ouvre", "Ferme", "Verrouille", - frenchUnlockStr, "Utilise", "Donne", "Parle \0x81", "Dis \x81", NULL, - "Regarde", "Observe", "Regarde par", "Demande \x81", NULL, "Bois", "Statut", + "Prends", nullptr, "Pousse", "Tire", "Actionne", "Ouvre", "Ferme", "Verrouille", + frenchUnlockStr, "Utilise", "Donne", "Parle \0x81", "Dis \x81", nullptr, + "Regarde", "Observe", "Regarde par", "Demande \x81", nullptr, "Bois", "Statut", "Va \x81", "Reviens", "Corromps", "Examine", frenchCreditsStr, "Recommencer", "Sauvegarder", "Restituer", "Quitter", "Texte rapide\x8b", "Texte lent \x8b", "Avec son", "Sans son", "(rien)", " avec ", " \x81 ", " sur ", "et puis", "fin", "Vous \x83tes s\x89r (o/n)?", "Vous avez ", "rien", "et vous avez ", "sou", "sous", - NULL, "les", "l'", "l'", "le", "le", "la", "la", NULL, NULL + nullptr, "les", "l'", "l'", "le", "le", "la", "la", nullptr, nullptr }; const char *germanTextStrings[NUM_TEXT_ENTRIES] = { - "Nimm", NULL, "Schiebe", "Ziehe", "Bet\x8dtige", "\x90" "ffne", "Schlie\x92h" "e", + "Nimm", nullptr, "Schiebe", "Ziehe", "Bet\x8dtige", "\x90" "ffne", "Schlie\x92h" "e", "Sperre", "Steck Schl\x8cssel in", "Benutze", "Gib", "Sprich mit", "Befehl an", - NULL, "Betrachte", "Betrachte", "Schau durch", "Verlange", NULL, "Trink", + nullptr, "Betrachte", "Betrachte", "Schau durch", "Verlange", nullptr, "Trink", "Status", "Geh zu", "Zur\x8c" "ck", "Besteche", "Untersuche", "Mitwirkende", "Spiel neu starten", "Spiel sichern", "Gesichertes Spiel laden", "Abbrechen", "Schneller Text\x8b", @@ -1386,14 +1386,14 @@ const char *germanTextStrings[NUM_TEXT_ENTRIES] = { }; const char *spanishTextStrings[NUM_TEXT_ENTRIES] = { - "Coge", NULL, "Empuja", "Tira de", "Opera", "Abre", "Cierra", "Atranca", "Desatranca", "Usa", - "Dale", "Habla con", "Dile a", "Compra", "Obsevar", "Observe", "Mirar por", "P\x97" "dele", NULL, + "Coge", nullptr, "Empuja", "Tira de", "Opera", "Abre", "Cierra", "Atranca", "Desatranca", "Usa", + "Dale", "Habla con", "Dile a", "Compra", "Obsevar", "Observe", "Mirar por", "P\x97" "dele", nullptr, "Bebe", "Estado", "Ve a", "Regresa", "Sobornar", "Examinar", "Cr\x7f" "ditos", "Reiniciar", "Salvar juego", "Recuperar jue", "Abandonar", "Texto r\x98pido\x8b", "Texto lento \x8b", "Sonido activado ", "Sonido desactivado ", "(nada)", " con ", " a ", " con ", "y luego", "eso es todo", "\x94" "Est\x98s seguro? (S/N)", "Llevas ", "nada", "y tienes ", "moneda", "monedas", - "el ", "la ", "los ", "las ", "este ", "esta ", "estos ", "estas ", NULL, NULL + "el ", "la ", "los ", "las ", "este ", "esta ", "estos ", "estas ", nullptr, nullptr }; void save_text_strings(byte *&data, uint16 &totalSize) { @@ -1410,7 +1410,7 @@ void save_text_strings(byte *&data, uint16 &totalSize) { // Calculate the total needed space totalSize = sizeof(uint16); for (index = 0; index < NUM_TEXT_ENTRIES; ++index) { - if (textStrings[index] != NULL) + if (textStrings[index] != nullptr) totalSize += strlen(textStrings[index]); ++totalSize; } @@ -1421,7 +1421,7 @@ void save_text_strings(byte *&data, uint16 &totalSize) { char *p = (char *) data + sizeof(uint16); for (index = 0; index < NUM_TEXT_ENTRIES; ++index) { - if (textStrings[index] == NULL) + if (textStrings[index] == nullptr) *p++ = '\0'; else { strcpy(p, textStrings[index]); @@ -1485,7 +1485,7 @@ const DecoderEntry englishDecoders[] = { {"111111111111101", '\xa7'}, {"1111111111111100", '/'}, {"1111111111111101", 'Q'}, {"11111111111111100", '\xa8'}, {"11111111111111101", '('}, {"111111111111111100", ')'}, {"111111111111111101", '\x99'}, {"11111111111111111", '\xa9'}, - {NULL, '\0'} + {nullptr, '\0'} }; const DecoderEntry konamiDecoders[] = { @@ -1531,7 +1531,7 @@ const DecoderEntry konamiDecoders[] = { { "11111111111111100", '\x99' }, { "111111111111111010", '(' }, { "111111111111111011", ')' }, { "111111111111111100", '\xB2' }, { "111111111111111101", '\xDA' }, { "11111111111111111", '\xEC' }, - { NULL, '\0' } + { nullptr, '\0' } }; const DecoderEntry italianDecoders[] = { @@ -1564,7 +1564,7 @@ const DecoderEntry italianDecoders[] = { {"1111111111111100", (char) 0x4B}, {"1111111111111101", (char) 0x22}, {"111111111111111000", (char) 0x09}, {"111111111111111001", (char) 0x28}, {"11111111111111101", (char) 0x29}, {"111111111111111100", (char) 0x4A}, {"111111111111111101", (char) 0x59}, {"11111111111111111", (char) 0x78}, - {NULL, '\0'} + {nullptr, '\0'} }; const DecoderEntry frenchDecoders[] = { @@ -1609,7 +1609,7 @@ const DecoderEntry frenchDecoders[] = { {"1111111111111011", (char) 0x28}, {"1111111111111100", (char) 0x29}, {"1111111111111101", (char) 0x5A}, {"11111111111111100", (char) 0x86}, {"11111111111111101", (char) 0x58}, {"11111111111111110", (char) 0x84}, {"11111111111111111", (char) 0xA2}, - {NULL, '\0'} + {nullptr, '\0'} }; const DecoderEntry germanDecoders[] = { @@ -1653,7 +1653,7 @@ const DecoderEntry germanDecoders[] = { {"11111111111111010", (char) 0xBC}, {"11111111111111011", (char) 0x28}, {"111111111111111000", (char) 0x29}, {"111111111111111001", (char) 0x59}, {"11111111111111101", (char) 0xBB}, {"11111111111111110", (char) 0xBD}, {"11111111111111111", (char) 0xC0}, - {NULL, '\0'} + {nullptr, '\0'} }; const DecoderEntry spanishDecoders[] = { @@ -1688,7 +1688,7 @@ const DecoderEntry spanishDecoders[] = { {"1111111111111100", (char) 0x5A}, {"1111111111111101", (char) 0x8C}, {"11111111111111100", (char) 0x28}, {"11111111111111101", (char) 0x29}, {"11111111111111110", (char) 0x4B}, {"111111111111111110", (char) 0x58}, {"111111111111111111", (char) 0x91}, - {NULL, '\0'} + {nullptr, '\0'} }; void save_string_decoder_data(byte *&data, uint16 &totalSize) { @@ -1702,7 +1702,7 @@ void save_string_decoder_data(byte *&data, uint16 &totalSize) { totalSize = 1; const DecoderEntry *pSrc = list; - while (pSrc->sequence != NULL) { + while (pSrc->sequence != nullptr) { totalSize += strlen(pSrc->sequence) + 2; ++pSrc; } @@ -1711,7 +1711,7 @@ void save_string_decoder_data(byte *&data, uint16 &totalSize) { char *pDest = (char *)data; pSrc = list; - while (pSrc->sequence != NULL) { + while (pSrc->sequence != nullptr) { *pDest++ = pSrc->character; strcpy(pDest, pSrc->sequence); pDest += strlen(pSrc->sequence) + 1; @@ -1872,7 +1872,7 @@ void getEntry(uint8 entryIndex, uint16 &resourceId, byte *&data, uint16 &size) { break; default: - data = NULL; + data = nullptr; size = 0; resourceId = 0xffff; break; @@ -1955,7 +1955,7 @@ void createFile(const char *outFilename) { resourceFlag = true; for (int resIndex=0; resIndex < 0xBE; ++resIndex) { - resourceData = NULL; + resourceData = nullptr; // Get next data entry if (resourceFlag) @@ -2054,7 +2054,7 @@ bool validate_executable() { int main(int argc, char *argv[]) { - const char /**inFilename,*/ *outFilename = 0; + const char /**inFilename,*/ *outFilename = nullptr; if (argc == 1) { printf("Format: %s output_filename [lureExecutable ..]\n", argv[0]); diff --git a/devtools/create_lure/process_actions.cpp b/devtools/create_lure/process_actions.cpp index abf32b6fba8..bf164bfa6e0 100644 --- a/devtools/create_lure/process_actions.cpp +++ b/devtools/create_lure/process_actions.cpp @@ -380,7 +380,7 @@ void read_action_sequence(byte *&data, uint16 &totalSize) { for (roomIndex = 0; roomIndex < RANDOM_ROOM_NUM_ENTRIES; ++roomIndex) { randomActions[roomIndex].offset = lureExe.readWord(); randomActions[roomIndex].numEntries = 0; - randomActions[roomIndex].entries = NULL; + randomActions[roomIndex].entries = nullptr; } // Next get the set of offsetes for the start of each sequence @@ -540,7 +540,7 @@ void read_action_sequence(byte *&data, uint16 &totalSize) { // Free up the random room action array for (roomIndex = 0; roomIndex < 1; ++roomIndex) { - if (randomActions[roomIndex].entries != NULL) + if (randomActions[roomIndex].entries != nullptr) delete[] randomActions[roomIndex].entries; } delete[] randomActions; diff --git a/devtools/create_mortdat/create_mortdat.cpp b/devtools/create_mortdat/create_mortdat.cpp index ac1aaba8d1c..aa55327cceb 100644 --- a/devtools/create_mortdat/create_mortdat.cpp +++ b/devtools/create_mortdat/create_mortdat.cpp @@ -36,12 +36,12 @@ bool File::open(const char *filename, AccessMode mode) { f = fopen(filename, (mode == kFileReadMode) ? "rb" : "wb"); - return (f != NULL); + return (f != nullptr); } void File::close() { fclose(f); - f = NULL; + f = nullptr; } int File::seek(int32 offset, int whence) { diff --git a/devtools/create_neverhood/create_neverhood.cpp b/devtools/create_neverhood/create_neverhood.cpp index 8940abc6c1b..b207ac5adb5 100644 --- a/devtools/create_neverhood/create_neverhood.cpp +++ b/devtools/create_neverhood/create_neverhood.cpp @@ -81,7 +81,7 @@ byte *getData(uint32 offset) { } const char *getStringP(uint32 offset) { - return offset != 0 ? (const char*)getData(offset) : NULL; + return offset != 0 ? (const char*)getData(offset) : nullptr; } uint32 calcHash(const char *value) { diff --git a/devtools/create_neverhood/md5.cpp b/devtools/create_neverhood/md5.cpp index 0477002654b..522bb012f9b 100644 --- a/devtools/create_neverhood/md5.cpp +++ b/devtools/create_neverhood/md5.cpp @@ -228,7 +228,7 @@ bool md5_file(const char *name, uint8 digest[16], uint32 length) { FILE *f; f = fopen(name, "rb"); - if (f == NULL) { + if (f == nullptr) { printf("md5_file couldn't open '%s'\n", name); return false; } diff --git a/devtools/create_project/cmake.cpp b/devtools/create_project/cmake.cpp index 8569df91e66..2b5651a4d21 100644 --- a/devtools/create_project/cmake.cpp +++ b/devtools/create_project/cmake.cpp @@ -36,28 +36,28 @@ CMakeProvider::CMakeProvider(StringList &global_warnings, std::map isEngineEnabled; int main(int argc, char *argv[]) { #ifndef USE_WIN32_API // Initialize random number generator for UUID creation - std::srand((unsigned int)std::time(0)); + std::srand((unsigned int)std::time(nullptr)); #endif if (argc < 2) { @@ -135,7 +135,7 @@ int main(int argc, char *argv[]) { setup.features = getAllFeatures(); ProjectType projectType = kProjectNone; - const MSVCVersion *msvc = NULL; + const MSVCVersion *msvc = nullptr; int msvcVersion = 0; // Parse command line arguments @@ -451,7 +451,7 @@ int main(int argc, char *argv[]) { StringList globalWarnings; std::map projectWarnings; - CreateProjectTool::ProjectProvider *provider = NULL; + CreateProjectTool::ProjectProvider *provider = nullptr; switch (projectType) { default: @@ -1239,7 +1239,7 @@ const MSVCVersion *getMSVCVersion(int version) { return &s_msvc[i]; } - return NULL; + return nullptr; } int getInstalledMSVC() { @@ -1248,9 +1248,9 @@ int getInstalledMSVC() { // Use the Visual Studio Installer to get the latest version const char *vsWhere = "\"\"%PROGRAMFILES(X86)%\\Microsoft Visual Studio\\Installer\\vswhere.exe\" -latest -legacy -property installationVersion\""; FILE *pipe = _popen(vsWhere, "rt"); - if (pipe != NULL) { + if (pipe != nullptr) { char version[50]; - if (fgets(version, 50, pipe) != NULL) { + if (fgets(version, 50, pipe) != nullptr) { latest = atoi(version); } _pclose(pipe); @@ -1260,12 +1260,12 @@ int getInstalledMSVC() { if (latest == 0) { HKEY key; LONG err = RegOpenKeyEx(HKEY_LOCAL_MACHINE, TEXT("SOFTWARE\\Microsoft\\VisualStudio\\SxS\\VS7"), 0, KEY_QUERY_VALUE | KEY_WOW64_32KEY, &key); - if (err == ERROR_SUCCESS && key != NULL) { + if (err == ERROR_SUCCESS && key != nullptr) { const MSVCList msvc = getAllMSVCVersions(); for (MSVCList::const_reverse_iterator i = msvc.rbegin(); i != msvc.rend(); ++i) { std::ostringstream version; version << i->version << ".0"; - err = RegQueryValueExA(key, version.str().c_str(), NULL, NULL, NULL, NULL); + err = RegQueryValueExA(key, version.str().c_str(), nullptr, nullptr, nullptr, nullptr); if (err == ERROR_SUCCESS) { latest = i->version; break; @@ -1460,7 +1460,7 @@ FileList listDirectory(const std::string &dir) { void createDirectory(const std::string &dir) { #if defined(_WIN32) || defined(WIN32) - if (!CreateDirectoryA(dir.c_str(), NULL)) { + if (!CreateDirectoryA(dir.c_str(), nullptr)) { if (GetLastError() != ERROR_ALREADY_EXISTS) { error("Could not create folder \"" + dir + "\""); } @@ -1496,7 +1496,7 @@ FileNode *scanFiles(const std::string &dir, const StringList &includeList, const FileList files = listDirectory(dir); if (files.empty()) - return 0; + return nullptr; FileNode *result = new FileNode(dir); assert(result); @@ -1532,7 +1532,7 @@ FileNode *scanFiles(const std::string &dir, const StringList &includeList, const if (result->children.empty()) { delete result; - return 0; + return nullptr; } else { result->children.sort(compareNodes); return result; diff --git a/devtools/create_project/msvc.cpp b/devtools/create_project/msvc.cpp index 90986f9ba30..72bc683c060 100644 --- a/devtools/create_project/msvc.cpp +++ b/devtools/create_project/msvc.cpp @@ -55,32 +55,32 @@ MSVCProvider::MSVCProvider(StringList &global_warnings, std::map &project_warnings, const int version) : ProjectProvider(global_warnings, project_warnings, version) { - _rootSourceGroup = NULL; + _rootSourceGroup = nullptr; } void XcodeProvider::addResourceFiles(const BuildSetup &setup, StringList &includeList, StringList &excludeList) { diff --git a/devtools/create_supernova/create_supernova.cpp b/devtools/create_supernova/create_supernova.cpp index 34f6a43f422..374e1f94201 100644 --- a/devtools/create_supernova/create_supernova.cpp +++ b/devtools/create_supernova/create_supernova.cpp @@ -13,7 +13,7 @@ const char *lang[] = { "en", "it", - NULL + nullptr }; void writeDatafile(File& outputFile, int fileNumber, const char* language, int part) { diff --git a/devtools/create_supernova/file.cpp b/devtools/create_supernova/file.cpp index d54258d5a4c..a43517b034d 100644 --- a/devtools/create_supernova/file.cpp +++ b/devtools/create_supernova/file.cpp @@ -2,12 +2,12 @@ bool File::open(const char *filename, AccessMode mode) { f = fopen(filename, (mode == kFileReadMode) ? "rb" : "wb"); - return (f != NULL); + return (f != nullptr); } void File::close() { fclose(f); - f = NULL; + f = nullptr; } int File::seek(int32 offset, int whence) { diff --git a/devtools/create_supernova/po_parser.cpp b/devtools/create_supernova/po_parser.cpp index 05a8ac14a7a..d2661dcd8a1 100644 --- a/devtools/create_supernova/po_parser.cpp +++ b/devtools/create_supernova/po_parser.cpp @@ -5,7 +5,7 @@ #include "po_parser.h" -PoMessageList::PoMessageList() : _list(NULL), _size(0), _allocated(0) { +PoMessageList::PoMessageList() : _list(nullptr), _size(0), _allocated(0) { } PoMessageList::~PoMessageList() { @@ -15,11 +15,11 @@ PoMessageList::~PoMessageList() { } int PoMessageList::compareString(const char* left, const char* right) { - if (left == NULL && right == NULL) + if (left == nullptr && right == nullptr) return 0; - if (left == NULL) + if (left == nullptr) return -1; - if (right == NULL) + if (right == nullptr) return 1; return strcmp(left, right); } @@ -32,7 +32,7 @@ int PoMessageList::compareMessage(const char *msgLeft, const char *contextLeft, } void PoMessageList::insert(const char *translation, const char *msg, const char *context) { - if (msg == NULL || *msg == '\0' || translation == NULL || *translation == '\0') + if (msg == nullptr || *msg == '\0' || translation == nullptr || *translation == '\0') return; // binary-search for the insertion index @@ -68,8 +68,8 @@ void PoMessageList::insert(const char *translation, const char *msg, const char } const char *PoMessageList::findTranslation(const char *msg, const char *context) { - if (msg == NULL || *msg == '\0') - return NULL; + if (msg == nullptr || *msg == '\0') + return nullptr; // binary-search for the message int leftIndex = 0; @@ -84,13 +84,13 @@ const char *PoMessageList::findTranslation(const char *msg, const char *context) else leftIndex = midIndex + 1; } - return NULL; + return nullptr; } PoMessageList *parsePoFile(const char *file) { FILE *inFile = fopen(file, "r"); if (!inFile) - return NULL; + return nullptr; char msgidBuf[1024], msgctxtBuf[1024], msgstrBuf[1024]; char line[1024], *currentBuf = msgstrBuf; @@ -198,8 +198,8 @@ char *parseLine(const char *line, const char *field) { // It is used to parse the header of the po files to find the language name // and the charset. const char *str = strstr(line, field); - if (str == NULL) - return NULL; + if (str == nullptr) + return nullptr; str += strlen(field); // Skip spaces while (*str != '\0' && isspace(*str)) { @@ -211,7 +211,7 @@ char *parseLine(const char *line, const char *field) { ++len; } if (len == 0) - return NULL; + return nullptr; // Create result string char *result = new char[len + 1]; strncpy(result, str, len); diff --git a/devtools/create_teenagent/create_teenagent.cpp b/devtools/create_teenagent/create_teenagent.cpp index 2f180bb814a..916cfe28b64 100644 --- a/devtools/create_teenagent/create_teenagent.cpp +++ b/devtools/create_teenagent/create_teenagent.cpp @@ -33,7 +33,7 @@ int main(int argc, char *argv[]) { const char *dat_name = "teenagent.dat"; FILE *fout = fopen(dat_name, "wb"); - if (fout == NULL) { + if (fout == nullptr) { perror("opening output file"); exit(1); } diff --git a/devtools/create_titanic/memorypool.cpp b/devtools/create_titanic/memorypool.cpp index 13c640b6adc..55715a810e7 100644 --- a/devtools/create_titanic/memorypool.cpp +++ b/devtools/create_titanic/memorypool.cpp @@ -43,7 +43,7 @@ static size_t adjustChunkSize(size_t chunkSize) { MemoryPool::MemoryPool(size_t chunkSize) : _chunkSize(adjustChunkSize(chunkSize)) { - _next = NULL; + _next = nullptr; _chunksPerPage = INITIAL_CHUNKS_PER_PAGE; } @@ -154,7 +154,7 @@ void MemoryPool::freeUnusedPages() { ::free(_pages[i].start); ++freedPagesCount; - _pages[i].start = NULL; + _pages[i].start = nullptr; } } @@ -163,7 +163,7 @@ void MemoryPool::freeUnusedPages() { // Remove all now unused pages size_t newSize = 0; for (size_t i = 0; i < _pages.size(); ++i) { - if (_pages[i].start != NULL) { + if (_pages[i].start != nullptr) { if (newSize != i) _pages[newSize] = _pages[i]; ++newSize; diff --git a/devtools/create_titanic/winexe_pe.cpp b/devtools/create_titanic/winexe_pe.cpp index 6d382617874..34209ec4bc3 100644 --- a/devtools/create_titanic/winexe_pe.cpp +++ b/devtools/create_titanic/winexe_pe.cpp @@ -31,7 +31,7 @@ namespace Common { PEResources::PEResources() { - _exe = 0; + _exe = nullptr; } PEResources::~PEResources() { @@ -41,7 +41,7 @@ PEResources::~PEResources() { void PEResources::clear() { _sections.clear(); _resources.clear(); - delete _exe; _exe = 0; + delete _exe; _exe = nullptr; } bool PEResources::loadFromEXE(File *stream) { @@ -207,7 +207,7 @@ File *PEResources::getResource(const WinResourceID &type, const WinResourceID &i Array langList = getLangList(type, id); if (langList.empty()) - return 0; + return nullptr; const Resource &resource = _resources[type][id][langList[0]]; byte *data = (byte *)malloc(resource.size); @@ -221,17 +221,17 @@ File *PEResources::getResource(const WinResourceID &type, const WinResourceID &i File *PEResources::getResource(const WinResourceID &type, const WinResourceID &id, const WinResourceID &lang) { if (!_exe || !_resources.contains(type)) - return 0; + return nullptr; const IDMap &idMap = _resources[type]; if (!idMap.contains(id)) - return 0; + return nullptr; const LangMap &langMap = idMap[id]; if (!langMap.contains(lang)) - return 0; + return nullptr; const Resource &resource = langMap[lang]; byte *data = (byte *)malloc(resource.size); diff --git a/devtools/create_titanic/zlib.cpp b/devtools/create_titanic/zlib.cpp index 8cc916e8b00..eb44212e41f 100644 --- a/devtools/create_titanic/zlib.cpp +++ b/devtools/create_titanic/zlib.cpp @@ -83,7 +83,7 @@ bool inflateZlibHeaderless(byte *dst, uint dstLen, const byte *src, uint srcLen, return false; // Set the dictionary, if provided - if (dict != 0) { + if (dict != nullptr) { err = inflateSetDictionary(&stream, const_cast(dict), dictLen); if (err != Z_OK) return false; @@ -180,7 +180,7 @@ protected: public: GZipReadStream(SeekableReadStream *w, uint32 knownSize = 0) : _wrapped(w), _stream() { - assert(w != 0); + assert(w != nullptr); // Verify file header is correct w->seek(0, SEEK_SET); @@ -349,7 +349,7 @@ protected: public: GZipWriteStream(WriteStream *w) : _wrapped(w), _stream(), _pos(0) { - assert(w != 0); + assert(w != nullptr); // Adding 16 to windowBits indicates to zlib that it is supposed to // write gzip headers. This feature was added in zlib 1.2.0.4, @@ -366,7 +366,7 @@ public: _stream.next_out = _buf; _stream.avail_out = BUFSIZE; _stream.avail_in = 0; - _stream.next_in = 0; + _stream.next_in = nullptr; } ~GZipWriteStream() { diff --git a/devtools/create_translations/create_translations.cpp b/devtools/create_translations/create_translations.cpp index 44180313dfd..5b016c59990 100644 --- a/devtools/create_translations/create_translations.cpp +++ b/devtools/create_translations/create_translations.cpp @@ -72,7 +72,7 @@ void writeUint32BE(FILE *fp, uint32 value) { int stringSize(const char *string) { // Each string is preceded by its size coded on 2 bytes - if (string == NULL) + if (string == nullptr) return 2; int len = strlen(string) + 1; return 2 + len; @@ -83,7 +83,7 @@ int stringSize(const char *string) { void writeString(FILE *fp, const char *string) { // Each string is preceded by its size coded on 2 bytes - if (string == NULL) { + if (string == nullptr) { writeUint16BE(fp, 0); return; } @@ -109,7 +109,7 @@ int main(int argc, char *argv[]) { int len = strlen(argv[i]); if (scumm_stricmp(argv[i] + len - 2, "po") == 0) { PoMessageEntryList *po = parsePoFile(argv[i], messageIds); - if (po != NULL) { + if (po != nullptr) { translations.push_back(po); ++numLangs; } diff --git a/devtools/create_translations/po_parser.cpp b/devtools/create_translations/po_parser.cpp index 982c45059fb..d00614afb27 100644 --- a/devtools/create_translations/po_parser.cpp +++ b/devtools/create_translations/po_parser.cpp @@ -29,7 +29,7 @@ #include "po_parser.h" -PoMessageList::PoMessageList() : _messages(NULL), _size(0), _allocated(0) { +PoMessageList::PoMessageList() : _messages(nullptr), _size(0), _allocated(0) { } PoMessageList::~PoMessageList() { @@ -39,7 +39,7 @@ PoMessageList::~PoMessageList() { } void PoMessageList::insert(const char *msg) { - if (msg == NULL || *msg == '\0') + if (msg == nullptr || *msg == '\0') return; // binary-search for the insertion index @@ -76,7 +76,7 @@ void PoMessageList::insert(const char *msg) { } int PoMessageList::findIndex(const char *msg) { - if (msg == NULL || *msg == '\0') + if (msg == nullptr || *msg == '\0') return -1; // binary-search for the message @@ -103,13 +103,13 @@ int PoMessageList::size() const { const char *PoMessageList::operator[](int index) const { if (index < 0 || index >= _size) - return NULL; + return nullptr; return _messages[index]; } PoMessageEntryList::PoMessageEntryList(const char *lang) : - _lang(NULL), _langName(NULL), _langNameAlt(NULL), _useUTF8(true), - _list(NULL), _size(0), _allocated(0) + _lang(nullptr), _langName(nullptr), _langNameAlt(nullptr), _useUTF8(true), + _list(nullptr), _size(0), _allocated(0) { _lang = new char[1 + strlen(lang)]; strcpy(_lang, lang); @@ -132,12 +132,12 @@ void PoMessageEntryList::addMessageEntry(const char *translation, const char *me // This is the header. // We get the charset and the language name from the translation string char *str = parseLine(translation, "X-Language-name:"); - if (str != NULL) { + if (str != nullptr) { delete[] _langName; _langName = str; } str = parseLine(translation, "Language:"); - if (str != NULL) { + if (str != nullptr) { delete[] _langNameAlt; _langNameAlt = str; } @@ -155,12 +155,12 @@ void PoMessageEntryList::addMessageEntry(const char *translation, const char *me int midIndex = (leftIndex + rightIndex) / 2; int compareResult = strcmp(message, _list[midIndex]->msgid); if (compareResult == 0) { - if (context == NULL) { - if (_list[midIndex]->msgctxt == NULL) + if (context == nullptr) { + if (_list[midIndex]->msgctxt == nullptr) return; compareResult = -1; } else { - if (_list[midIndex]->msgctxt == NULL) + if (_list[midIndex]->msgctxt == nullptr) compareResult = 1; else { compareResult = strcmp(context, _list[midIndex]->msgctxt); @@ -180,14 +180,14 @@ void PoMessageEntryList::addMessageEntry(const char *translation, const char *me // context if it is not present for a specific context, we can optimize the file // size, memory used at run-time and performances (less strings to read from the file // and less strings to look for) by avoiding duplicate. - if (context != NULL && *context != '\0') { + if (context != nullptr && *context != '\0') { // Check if we have the same translation for no context int contextIndex = leftIndex - 1; while (contextIndex >= 0 && strcmp (message, _list[contextIndex]->msgid) == 0) { --contextIndex; } ++contextIndex; - if (contextIndex < leftIndex && _list[contextIndex]->msgctxt == NULL && strcmp(translation, _list[contextIndex]->msgstr) == 0) + if (contextIndex < leftIndex && _list[contextIndex]->msgctxt == nullptr && strcmp(translation, _list[contextIndex]->msgstr) == 0) return; } @@ -208,7 +208,7 @@ void PoMessageEntryList::addMessageEntry(const char *translation, const char *me _list[leftIndex] = new PoMessageEntry(translation, message, context); ++_size; - if (context == NULL || *context == '\0') { + if (context == nullptr || *context == '\0') { // Remove identical translations for a specific context (see comment above) int contextIndex = leftIndex + 1; int removed = 0; @@ -250,7 +250,7 @@ int PoMessageEntryList::size() const { const PoMessageEntry *PoMessageEntryList::entry(int index) const { if (index < 0 || index >= _size) - return NULL; + return nullptr; return _list[index]; } @@ -258,7 +258,7 @@ const PoMessageEntry *PoMessageEntryList::entry(int index) const { PoMessageEntryList *parsePoFile(const char *file, PoMessageList& messages) { FILE *inFile = fopen(file, "r"); if (!inFile) - return NULL; + return nullptr; char msgidBuf[2048], msgctxtBuf[2048], msgstrBuf[2048]; char line[2048], *currentBuf = msgstrBuf; @@ -382,8 +382,8 @@ char *parseLine(const char *line, const char *field) { // It is used to parse the header of the po files to find the language name // and the charset. const char *str = strstr(line, field); - if (str == NULL) - return NULL; + if (str == nullptr) + return nullptr; str += strlen(field); // Skip spaces while (*str != '\0' && isspace(*str)) { @@ -395,7 +395,7 @@ char *parseLine(const char *line, const char *field) { ++len; } if (len == 0) - return NULL; + return nullptr; // Create result string char *result = new char[len + 1]; strncpy(result, str, len); diff --git a/devtools/create_xeen/memorypool.cpp b/devtools/create_xeen/memorypool.cpp index 13c640b6adc..55715a810e7 100644 --- a/devtools/create_xeen/memorypool.cpp +++ b/devtools/create_xeen/memorypool.cpp @@ -43,7 +43,7 @@ static size_t adjustChunkSize(size_t chunkSize) { MemoryPool::MemoryPool(size_t chunkSize) : _chunkSize(adjustChunkSize(chunkSize)) { - _next = NULL; + _next = nullptr; _chunksPerPage = INITIAL_CHUNKS_PER_PAGE; } @@ -154,7 +154,7 @@ void MemoryPool::freeUnusedPages() { ::free(_pages[i].start); ++freedPagesCount; - _pages[i].start = NULL; + _pages[i].start = nullptr; } } @@ -163,7 +163,7 @@ void MemoryPool::freeUnusedPages() { // Remove all now unused pages size_t newSize = 0; for (size_t i = 0; i < _pages.size(); ++i) { - if (_pages[i].start != NULL) { + if (_pages[i].start != nullptr) { if (newSize != i) _pages[newSize] = _pages[i]; ++newSize; diff --git a/devtools/extract_mort/extract_mort.cpp b/devtools/extract_mort/extract_mort.cpp index f3507ad59c5..0400c4b311c 100644 --- a/devtools/extract_mort/extract_mort.cpp +++ b/devtools/extract_mort/extract_mort.cpp @@ -44,11 +44,11 @@ private: public: bool open(const char *filename, AccessMode mode = kFileReadMode) { f = fopen(filename, (mode == kFileReadMode) ? "rb" : "wb"); - return (f != NULL); + return (f != nullptr); } void close() { fclose(f); - f = NULL; + f = nullptr; } int seek(int32 offset, int whence = SEEK_SET) { return fseek(f, offset, whence); diff --git a/devtools/make-scumm-fontdata.cpp b/devtools/make-scumm-fontdata.cpp index 268d3339dd8..b843eff7569 100644 --- a/devtools/make-scumm-fontdata.cpp +++ b/devtools/make-scumm-fontdata.cpp @@ -816,7 +816,7 @@ static const unsigned char spanishCharsetDataV2[] = { 0x08, 0x0c, 0x0e, 0xff, 0xff, 0x0e, 0x0c, 0x08, }; -unsigned char *specialCharsetData = NULL; +unsigned char *specialCharsetData = nullptr; int numSpecialChars = 0; void compressCharset(const unsigned char *data, const char *var, const char *name) { @@ -884,7 +884,7 @@ int main(int /*argc*/, char ** /*argv*/) { printf("};\n"); free(specialCharsetData); - specialCharsetData = NULL; + specialCharsetData = nullptr; return 0; } diff --git a/devtools/md5table.cpp b/devtools/md5table.cpp index 48fed4706a4..809ac4eca83 100644 --- a/devtools/md5table.cpp +++ b/devtools/md5table.cpp @@ -92,7 +92,7 @@ static const StringMap platformMap[] = { { "All?", "kPlatformUnknown" }, { "All", "kPlatformUnknown" }, - { 0, "kPlatformUnknown" } + { nullptr, "kPlatformUnknown" } }; static const StringMap langMap[] = { @@ -119,7 +119,7 @@ static const StringMap langMap[] = { { "All", "UNK_LANG" }, { "All?", "UNK_LANG" }, - { 0, "UNK_LANG" } + { nullptr, "UNK_LANG" } }; static const char *php_header = @@ -166,13 +166,13 @@ static void parseEntry(Entry *entry, char *line) { /* Split at the tabs */ entry->md5 = strtok(line, "\t\n\r"); - entry->size = strtok(NULL, "\t\n\r"); - entry->language = strtok(NULL, "\t\n\r"); - entry->platform = strtok(NULL, "\t\n\r"); - entry->variant = strtok(NULL, "\t\n\r"); - entry->extra = strtok(NULL, "\t\n\r"); - entry->desc = strtok(NULL, "\t\n\r"); - entry->infoSource = strtok(NULL, "\t\n\r"); + entry->size = strtok(nullptr, "\t\n\r"); + entry->language = strtok(nullptr, "\t\n\r"); + entry->platform = strtok(nullptr, "\t\n\r"); + entry->variant = strtok(nullptr, "\t\n\r"); + entry->extra = strtok(nullptr, "\t\n\r"); + entry->desc = strtok(nullptr, "\t\n\r"); + entry->infoSource = strtok(nullptr, "\t\n\r"); } static int isEmptyLine(const char *line) { diff --git a/devtools/skycpt/TextFile.cpp b/devtools/skycpt/TextFile.cpp index b03e66121fd..e028c275295 100644 --- a/devtools/skycpt/TextFile.cpp +++ b/devtools/skycpt/TextFile.cpp @@ -25,7 +25,7 @@ TextFile::TextFile(const char *name) { FILE *inf = fopen(name, "r"); - _lines = NULL; + _lines = nullptr; if (!inf) { printf("Unable to open file %s\n", name); getchar(); @@ -54,7 +54,7 @@ uint32 crop(char *line) { char *TextFile::giveLine(uint32 num) { if (num >= _numLines) - return NULL; + return nullptr; else return _lines[num]; } diff --git a/devtools/skycpt/cpthelp.cpp b/devtools/skycpt/cpthelp.cpp index e2e4577a905..b2e10fd6bfa 100644 --- a/devtools/skycpt/cpthelp.cpp +++ b/devtools/skycpt/cpthelp.cpp @@ -24,7 +24,7 @@ #include "cpthelp.h" void assertEmpty(CptObj *cpt) { - assert((cpt->len == 0) && (cpt->data == NULL) && (cpt->dbgName == NULL) && (cpt->type == 0)); + assert((cpt->len == 0) && (cpt->data == nullptr) && (cpt->dbgName == nullptr) && (cpt->type == 0)); } uint16 getInfo(const char *line, const char *type, char *nameDest) {