HaikuPorts
  • Login
  • Preferences
  • Help/Guide
  • Wiki
  • Timeline
  • Roadmap
  • View Tickets
  • Search
  • Port Log
  • Blog

Context Navigation

  • Back to Ticket #545

Ticket #545: ja2-0.12.1-svn.patch

File ja2-0.12.1-svn.patch, 22.4 KB (added by michaelvoliveira, 4 years ago)

I need a better way to handle wcslcpy replacements

  • Build/Editor/Editor_Taskbar_Utils.cc

    diff -Naur ja2-0.12.1-svn/Build/Editor/Editor_Taskbar_Utils.cc ja2-0.12.1-svn-haiku/Build/Editor/Editor_Taskbar_Utils.cc
    old new  
    662662                if (d.ubLockID != 255) 
    663663                        swprintf(str, lengthof(str), L"%hs", LockTable[d.ubLockID].ubEditorName); 
    664664                else 
    665                         wcslcpy(str, L"No Lock ID", lengthof(str)); 
     665                        wcsncpy(str, L"No Lock ID", lengthof(str)); 
    666666                DisplayWrappedString(x - 10, y - 40, 60, 2, FONT10ARIAL, FONT_LTKHAKI, str, FONT_BLACK, CENTER_JUSTIFIED | MARK_DIRTY); 
    667667 
    668668                wchar_t const* trap_type; // HACK000E 
  • Build/Editor/EditorItems.cc

    diff -Naur ja2-0.12.1-svn/Build/Editor/EditorItems.cc ja2-0.12.1-svn-haiku/Build/Editor/EditorItems.cc
    old new  
    405405 
    406406                                if( eInfo.uiItemType != TBAR_MODE_ITEM_TRIGGERS ) 
    407407                                { 
    408                                         wcslcpy(pStr, ItemNames[usCounter], lengthof(pStr)); 
     408                                        wcsncpy(pStr, ItemNames[usCounter], lengthof(pStr)); 
    409409                                } 
    410410                                else 
    411411                                { 
    412412                                        if( i == PRESSURE_ACTION_ID ) 
    413413                                        { 
    414                                                 wcslcpy(pStr, L"Pressure Action", lengthof(pStr)); 
     414                                                wcsncpy(pStr, L"Pressure Action", lengthof(pStr)); 
    415415                                        } 
    416416                                        else if( i < 2 ) 
    417417                                        { 
    418418                                                if( usCounter == SWITCH ) 
    419                                                         wcslcpy(pStr, L"Panic Trigger1", lengthof(pStr)); 
     419                                                        wcsncpy(pStr, L"Panic Trigger1", lengthof(pStr)); 
    420420                                                else 
    421                                                         wcslcpy(pStr, L"Panic Action1", lengthof(pStr)); 
     421                                                        wcsncpy(pStr, L"Panic Action1", lengthof(pStr)); 
    422422                                        } 
    423423                                        else if( i < 4 ) 
    424424                                        { 
    425425                                                if( usCounter == SWITCH ) 
    426                                                         wcslcpy(pStr, L"Panic Trigger2", lengthof(pStr)); 
     426                                                        wcsncpy(pStr, L"Panic Trigger2", lengthof(pStr)); 
    427427                                                else 
    428                                                         wcslcpy(pStr, L"Panic Action2", lengthof(pStr)); 
     428                                                        wcsncpy(pStr, L"Panic Action2", lengthof(pStr)); 
    429429                                        } 
    430430                                        else if( i < 6 ) 
    431431                                        { 
    432432                                                if( usCounter == SWITCH ) 
    433                                                         wcslcpy(pStr, L"Panic Trigger3", lengthof(pStr)); 
     433                                                        wcsncpy(pStr, L"Panic Trigger3", lengthof(pStr)); 
    434434                                                else 
    435                                                         wcslcpy(pStr, L"Panic Action3", lengthof(pStr)); 
     435                                                        wcsncpy(pStr, L"Panic Action3", lengthof(pStr)); 
    436436                                        } 
    437437                                        else 
    438438                                        { 
  • Build/Editor/EditorMercs.cc

    diff -Naur ja2-0.12.1-svn/Build/Editor/EditorMercs.cc ja2-0.12.1-svn-haiku/Build/Editor/EditorMercs.cc
    old new  
    19651965                                                swprintf(str, lengthof(str), L"Click on the gridno where you wish to move after you %ls the door.", keyword); 
    19661966                                                break; 
    19671967                                        case SCHEDULE_INSTRUCTIONS_GRIDNO: 
    1968                                                 wcslcpy(str, L"Click on the gridno where you wish to move to.", lengthof(str)); 
     1968                                                wcsncpy(str, L"Click on the gridno where you wish to move to.", lengthof(str)); 
    19691969                                                break; 
    19701970                                        case SCHEDULE_INSTRUCTIONS_SLEEP: 
    1971                                                 wcslcpy(str, L"Click on the gridno where you wish to sleep at.  Person will automatically return to original position after waking up.", lengthof(str)); 
     1971                                                wcsncpy(str, L"Click on the gridno where you wish to sleep at.  Person will automatically return to original position after waking up.", lengthof(str)); 
    19721972                                        default: 
    19731973                                                return; 
    19741974                                } 
  • Build/Editor/LoadScreen.cc

    diff -Naur ja2-0.12.1-svn/Build/Editor/LoadScreen.cc ja2-0.12.1-svn-haiku/Build/Editor/LoadScreen.cc
    old new  
    10331033 
    10341034static BOOLEAN ExtractFilenameFromFields(void) 
    10351035{ 
    1036         wcslcpy(gzFilename, GetStringFromField(0), lengthof(gzFilename)); 
     1036        wcsncpy(gzFilename, GetStringFromField(0), lengthof(gzFilename)); 
    10371037        return ValidFilename(); 
    10381038} 
    10391039 
  • Build/Editor/Sector_Summary.cc

    diff -Naur ja2-0.12.1-svn/Build/Editor/Sector_Summary.cc ja2-0.12.1-svn-haiku/Build/Editor/Sector_Summary.cc
    old new  
    23472347                gfOverrideDirty = TRUE; 
    23482348        } 
    23492349        if( !wcslen( str ) ) 
    2350                 wcslcpy(gszDisplayName, L"test.dat", lengthof(gszDisplayName)); 
     2350                wcsncpy(gszDisplayName, L"test.dat", lengthof(gszDisplayName)); 
    23512351} 
    23522352 
    23532353void ApologizeOverrideAndForceUpdateEverything() 
  • Build/Laptop/AIMMembers.cc

    diff -Naur ja2-0.12.1-svn/Build/Laptop/AIMMembers.cc ja2-0.12.1-svn-haiku/Build/Laptop/AIMMembers.cc
    old new  
    12911291        //Title & Name 
    12921292        if( gubVideoConferencingMode == AIM_VIDEO_INIT_MODE) 
    12931293        { 
    1294                 wcslcpy(sMercName, VideoConfercingText[AIM_MEMBER_CONNECTING], lengthof(sMercName)); 
     1294                wcsncpy(sMercName, VideoConfercingText[AIM_MEMBER_CONNECTING], lengthof(sMercName)); 
    12951295                DrawTextToScreen(sMercName, AIM_MEMBER_VIDEO_NAME_X, AIM_MEMBER_VIDEO_NAME_Y, 0, FONT12ARIAL, AIM_M_VIDEO_TITLE_COLOR, FONT_MCOLOR_BLACK, LEFT_JUSTIFIED); 
    12961296        } 
    12971297        else 
    … …  
    14301430        } 
    14311431        else 
    14321432        { 
    1433                 wcslcpy(wTemp, wDollarTemp, lengthof(wTemp)); 
     1433                wcsncpy(wTemp, wDollarTemp, lengthof(wTemp)); 
    14341434        } 
    14351435        DrawTextToScreen(wTemp, AIM_CONTRACT_CHARGE_AMOUNNT_X + 1, AIM_CONTRACT_CHARGE_AMOUNNT_Y + 3, 0, AIM_M_VIDEO_CONTRACT_AMOUNT_FONT, AIM_M_VIDEO_CONTRACT_AMOUNT_COLOR, FONT_MCOLOR_BLACK, LEFT_JUSTIFIED); 
    14361436} 
  • Build/Laptop/BobbyRGuns.cc

    diff -Naur ja2-0.12.1-svn/Build/Laptop/BobbyRGuns.cc ja2-0.12.1-svn-haiku/Build/Laptop/BobbyRGuns.cc
    old new  
    850850 
    851851        // ammo or gun? 
    852852        AmmoKind const calibre = item->usItemClass == IC_AMMO ? Magazine[item->ubClassIndex].ubCalibre : Weapon[item->ubClassIndex].ubCalibre; 
    853         wcslcpy(zTemp, BobbyRayAmmoCaliber[calibre], lengthof(zTemp)); 
     853        wcsncpy(zTemp, BobbyRayAmmoCaliber[calibre], lengthof(zTemp)); 
    854854 
    855855        ReduceStringLength(zTemp, lengthof(zTemp), BOBBYR_GRID_PIC_WIDTH, BOBBYR_ITEM_NAME_TEXT_FONT); 
    856856        DrawTextToScreen(zTemp, BOBBYR_ITEM_WEIGHT_NUM_X, usPosY, BOBBYR_ITEM_WEIGHT_NUM_WIDTH, BOBBYR_ITEM_DESC_TEXT_FONT, BOBBYR_ITEM_DESC_TEXT_COLOR, FONT_MCOLOR_BLACK, RIGHT_JUSTIFIED); 
  • Build/Laptop/Finances.cc

    diff -Naur ja2-0.12.1-svn/Build/Laptop/Finances.cc ja2-0.12.1-svn-haiku/Build/Laptop/Finances.cc
    old new  
    828828                case PAY_SPECK_FOR_MERC: 
    829829                case PURCHASED_FLOWERS: 
    830830                case TRANSACTION_FEE: 
    831                         wcslcpy(pString, pTransactionText[code], Length); 
     831                        wcsncpy(pString, pTransactionText[code], Length); 
    832832                        break; 
    833833 
    834834                case CANCELLED_INSURANCE: 
  • Build/Laptop/Florist_Order_Form.cc

    diff -Naur ja2-0.12.1-svn/Build/Laptop/Florist_Order_Form.cc ja2-0.12.1-svn-haiku/Build/Laptop/Florist_Order_Form.cc
    old new  
    372372        RemoveButton( guiFlowerOrderGalleryButton ); 
    373373 
    374374        //Store the text fields 
    375         wcslcpy(gsSentimentTextField, GetStringFromField(1), lengthof(gsSentimentTextField)); 
    376         wcslcpy(gsNameTextField,      GetStringFromField(2), lengthof(gsNameTextField)); 
     375        wcsncpy(gsSentimentTextField, GetStringFromField(1), lengthof(gsSentimentTextField)); 
     376        wcsncpy(gsNameTextField,      GetStringFromField(2), lengthof(gsNameTextField)); 
    377377        gbCurrentlySelectedCard = -1; 
    378378 
    379379 
    … …  
    743743        UINT8 const text_field_id = GetActiveFieldID(); 
    744744        if (text_field_id == 1) 
    745745        { // The personel sentiment field 
    746                 wcslcpy(gsSentimentTextField, GetStringFromField(text_field_id), lengthof(gsSentimentTextField)); 
     746                wcsncpy(gsSentimentTextField, GetStringFromField(text_field_id), lengthof(gsSentimentTextField)); 
    747747        } 
    748748        else if (text_field_id == 2) 
    749749        { // The name field 
    750                 wcslcpy(gsNameTextField, GetStringFromField(text_field_id), lengthof(gsNameTextField)); 
     750                wcsncpy(gsNameTextField, GetStringFromField(text_field_id), lengthof(gsNameTextField)); 
    751751        } 
    752752 
    753753        SetActiveField(0); 
    … …  
    802802 
    803803                        //disable the text entry fields 
    804804//                      DisableAllTextFields(); 
    805                                 wcslcpy(gsSentimentTextField, GetStringFromField(1), lengthof(gsSentimentTextField)); 
     805                                wcsncpy(gsSentimentTextField, GetStringFromField(1), lengthof(gsSentimentTextField)); 
    806806                                KillTextInputMode(); 
    807807 
    808808                        //disable the clear order and accept order buttons, (their rendering interferes with the drop down graphics) 
    … …  
    947947                wchar_t sText[FLOR_CARD_TEXT_TITLE_SIZE]; 
    948948                CleanOutControlCodesFromString(sTemp, sText); 
    949949 
    950                 wcslcpy(gsSentimentTextField, sText, lengthof(gsSentimentTextField)); 
     950                wcsncpy(gsSentimentTextField, sText, lengthof(gsSentimentTextField)); 
    951951 
    952952                gbCurrentlySelectedCard = -1; 
    953953 
  • Build/Laptop/Insurance_Contract.cc

    diff -Naur ja2-0.12.1-svn/Build/Laptop/Insurance_Contract.cc ja2-0.12.1-svn-haiku/Build/Laptop/Insurance_Contract.cc
    old new  
    490490 
    491491        //display the amount of time the merc has left on their Regular contract 
    492492        if (is_dead) 
    493                 wcslcpy(sText, pMessageStrings[MSG_LOWERCASE_NA], lengthof(sText)); 
     493                wcsncpy(sText, pMessageStrings[MSG_LOWERCASE_NA], lengthof(sText)); 
    494494        else 
    495495                swprintf( sText, lengthof(sText), L"%d", GetTimeRemainingOnSoldiersContract( pSoldier ) ); 
    496496 
    … …  
    515515 
    516516        //if the soldier has insurance, disply the length of time the merc has left 
    517517        if (is_dead) 
    518                 wcslcpy(sText, pMessageStrings[MSG_LOWERCASE_NA], lengthof(sText)); 
     518                wcsncpy(sText, pMessageStrings[MSG_LOWERCASE_NA], lengthof(sText)); 
    519519        else if( pSoldier->usLifeInsurance != 0 ) 
    520520                swprintf( sText, lengthof(sText), L"%d", GetTimeRemainingOnSoldiersInsuranceContract( pSoldier ) ); 
    521521 
    … …  
    558558 
    559559        if (is_dead) 
    560560        { 
    561                 wcslcpy(sText, L"$0", lengthof(sText)); 
     561                wcsncpy(sText, L"$0", lengthof(sText)); 
    562562        } 
    563563        //display the amount owing 
    564564        DrawTextToScreen(sText, dx + 32, dy + 179, 72, INS_FONT_MED, INS_FONT_COLOR, FONT_MCOLOR_BLACK, RIGHT_JUSTIFIED); 
  • Build/Laptop/Personnel.cc

    diff -Naur ja2-0.12.1-svn/Build/Laptop/Personnel.cc ja2-0.12.1-svn-haiku/Build/Laptop/Personnel.cc
    old new  
    655655        else 
    656656        { 
    657657                //nick name 
    658                 wcslcpy(sString, s.name, lengthof(sString)); 
     658                wcsncpy(sString, s.name, lengthof(sString)); 
    659659        } 
    660660        FindFontCenterCoordinates(CHAR_NAME_LOC_X, 0, CHAR_NAME_LOC_WIDTH, 0, sString, CHAR_NAME_FONT, &sX, &sY); 
    661661        MPrint(sX, CHAR_NAME_Y, sString); 
    … …  
    737737        } 
    738738        else 
    739739        { 
    740                 wcslcpy(sString, pPOWStrings[1], lengthof(sString)); 
     740                wcsncpy(sString, pPOWStrings[1], lengthof(sString)); 
    741741        } 
    742742        mprintf(pers_stat_x, pers_stat_y[0], L"%ls:", str_stat_health); 
    743743        FindFontRightCoordinates(pers_stat_x, 0, TEXT_BOX_WIDTH - 20, 0, sString, PERS_FONT, &sX, &sY); 
    … …  
    11671167 
    11681168                SetFontDestBuffer(FRAME_BUFFER); 
    11691169 
    1170                 wcslcpy(sString, ItemNames[item_idx], lengthof(sString)); 
     1170                wcsncpy(sString, ItemNames[item_idx], lengthof(sString)); 
    11711171                ReduceStringLength(sString, lengthof(sString), 171 - 75, FONT10ARIAL); 
    11721172                MPrint(PosX + 65, PosY + 3, sString); 
    11731173 
    … …  
    11881188 
    11891189                if (item.usItemClass & IC_GUN) 
    11901190                { 
    1191                         wcslcpy(sString, AmmoCaliber[Weapon[item.ubClassIndex].ubCalibre], lengthof(sString)); 
     1191                        wcsncpy(sString, AmmoCaliber[Weapon[item.ubClassIndex].ubCalibre], lengthof(sString)); 
    11921192                        ReduceStringLength(sString, lengthof(sString), 171 - 75, FONT10ARIAL); 
    11931193                        MPrint(PosX + 65, PosY + 15, sString); 
    11941194                } 
  • Build/SaveLoadGame.cc

    diff -Naur ja2-0.12.1-svn/Build/SaveLoadGame.cc ja2-0.12.1-svn-haiku/Build/SaveLoadGame.cc
    old new  
    272272                else 
    273273                { 
    274274                        if (GameDesc[0] == L'\0') GameDesc = pMessageStrings[MSG_NODESC]; 
    275                         wcslcpy(desc, GameDesc, lengthof(desc)); 
     275                        wcsncpy(desc, GameDesc, lengthof(desc)); 
    276276                } 
    277277 
    278278                MakeFileManDirectory(g_savegame_dir); 
  • Build/SaveLoadScreen.cc

    diff -Naur ja2-0.12.1-svn/Build/SaveLoadScreen.cc ja2-0.12.1-svn-haiku/Build/SaveLoadScreen.cc
    old new  
    552552        INT8 const id = GetActiveFieldID(); 
    553553        if (id == 0 || id == -1) return false; 
    554554 
    555         wcslcpy(gzGameDescTextField, GetStringFromField(id), lengthof(gzGameDescTextField)); 
     555        wcsncpy(gzGameDescTextField, GetStringFromField(id), lengthof(gzGameDescTextField)); 
    556556        return true; 
    557557} 
    558558 
    … …  
    873873                        } 
    874874                        else if (header.uiDay * NUM_SEC_IN_DAY + header.ubHour * NUM_SEC_IN_HOUR + header.ubMin * NUM_SEC_IN_MIN <= STARTING_TIME) 
    875875                        { 
    876                                 wcslcpy(location, gpStrategicString[STR_PB_NOTAPPLICABLE_ABBREVIATION], lengthof(location)); 
     876                                wcsncpy(location, gpStrategicString[STR_PB_NOTAPPLICABLE_ABBREVIATION], lengthof(location)); 
    877877                        } 
    878878                        else 
    879879                        { 
    880                                 wcslcpy(location, gzLateLocalizedString[STR_LATE_14], lengthof(location)); 
     880                                wcsncpy(location, gzLateLocalizedString[STR_LATE_14], lengthof(location)); 
    881881                        } 
    882882                        ReduceStringLength(location, lengthof(location), SLG_SECTOR_WIDTH, font); 
    883883                        DrawTextToScreen(location, x + SLG_SECTOR_OFFSET_X, y, 0, font, foreground, FONT_MCOLOR_BLACK, LEFT_JUSTIFIED); 
  • Build/Strategic/Auto_Resolve.cc

    diff -Naur ja2-0.12.1-svn/Build/Strategic/Auto_Resolve.cc ja2-0.12.1-svn-haiku/Build/Strategic/Auto_Resolve.cc
    old new  
    15461546                cell->usIndex        = s->ubBodyType == REGFEMALE ? ELITEF_FACE : face; 
    15471547                s->sSectorX          = ar->ubSectorX; 
    15481548                s->sSectorY          = ar->ubSectorY; 
    1549                 wcslcpy(s->name, name, lengthof(s->name)); 
     1549                wcsncpy(s->name, name, lengthof(s->name)); 
    15501550        } 
    15511551        return cell; 
    15521552} 
    … …  
    15621562                cell->usIndex        = face; 
    15631563                s->sSectorX          = ar->ubSectorX; 
    15641564                s->sSectorY          = ar->ubSectorY; 
    1565                 wcslcpy(s->name, gpStrategicString[STR_AR_CREATURE_NAME], lengthof(s->name)); 
     1565                wcsncpy(s->name, gpStrategicString[STR_AR_CREATURE_NAME], lengthof(s->name)); 
    15661566        } 
    15671567        return cell; 
    15681568} 
    … …  
    16741674                AssertMsg(s, "Failed to create militia soldier for autoresolve."); 
    16751675                s->sSectorX = ar->ubSectorX; 
    16761676                s->sSectorY = ar->ubSectorY; 
    1677                 wcslcpy(s->name, gpStrategicString[STR_AR_MILITIA_NAME], lengthof(s->name)); 
     1677                wcsncpy(s->name, gpStrategicString[STR_AR_MILITIA_NAME], lengthof(s->name)); 
    16781678        } 
    16791679 
    16801680        if (gubEnemyEncounterCode != CREATURE_ATTACK_CODE) 
  • Build/Strategic/Map_Screen_Interface.cc

    diff -Naur ja2-0.12.1-svn/Build/Strategic/Map_Screen_Interface.cc ja2-0.12.1-svn-haiku/Build/Strategic/Map_Screen_Interface.cc
    old new  
    17171717        fhr->iX = x; 
    17181718        fhr->iY = y; 
    17191719        fhr->iW = width; 
    1720         wcslcpy(fhr->FastHelpText, text, lengthof(fhr->FastHelpText)); 
     1720        wcsncpy(fhr->FastHelpText, text, lengthof(fhr->FastHelpText)); 
    17211721        giSizeOfInterfaceFastHelpTextList = 1; 
    17221722} 
    17231723 
  • Build/Strategic/Merc_Contract.cc

    diff -Naur ja2-0.12.1-svn/Build/Strategic/Merc_Contract.cc ja2-0.12.1-svn-haiku/Build/Strategic/Merc_Contract.cc
    old new  
    777777                if (elsewhere == SECTOR(x, y) && z == 0) goto no_choice; 
    778778 
    779779                // Set strings for generic buttons 
    780                 wcslcpy(gzUserDefinedButton1, town_sector, lengthof(gzUserDefinedButton1)); 
     780                wcsncpy(gzUserDefinedButton1, town_sector, lengthof(gzUserDefinedButton1)); 
    781781                GetShortSectorString(SECTORX(elsewhere), SECTORY(elsewhere), gzUserDefinedButton2, lengthof(gzUserDefinedButton2)); 
    782782 
    783783                wchar_t const* const town = g_towns_locative[GetTownIdForSector(elsewhere)]; 
  • Build/Strategic/Player_Command.cc

    diff -Naur ja2-0.12.1-svn/Build/Strategic/Player_Command.cc ja2-0.12.1-svn-haiku/Build/Strategic/Player_Command.cc
    old new  
    2929        UINT32 const facilities = SectorInfo[SECTOR(x, y)].uiFacilitiesFlags; 
    3030        if (facilities == 0) 
    3131        { 
    32           wcslcpy(buf, sFacilitiesStrings[0], length); 
     32          wcsncpy(buf, sFacilitiesStrings[0], length); 
    3333                return; 
    3434        } 
    3535 
  • Build/Strategic/Quest_Debug_System.cc

    diff -Naur ja2-0.12.1-svn/Build/Strategic/Quest_Debug_System.cc ja2-0.12.1-svn-haiku/Build/Strategic/Quest_Debug_System.cc
    old new  
    32393239        if (pSoldier != NULL && pSoldier->uiStatusFlags & SOLDIER_OFF_MAP) 
    32403240        { 
    32413241                //the soldier is on schedule 
    3242                 wcslcpy(pzText, L"On Schdl.", Length); 
     3242                wcsncpy(pzText, L"On Schdl.", Length); 
    32433243        } 
    32443244 
    32453245        //if the soldier is dead 
    32463246        else if( gMercProfiles[ usProfileID ].bMercStatus == MERC_IS_DEAD ) 
    32473247        { 
    3248                 wcslcpy(pzText, L"Dead", Length); 
     3248                wcsncpy(pzText, L"Dead", Length); 
    32493249        } 
    32503250 
    32513251        //the soldier is in this sector 
  • Build/Strategic/StrategicMap.cc

    diff -Naur ja2-0.12.1-svn/Build/Strategic/StrategicMap.cc ja2-0.12.1-svn-haiku/Build/Strategic/StrategicMap.cc
    old new  
    15201520void GetSectorIDString(INT16 const x, INT16 const y, INT8 const z, wchar_t* const buf, size_t const length, BOOLEAN const detailed) 
    15211521{ 
    15221522#ifdef JA2DEMO 
    1523         wcslcpy(buf, L"Demoville", length); 
     1523        wcsncpy(buf, L"Demoville", length); 
    15241524#else 
    15251525        if (x <= 0 || y <= 0 || z < 0) /* Empty? */ 
    15261526        { 
  • Build/Tactical/Enemy_Soldier_Save.cc

    diff -Naur ja2-0.12.1-svn/Build/Tactical/Enemy_Soldier_Save.cc ja2-0.12.1-svn-haiku/Build/Tactical/Enemy_Soldier_Save.cc
    old new  
    748748                        dp->sInsertionGridNo = curr->pBasicPlacement->usStartingGridNo; 
    749749                } 
    750750 
    751                 wcslcpy(dp->name, s.name, lengthof(dp->name)); 
     751                wcsncpy(dp->name, s.name, lengthof(dp->name)); 
    752752 
    753753                // Copy patrol points 
    754754                dp->bPatrolCnt = s.bPatrolCnt; 
  • Build/Tactical/Interface_Dialogue.cc

    diff -Naur ja2-0.12.1-svn/Build/Tactical/Interface_Dialogue.cc ja2-0.12.1-svn-haiku/Build/Tactical/Interface_Dialogue.cc
    old new  
    27302730                                // NOW overwrite name with true name in profile 
    27312731                                // copy new nickname into soldier structure 
    27322732                                { 
    2733                                         wcslcpy(gMercProfiles[ubTargetNPC].zNickname, gMercProfiles[ubTargetNPC].zName, lengthof(gMercProfiles[ubTargetNPC].zNickname)); 
     2733                                        wcsncpy(gMercProfiles[ubTargetNPC].zNickname, gMercProfiles[ubTargetNPC].zName, lengthof(gMercProfiles[ubTargetNPC].zNickname)); 
    27342734                                        SOLDIERTYPE* const pSoldier = FindSoldierByProfileID(ubTargetNPC); 
    27352735                                        if ( pSoldier ) 
    27362736                                        { 
    2737                                                 wcslcpy(pSoldier->name, gMercProfiles[ubTargetNPC].zNickname, lengthof(pSoldier->name)); 
     2737                                                wcsncpy(pSoldier->name, gMercProfiles[ubTargetNPC].zNickname, lengthof(pSoldier->name)); 
    27382738                                        } 
    27392739                                } 
    27402740                                break; 
  • Build/Tactical/Interface_Items.cc

    diff -Naur ja2-0.12.1-svn/Build/Tactical/Interface_Items.cc ja2-0.12.1-svn-haiku/Build/Tactical/Interface_Items.cc
    old new  
    47784778                        } 
    47794779                        else 
    47804780                        { 
    4781                                 wcslcpy(pStr, ShortItemNames[o.usItem], lengthof(pStr)); 
     4781                                wcsncpy(pStr, ShortItemNames[o.usItem], lengthof(pStr)); 
    47824782                        } 
    47834783                        INT16 sFontX; 
    47844784                        INT16 sFontY; 
    … …  
    51925192        } 
    51935193        else if (usItem == NOTHING) 
    51945194        { 
    5195                 wcslcpy(dst, L"", length); 
     5195                wcsncpy(dst, L"", length); 
    51965196        } 
    51975197        else 
    51985198        { 
  • Build/Tactical/Soldier_Create.cc

    diff -Naur ja2-0.12.1-svn/Build/Tactical/Soldier_Create.cc ja2-0.12.1-svn-haiku/Build/Tactical/Soldier_Create.cc
    old new  
    892892 
    893893                default: goto no_name; // XXX fishy 
    894894        } 
    895         wcslcpy(s.name, name, lengthof(s.name)); 
     895        wcsncpy(s.name, name, lengthof(s.name)); 
    896896no_name: 
    897897 
    898898        GeneratePaletteForSoldier(&s, c.ubSoldierClass); 
  • Build/TileEngine/Render_Dirty.cc

    diff -Naur ja2-0.12.1-svn/Build/TileEngine/Render_Dirty.cc ja2-0.12.1-svn-haiku/Build/TileEngine/Render_Dirty.cc
    old new  
    502502                v->uiFontID   = font; 
    503503                v->ubFontFore = foreground; 
    504504                v->ubFontBack = background; 
    505                 wcslcpy(v->zText, text, lengthof(v->zText)); 
     505                wcsncpy(v->zText, text, lengthof(v->zText)); 
    506506        } 
    507507        return v; 
    508508} 
  • Build/Utils/Text_Input.cc

    diff -Naur ja2-0.12.1-svn/Build/Utils/Text_Input.cc ja2-0.12.1-svn-haiku/Build/Utils/Text_Input.cc
    old new  
    250250        { 
    251251                n->ubStrLen = wcslen(szInitText); 
    252252                Assert(n->ubStrLen <= ubMaxChars); 
    253                 wcslcpy(n->szString, szInitText, ubMaxChars + 1); 
     253                wcsncpy(n->szString, szInitText, ubMaxChars + 1); 
    254254        } 
    255255        else 
    256256        { 
    … …  
    345345        { 
    346346                curr->ubStrLen = (UINT8)wcslen(szNewText); 
    347347                Assert(curr->ubStrLen <= curr->ubMaxChars); 
    348                 wcslcpy(curr->szString, szNewText, curr->ubMaxChars + 1); 
     348                wcsncpy(curr->szString, szNewText, curr->ubMaxChars + 1); 
    349349        } 
    350350        else if (!curr->fUserField) 
    351351        { 
  • Build/Utils/WordWrap.cc

    diff -Naur ja2-0.12.1-svn/Build/Utils/WordWrap.cc ja2-0.12.1-svn-haiku/Build/Utils/WordWrap.cc
    old new  
    477477                RestWidth -= CharWidth; 
    478478        } 
    479479 
    480         wcslcpy(pString + i, Dots, Length - i); 
     480        wcsncpy(pString + i, Dots, Length - i); 
    481481} 
  • Makefile

    diff -Naur ja2-0.12.1-svn/Makefile ja2-0.12.1-svn-haiku/Makefile
    old new  
    111111CXXFLAGS += $(CFLAGS) 
    112112 
    113113LDFLAGS += $(LDFLAGS_SDL) 
    114 LDFLAGS += -lm 
     114LDFLAGS += 
    115115 
    116116ifdef WITH_ZLIB 
    117117LDFLAGS += -lz 

Download in other formats:

  • Original Format

Trac Powered

Powered by Trac 0.13dev-r10686
By Edgewall Software.

Visit the Trac open source project at
http://trac.edgewall.org/